diff --git a/.hgignore b/.hgignore index 567736441..0427edd20 100644 --- a/.hgignore +++ b/.hgignore @@ -44,6 +44,7 @@ default_c *.so.* *_debug core +*.pc # Mac OS X compile *.dylib diff --git a/code/nel/CMakeModules/FindEFXUtil.cmake b/code/nel/CMakeModules/FindEFXUtil.cmake new file mode 100644 index 000000000..5e2f410b0 --- /dev/null +++ b/code/nel/CMakeModules/FindEFXUtil.cmake @@ -0,0 +1,50 @@ +# - Locate EFX-Util library +# This module defines +# EFXUTIL_LIBRARY, the library to link against +# EFXUTIL_FOUND, if false, do not try to link to EFX-Util +# EFXUTIL_INCLUDE_DIR, where to find headers. + +IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) + # in cache already + SET(EFXUTIL_FIND_QUIETLY TRUE) +ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) + + +FIND_PATH(EFXUTIL_INCLUDE_DIR + EFX-Util.h + PATHS + $ENV{EFXUTIL_DIR}/include + /usr/local/include + /usr/include + /sw/include + /opt/local/include + /opt/csw/include + /opt/include + PATH_SUFFIXES AL +) + +FIND_LIBRARY(EFXUTIL_LIBRARY + NAMES EFX-Util efxutil libefxutil + PATHS + $ENV{EFXUTIL_DIR}/lib + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) + SET(EFXUTIL_FOUND "YES") + IF(NOT EFXUTIL_FIND_QUIETLY) + MESSAGE(STATUS "Found EFX-Util: ${EFXUTIL_LIBRARY}") + ENDIF(NOT EFXUTIL_FIND_QUIETLY) +ELSE(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) + IF(NOT EFXUTIL_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find EFX-Util!") + ENDIF(NOT EFXUTIL_FIND_QUIETLY) +ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR) diff --git a/code/nel/CMakeModules/FindSquish.cmake b/code/nel/CMakeModules/FindSquish.cmake new file mode 100644 index 000000000..2fcbc1a1a --- /dev/null +++ b/code/nel/CMakeModules/FindSquish.cmake @@ -0,0 +1,51 @@ +# +# Find the LibSquish includes and library +# +# This module defines +# SQUISH_INCLUDE_DIR, where to find squish.h +# SQUISH_LIBRARY, where to find the Squish library. +# SQUISH_FOUND, If false, do not try to use Squish. + +# also defined, but not for general use are +IF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) + # in cache already + SET(SQUISH_FIND_QUIETLY TRUE) +ENDIF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) + +FIND_PATH(SQUISH_INCLUDE_DIR + squish.h + PATHS + /usr/local/include + /usr/include + /sw/include + /opt/local/include + /opt/csw/include + /opt/include + PATH_SUFFIXES cppunit +) + +FIND_LIBRARY(SQUISH_LIBRARY + squish + PATHS + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +IF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) + SET(SQUISH_FOUND "YES") + IF(NOT SQUISH_FIND_QUIETLY) + MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARY}") + ENDIF(NOT SQUISH_FIND_QUIETLY) +ELSE(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) + IF(NOT SQUISH_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find Squish!") + ENDIF(NOT SQUISH_FIND_QUIETLY) +ENDIF(SQUISH_LIBRARY AND SQUISH_INCLUDE_DIR) + diff --git a/code/nel/CMakeModules/FindXF86VidMode.cmake b/code/nel/CMakeModules/FindXF86VidMode.cmake index c84765bdd..88fa40ad7 100644 --- a/code/nel/CMakeModules/FindXF86VidMode.cmake +++ b/code/nel/CMakeModules/FindXF86VidMode.cmake @@ -11,7 +11,7 @@ ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR) FIND_PATH(XF86VidMode_INCLUDE_DIR - xf86vm.h + xf86vmode.h PATHS $ENV{XF86VidMode_DIR}/include /usr/include/X11/ diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 21ca5b079..2396d9d62 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -56,7 +56,7 @@ using NLMISC::CSmartPtr; using NLMISC::CRGBA; using NLMISC::CVector; using NLMISC::CMatrix; -using NLMISC::CSynchronized; +using NLMISC::CUnfairSynchronized; class CMaterial; @@ -69,7 +69,7 @@ struct IOcclusionQuery; -//**************************************************************************** +// **************************************************************************** /// A Graphic Mode descriptor. struct GfxMode { @@ -94,17 +94,17 @@ struct GfxMode GfxMode(uint16 w, uint16 h, uint8 d, bool windowed = true, bool offscreen = false, uint frequency = 0, sint8 aa = -1); }; -//**************************************************************************** +// **************************************************************************** // Exceptions. struct EBadDisplay : public NLMISC::Exception { EBadDisplay(const std::string &reason) : Exception(reason) { } }; -//**************************************************************************** +// **************************************************************************** typedef void (*emptyProc)(void); -//**************************************************************************** +// **************************************************************************** // *** IMPORTANT ******************** // *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL // ********************************** @@ -144,7 +144,7 @@ public: protected: - CSynchronized _SyncTexDrvInfos; + CUnfairSynchronized _SyncTexDrvInfos; TTexDrvSharePtrList _TexDrvShares; TMatDrvInfoPtrList _MatDrvInfos; diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index e5a662d9a..1d2c2aaed 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -413,6 +413,12 @@ public: // virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable); virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager(); + + /** + * wrapper for IEventEmitter::emulateMouseRawMode() + */ + virtual void emulateMouseRawMode(bool enable); + virtual uint getDoubleClickDelay(bool hardwareMouse); /// show cursor if b is true, or hide it if b is false diff --git a/code/nel/include/nel/3d/init_3d.h b/code/nel/include/nel/3d/init_3d.h index a24dd12be..0a61f36d4 100644 --- a/code/nel/include/nel/3d/init_3d.h +++ b/code/nel/include/nel/3d/init_3d.h @@ -22,7 +22,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * Startup initialisation. * \author Cyril Corvazier diff --git a/code/nel/include/nel/3d/landscape_user.h b/code/nel/include/nel/3d/landscape_user.h index ca5fdf398..68b65c565 100644 --- a/code/nel/include/nel/3d/landscape_user.h +++ b/code/nel/include/nel/3d/landscape_user.h @@ -28,7 +28,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * ULandscape Implementation * \author Lionel Berenguier diff --git a/code/nel/include/nel/3d/particle_system.h b/code/nel/include/nel/3d/particle_system.h index e22bd20b9..4769a7365 100644 --- a/code/nel/include/nel/3d/particle_system.h +++ b/code/nel/include/nel/3d/particle_system.h @@ -75,7 +75,7 @@ public: // the pass that is applied on particles enum TPass { Anim, SolidRender, BlendRender, ToolRender }; public: - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Object //@{ @@ -98,7 +98,7 @@ public: // CParticleSystem *clone(CPSCopyHelper *ch = NULL) ; //@} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Sharing system //@{ @@ -116,7 +116,7 @@ public: bool isSharingEnabled() const { return _Sharing; } //@} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Driver setup //@{ @@ -126,7 +126,7 @@ public: /// return the driver that will be used for rendering IDriver *getDriver(void) { return _Driver; } //@} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Scene setup //@{ @@ -139,7 +139,7 @@ public: CScene *getScene() const { return _Scene; } //@} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Position of the system //@{ @@ -209,7 +209,7 @@ public: //@} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Execution of the system //@{ @@ -228,7 +228,7 @@ public: /// used for benchs. must be reset by the user static uint32 NbParticlesDrawn; - //***************************************************************************************************** + // ***************************************************************************************************** /**\name Process attachment. Most process are located : set of objects of the same type that have a position * in space @@ -287,7 +287,7 @@ public: //@} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Date / Time //@{ @@ -309,7 +309,7 @@ public: } //@} - //***************************************************************************************************** + // ***************************************************************************************************** /**\name User parameters. They may be or not used by the system. Their meaning is defined during the construction * of the system @@ -377,7 +377,7 @@ public: - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Edition methods : provides some tools for an external editor // @{ @@ -430,7 +430,7 @@ public: /// Get the name of the system. std::string getName(void) const { return _Name; } - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Transparency / opacity // @{ @@ -441,7 +441,7 @@ public: bool hasTransparentObjects(void) const; // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Lighting // @{ @@ -449,7 +449,7 @@ public: bool hasLightableObjects() const; // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Integration parameters // @{ @@ -546,7 +546,7 @@ public: // @} - //***************************************************************************************************** + // ***************************************************************************************************** /**\name LOD managment. LOD, when used can be performed in 2 ways : * - Hand tuned LOD (for emission, color, size : this uses LOD as an input for attribute makers). @@ -680,7 +680,7 @@ public: NLMISC::CRGBA getLightingColor() const { return _LightingColor; } // @} - //***************************************************************************************************** + // ***************************************************************************************************** // \name Load balancing // @{ @@ -702,7 +702,7 @@ public: void enableLoadBalancing(bool enabled = true); // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Bounding box managment // @{ @@ -741,7 +741,7 @@ public: void getLastComputedBBox(NLMISC::CAABBox &dest) { dest = _PreComputedBBox; } // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Invalidity flags (no direct effect, just indications for a third party, a model holding the system for example) // @{ @@ -929,7 +929,7 @@ public: // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name sound managment // @{ /// register a Sound server to this system. All systems share the same sound server. @@ -950,7 +950,7 @@ public: // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name external access to locatedBindable. PRIVATE PART (to avoid the use of friend) // @{ /** register a locatedBindable, and allow it to be referenced by the given ID @@ -963,7 +963,7 @@ public: void unregisterLocatedBindableExternID(CPSLocatedBindable *lb); // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name external access to locatedBindable. PUBLIC PART // @{ /// return the number the number of located bindable bound with this ID @@ -983,7 +983,7 @@ public: void getIDs(std::vector &dest) const; // @} - //***************************************************************************************************** + // ***************************************************************************************************** ///\name Misc. options / functions // @{ /** When using an emitter, it is allowed to have a period of '0'. This special value means that the emitter diff --git a/code/nel/include/nel/3d/primitive_profile.h b/code/nel/include/nel/3d/primitive_profile.h index d62cf926a..c385c150b 100644 --- a/code/nel/include/nel/3d/primitive_profile.h +++ b/code/nel/include/nel/3d/primitive_profile.h @@ -23,7 +23,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * A Primitive counter. * \author Lionel Berenguier diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h index 9f90eb32d..c25c051a5 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h @@ -107,13 +107,13 @@ inline NLMISC::CRGBA PSBinOpSubtract(NLMISC::CRGBA t1, NLMISC::CRGBA t2) ///////////////////////////////////////////////////////////////////////////// // CPSAttribMakerBinOp specializations to return the correct min/max value // ///////////////////////////////////////////////////////////////////////////// -//************************************************************************************************************* +// ************************************************************************************************************* /** template specialization implementations * They're useful to get the correct min / max values depending on the type */ -//*********************************************************************** +// *********************************************************************** template <> inline uint32 CPSAttribMakerBinOp::getMinValue(void) const { @@ -138,7 +138,7 @@ inline uint32 CPSAttribMakerBinOp::getMinValue(void) const return 0; } -//*********************************************************************** +// *********************************************************************** template <> inline uint32 CPSAttribMakerBinOp::getMaxValue(void) const { @@ -163,7 +163,7 @@ inline uint32 CPSAttribMakerBinOp::getMaxValue(void) const return 0; } -//*********************************************************************** +// *********************************************************************** template <> inline sint32 CPSAttribMakerBinOp::getMinValue(void) const { @@ -190,7 +190,7 @@ inline sint32 CPSAttribMakerBinOp::getMinValue(void) const return 0; } -//*********************************************************************** +// *********************************************************************** template <> inline sint32 CPSAttribMakerBinOp::getMaxValue(void) const { @@ -217,7 +217,7 @@ inline sint32 CPSAttribMakerBinOp::getMaxValue(void) const return 0; } -//*********************************************************************** +// *********************************************************************** template <> inline float CPSAttribMakerBinOp::getMinValue(void) const { @@ -244,7 +244,7 @@ inline float CPSAttribMakerBinOp::getMinValue(void) const return 0; } -//*********************************************************************** +// *********************************************************************** template <> inline float CPSAttribMakerBinOp::getMaxValue(void) const { diff --git a/code/nel/include/nel/3d/ps_located.h b/code/nel/include/nel/3d/ps_located.h index cc6106897..990e608b1 100644 --- a/code/nel/include/nel/3d/ps_located.h +++ b/code/nel/include/nel/3d/ps_located.h @@ -700,9 +700,9 @@ public: /////////////////////////////////////// -//****************************************************************************************** -//****************************************************************************************** -//****************************************************************************************** +// ****************************************************************************************** +// ****************************************************************************************** +// ****************************************************************************************** @@ -953,9 +953,9 @@ inline bool operator<(const CPSLocatedBindable &lhs, const CPSLocatedBindable &r -//****************************************************************************************** -//****************************************************************************************** -//****************************************************************************************** +// ****************************************************************************************** +// ****************************************************************************************** +// ****************************************************************************************** /** This class is a located bindable that can focus on several target @@ -1030,7 +1030,7 @@ protected: // INLINES // ///////////// -//***************************************************************************************************** +// ***************************************************************************************************** inline const NLMISC::CMatrix &CPSLocated::getConversionMatrix(const CPSLocated *A,const CPSLocated *B) { nlassert(A); @@ -1041,7 +1041,7 @@ inline const NLMISC::CMatrix &CPSLocated::getConversionMatrix(const CPSLocated * return getConversionMatrix(*ps, A->getMatrixMode(), B->getMatrixMode()); } -//***************************************************************************************************** +// ***************************************************************************************************** inline TAnimationTime CPSLocated::getAgeInSeconds(uint elementIndex) const { nlassert(elementIndex < _Size); @@ -1050,14 +1050,14 @@ inline TAnimationTime CPSLocated::getAgeInSeconds(uint elementIndex) const return _Time[elementIndex] * _InitialLife; } -//***************************************************************************************************** +// ***************************************************************************************************** inline void CPSLocated::computeParametricPos(float date, uint indexInLocated, NLMISC::CVector &dest) const { integrateSingle(date, 1.f, 1, indexInLocated, &dest); } -//***************************************************************************************************** +// ***************************************************************************************************** inline const NLMISC::CMatrix &CPSLocatedBindable::getLocalToWorldMatrix() const { nlassert(_Owner); diff --git a/code/nel/include/nel/3d/register_3d.h b/code/nel/include/nel/3d/register_3d.h index e4c5ecb13..eb89168d8 100644 --- a/code/nel/include/nel/3d/register_3d.h +++ b/code/nel/include/nel/3d/register_3d.h @@ -24,7 +24,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * This global function register all Serialisable Polymorphic 3D classes. * \author Lionel Berenguier diff --git a/code/nel/include/nel/3d/texture.h b/code/nel/include/nel/3d/texture.h index 2c4e80602..60222f687 100644 --- a/code/nel/include/nel/3d/texture.h +++ b/code/nel/include/nel/3d/texture.h @@ -39,7 +39,7 @@ using NLMISC::CBitmap; class IDriver; -//**************************************************************************** +// **************************************************************************** // List typedef. class ITextureDrvInfos; @@ -89,7 +89,7 @@ public: }; -//**************************************************************************** +// **************************************************************************** /** * Interface for textures * @@ -405,7 +405,7 @@ public: // get the texture category CTextureCategory *getTextureCategory() const {return _TextureCategory;} -//**************************** +// **************************** // Private part. protected: // Derived texture should set it to true when they are updated. diff --git a/code/nel/include/nel/3d/texture_cube.h b/code/nel/include/nel/3d/texture_cube.h index b87a3e10c..6d68f4202 100644 --- a/code/nel/include/nel/3d/texture_cube.h +++ b/code/nel/include/nel/3d/texture_cube.h @@ -25,7 +25,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * CTextureCube * \author Matthieu Besson diff --git a/code/nel/include/nel/3d/texture_file.h b/code/nel/include/nel/3d/texture_file.h index 62a8672bd..d4ef43e24 100644 --- a/code/nel/include/nel/3d/texture_file.h +++ b/code/nel/include/nel/3d/texture_file.h @@ -25,7 +25,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * CTextureFile * \author Stephane Coutelas diff --git a/code/nel/include/nel/3d/texture_font.h b/code/nel/include/nel/3d/texture_font.h index 934879543..d20bd516a 100644 --- a/code/nel/include/nel/3d/texture_font.h +++ b/code/nel/include/nel/3d/texture_font.h @@ -28,7 +28,7 @@ class CFontGenerator; #define TEXTUREFONT_NBCATEGORY 5 // Config 1 //#define TEXTUREFONT_NBCATEGORY 4 -//**************************************************************************** +// **************************************************************************** /** * CTextureFont */ diff --git a/code/nel/include/nel/3d/texture_mem.h b/code/nel/include/nel/3d/texture_mem.h index f392b0d45..ac31e9ea3 100644 --- a/code/nel/include/nel/3d/texture_mem.h +++ b/code/nel/include/nel/3d/texture_mem.h @@ -26,7 +26,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** /** * CTextureMem */ diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index 4e3126c4b..7641fdb2d 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -66,7 +66,7 @@ class UWaterEnvMap; typedef void (*emptyProc)(void); -//**************************************************************************** +// **************************************************************************** /// Monitor color properties struct CMonitorColorProperties { @@ -571,6 +571,11 @@ public: */ virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0; + /** + * wrapper for IEventEmitter::emulateMouseRawMode() + */ + virtual void emulateMouseRawMode(bool enable) = 0; + // get delay used for mouse double click virtual uint getDoubleClickDelay(bool hardwareMouse) = 0; diff --git a/code/nel/include/nel/3d/u_scene.h b/code/nel/include/nel/3d/u_scene.h index 0a4b62dd6..663a21fa0 100644 --- a/code/nel/include/nel/3d/u_scene.h +++ b/code/nel/include/nel/3d/u_scene.h @@ -49,7 +49,7 @@ class UPointLight; class UWaterEnvMap; -//**************************************************************************** +// **************************************************************************** // useful callback for createInstanceGroupAndAddToSceneAsync class IAsyncLoadCallback { @@ -80,7 +80,7 @@ public: }; -//**************************************************************************** +// **************************************************************************** /** * Game Interface for Scene. * A UScene create instances, camera lights etc... Those objects are not sharable through different scenes. You diff --git a/code/nel/include/nel/misc/event_emitter.h b/code/nel/include/nel/misc/event_emitter.h index 62ea5cb0c..e678c2674 100644 --- a/code/nel/include/nel/misc/event_emitter.h +++ b/code/nel/include/nel/misc/event_emitter.h @@ -49,7 +49,19 @@ public: * \param server */ virtual void submitEvents(CEventServer & server, bool allWindows) = 0; - + + /** + * Instruct the event emitter to send CGDMouseMove instead of CEventMouseMove. + * + * On windows, the mouse device can be set into RawMode. Using this mode, + * CGDMouseMove events (only containing the raw movement delta) are emitted + * instead of the normal CEventMouseMove events (containing the mouse position). + * + * On Linux and Mac OS X, there is no MouseDevice implementation, all the + * events are created by the event emitter. So the event emitter has to + * emulate the mouse raw mode. + */ + virtual void emulateMouseRawMode(bool) = 0; }; diff --git a/code/nel/include/nel/misc/historic.h b/code/nel/include/nel/misc/historic.h index 5cf215fb5..e9deeb6d4 100644 --- a/code/nel/include/nel/misc/historic.h +++ b/code/nel/include/nel/misc/historic.h @@ -61,7 +61,7 @@ private: // IMPLEMENTATION // //////////////////// -//**************************************************************************************************** +// **************************************************************************************************** template inline void CHistoric::push(const T &value) { @@ -74,7 +74,7 @@ inline void CHistoric::push(const T &value) _Historic.push_back(value); } -//**************************************************************************************************** +// **************************************************************************************************** template inline void CHistoric::pop() { @@ -82,7 +82,7 @@ inline void CHistoric::pop() _Historic.pop_back(); } -//**************************************************************************************************** +// **************************************************************************************************** template inline void CHistoric::setMaxSize(uint maxSize) { diff --git a/code/nel/include/nel/misc/inter_window_msg_queue.h b/code/nel/include/nel/misc/inter_window_msg_queue.h index c491fb394..7cc1f754f 100644 --- a/code/nel/include/nel/misc/inter_window_msg_queue.h +++ b/code/nel/include/nel/misc/inter_window_msg_queue.h @@ -31,7 +31,7 @@ namespace NLMISC { -//************************************************************************************************** +// ************************************************************************************************** /** IPC Utility class to enable easy window-window communication * * This enable 2-ways non blocking communication between 2 windows on the same machine (windows @@ -104,7 +104,7 @@ public: uint getReceiveQueueSize() const; -//************************************************************************************************** +// ************************************************************************************************** private: struct CMsg { diff --git a/code/nel/include/nel/misc/win_event_emitter.h b/code/nel/include/nel/misc/win_event_emitter.h index 9a0dd8768..0c0a611d5 100644 --- a/code/nel/include/nel/misc/win_event_emitter.h +++ b/code/nel/include/nel/misc/win_event_emitter.h @@ -99,6 +99,9 @@ public: * Return true if the message must be trapped, false if DefWindowProc must be called afterwards */ bool processMessage (HWND hWnd, uint32 msg, WPARAM wParam, LPARAM lParam, CEventServer *server=NULL); + + void emulateMouseRawMode(bool enable); + private: CWinEventServer _InternalServer; HWND _HWnd; diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index 02d8e368a..34fe8ac56 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -664,6 +664,8 @@ SOURCE_GROUP(Shadows FILES IF(NOT WIN32) ADD_LIBRARY(nel3d SHARED ${SRC}) + CONFIGURE_FILE(nel-3d.pc.in nel-3d.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-3d.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nel3d STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/3d/debug_vb.cpp b/code/nel/src/3d/debug_vb.cpp index a0fc94561..32799ec79 100644 --- a/code/nel/src/3d/debug_vb.cpp +++ b/code/nel/src/3d/debug_vb.cpp @@ -31,7 +31,7 @@ static void checkRange(const uint8 *min, const uint8 *max, const uint8 *start, u } } -//************************************************************************************ +// ************************************************************************************ void nlCheckVertexBuffer(const CVertexBuffer &vb, const uint8 *ptr) { CVertexBufferRead vba; @@ -39,49 +39,49 @@ void nlCheckVertexBuffer(const CVertexBuffer &vb, const uint8 *ptr) checkRange((uint8 *) vba.getVertexCoordPointer(), (uint8 *) vba.getVertexCoordPointer() + vb.getNumVertices() * vb.getVertexSize(), ptr, 0, vb.getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckVBA(CVertexBufferRead &vba, const uint8 *ptr) { checkRange((uint8 *) vba.getVertexCoordPointer(), (uint8 *) vba.getVertexCoordPointer() + vba.getParent()->getNumVertices() * vba.getParent()->getVertexSize(), ptr, 0, vba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckVBA(CVertexBufferReadWrite &vba, const uint8 *ptr) { checkRange((uint8 *) vba.getVertexCoordPointer(), (uint8 *) vba.getVertexCoordPointer() + vba.getParent()->getNumVertices() * vba.getParent()->getVertexSize(), ptr, 0, vba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckVBARange(CVertexBufferRead &vba, const uint8 *ptStart, uint length) { checkRange((uint8 *) vba.getVertexCoordPointer(), (uint8 *) vba.getVertexCoordPointer() + vba.getParent()->getNumVertices() * vba.getParent()->getVertexSize(), ptStart, length, vba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckVBARange(CVertexBufferReadWrite &vba, const uint8 *ptStart, uint length) { checkRange((uint8 *) vba.getVertexCoordPointer(), (uint8 *) vba.getVertexCoordPointer() + vba.getParent()->getNumVertices() * vba.getParent()->getVertexSize(), ptStart, length, vba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckIBARange(CIndexBufferReadWrite &iba, const uint8 *ptStart, uint length) { checkRange((uint8 *) iba.getPtr(), (uint8 *) iba.getPtr() + iba.getParent()->getNumIndexes() * iba.getIndexNumBytes(), ptStart, length, iba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckIBARange(CIndexBufferRead &iba, const uint8 *ptStart, uint length) { checkRange((uint8 *) iba.getPtr(), (uint8 *) iba.getPtr() + iba.getParent()->getNumIndexes() * iba.getIndexNumBytes(), ptStart, length, iba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckIBA(CIndexBufferReadWrite &iba, const uint8 *ptStart) { checkRange((uint8 *) iba.getPtr(), (uint8 *) iba.getPtr() + iba.getParent()->getNumIndexes() * iba.getIndexNumBytes(), ptStart, 0, iba.getParent()->getName()); } -//************************************************************************************ +// ************************************************************************************ void nlCheckIBA(CIndexBufferRead &iba, const uint8 *ptStart) { checkRange((uint8 *) iba.getPtr(), (uint8 *) iba.getPtr() + iba.getParent()->getNumIndexes() * iba.getIndexNumBytes(), ptStart, 0, iba.getParent()->getName()); diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index af6ad6c07..b00c44388 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -34,7 +34,7 @@ namespace NL3D { // *************************************************************************** -const uint32 IDriver::InterfaceVersion = 0x65; // Added nlWindow patch. +const uint32 IDriver::InterfaceVersion = 0x66; // added IEventEmitter::emulateMouseRawMode(bool) // *************************************************************************** IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" ) @@ -50,7 +50,7 @@ IDriver::~IDriver() // Must clean up everything before closing driver. // Must doing this in release(), so assert here if not done... { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); nlassert( rTexDrvInfos.size() == 0 ); } @@ -81,7 +81,7 @@ bool IDriver::release(void) // Release refptr of TextureDrvInfos. Should be all null (because of precedent pass). { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); // must be empty, because precedent pass should have deleted all. @@ -234,7 +234,7 @@ void IDriver::removeIBDrvInfoPtr(ItIBDrvInfoPtrList ibDrvInfoIt) // *************************************************************************** void IDriver::removeTextureDrvInfoPtr(ItTexDrvInfoPtrMap texDrvInfoIt) { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); rTexDrvInfos.erase(texDrvInfoIt); @@ -268,7 +268,7 @@ bool IDriver::invalidateShareTexture (ITexture &texture) getTextureShareName (texture, name); // Look for the driver info for this share name - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); TTexDrvInfoPtrMap::iterator iteDrvInfo = rTexDrvInfos.find (name); if (iteDrvInfo != rTexDrvInfos.end()) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 0c10a3eb8..0eed232ca 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -549,7 +549,7 @@ bool CDriverD3D::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded // insert or get the texture. { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); ItTexDrvInfoPtrMap itTex; @@ -1013,7 +1013,7 @@ bool CDriverD3D::isTextureExist(const ITexture&tex) getTextureShareName (tex, name); { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); result = (rTexDrvInfos.find(name) != rTexDrvInfos.end()); } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 2b486c2fd..c5a807eac 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -136,92 +136,6 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion () #endif -static bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - H_AUTO_OGL(GlWndProc) - if(message == WM_SIZE) - { - if (driver != NULL) - { - RECT rect; - GetClientRect (driver->_hWnd, &rect); - - // Setup gl viewport - driver->_WindowWidth = rect.right-rect.left; - driver->_WindowHeight = rect.bottom-rect.top; - } - } - else if(message == WM_MOVE) - { - if (driver != NULL) - { - RECT rect; - GetWindowRect (hWnd, &rect); - driver->_WindowX = rect.left; - driver->_WindowY = rect.top; - } - } - else if (message == WM_ACTIVATE) - { - WORD fActive = LOWORD(wParam); - if (fActive == WA_INACTIVE) - { - driver->_WndActive = false; - } - else - { - driver->_WndActive = true; - } - } - - bool trapMessage = false; - if (driver->_EventEmitter.getNumEmitters() > 0) - { - CWinEventEmitter *we = NLMISC::safe_cast(driver->_EventEmitter.getEmitter(0)); - // Process the message by the emitter - we->setHWnd(hWnd); - trapMessage = we->processMessage (hWnd, message, wParam, lParam); - } - return trapMessage; -} - -static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - H_AUTO_OGL(DriverGL_WndProc) - // Get the driver pointer.. - CDriverGL *pDriver=(CDriverGL*)GetWindowLongPtr (hWnd, GWLP_USERDATA); - bool trapMessage = false; - if (pDriver != NULL) - { - trapMessage = GlWndProc (pDriver, hWnd, message, wParam, lParam); - } - -#ifdef NL_DISABLE_MENU - // disable menu (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) - if(message == WM_SYSCOMMAND && wParam == SC_KEYMENU) - return 0; -#endif // NL_DISABLE_MENU - - // disable menu (default ALT-F4 behavior is disabled) - if(message == WM_CLOSE) - { - if(pDriver && pDriver->ExitFunc) - { - pDriver->ExitFunc(); - } - else - { -#ifndef NL_DISABLE_MENU - // if we don't disable menu, alt F4 make a direct exit else we discard the message - exit(0); -#endif // NL_DISABLE_MENU - } - return 0; - } - - return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam); -} - #elif defined (NL_OS_UNIX) #ifdef NL_STATIC @@ -264,7 +178,6 @@ static Bool WndProc(Display *d, XEvent *e, char *arg) */ #endif // NL_OS_UNIX - GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, @@ -279,9 +192,9 @@ GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] = CDriverGL::CDriverGL() { H_AUTO_OGL(CDriverGL_CDriverGL) - _OffScreen = false; #ifdef NL_OS_WINDOWS + _PBuffer = NULL; _hWnd = NULL; _hRC = NULL; @@ -290,10 +203,13 @@ CDriverGL::CDriverGL() _Interval = 1; #elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + NL3D::MAC::ctor(); #elif defined (NL_OS_UNIX) cursor = None; + win = 0; + dpy = 0; # ifdef XF86VIDMODE // zero the old screen mode @@ -302,7 +218,8 @@ CDriverGL::CDriverGL() # endif //XF86VIDMODE #endif // NL_OS_UNIX - _FullScreen= false; + _OffScreen = false; + _FullScreen = false; _CurrentMaterial=NULL; _Initialized = false; @@ -347,7 +264,6 @@ CDriverGL::CDriverGL() _NVTextureShaderEnabled = false; - // Compute the Flag which say if one texture has been changed in CMaterial. _MaterialAllTextureTouchedFlag= 0; for(i=0; i < IDRV_MAT_MAXTEXTURES; i++) @@ -356,7 +272,6 @@ CDriverGL::CDriverGL() _CurrentTexAddrMode[i] = GL_NONE; } - _UserTexMatEnabled = 0; // Ligtmap preca. @@ -415,7 +330,6 @@ CDriverGL::CDriverGL() _TextureTargetUpload = false; } - // *************************************************************************** CDriverGL::~CDriverGL() { @@ -427,72 +341,6 @@ CDriverGL::~CDriverGL() #endif } -// *************************************************************************** -bool CDriverGL::init (uint windowIcon, emptyProc exitFunc) -{ - H_AUTO_OGL(CDriverGL_init) - - ExitFunc = exitFunc; - -#ifdef NL_OS_WINDOWS - WNDCLASSW wc; - - if (!_Registered) - { - memset(&wc,0,sizeof(wc)); - wc.style = CS_HREDRAW | CS_VREDRAW ;//| CS_DBLCLKS; - wc.lpfnWndProc = (WNDPROC)WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = GetModuleHandle(NULL); - wc.hIcon = (HICON)windowIcon; - wc.hCursor = LoadCursorW(NULL,(LPCWSTR)IDC_ARROW); - wc.hbrBackground = WHITE_BRUSH; - wc.lpszClassName = L"NLClass"; - wc.lpszMenuName = NULL; - if ( !RegisterClassW(&wc) ) - { - return false; - } - _Registered=1; - } - - // Backup monitor color parameters - HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); - if (dc) - { - _NeedToRestaureGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE; - - // Release the DC - ReleaseDC (NULL, dc); - } - else - { - nlwarning ("(CDriverGL::init): can't create DC"); - } - - // ati specific : try to retrieve driver version - retrieveATIDriverVersion(); -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) - - return NL3D::MAC::init(windowIcon, exitFunc); - -#elif defined (NL_OS_UNIX) - - dpy = XOpenDisplay(NULL); - if (dpy == NULL) - { - nlerror ("XOpenDisplay failed on '%s'", getenv("DISPLAY")); - } - else - { - nldebug("3D: XOpenDisplay on '%s' OK", getenv("DISPLAY")); - } - -#endif - return true; -} - // *************************************************************************** bool CDriverGL::stretchRect(ITexture * /* srcText */, NLMISC::CRect &/* srcRect */, ITexture * /* destText */, NLMISC::CRect &/* destRect */) { @@ -502,21 +350,18 @@ bool CDriverGL::stretchRect(ITexture * /* srcText */, NLMISC::CRect &/* srcRect } // *************************************************************************** - bool CDriverGL::supportBloomEffect() const { return (isVertexProgramSupported() && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle()); } // *************************************************************************** - bool CDriverGL::supportNonPowerOfTwoTextures() const { return _Extensions.ARBTextureNonPowerOfTwo; } // *************************************************************************** - bool CDriverGL::isTextureRectangle(ITexture * tex) const { return (supportTextureRectangle() && tex->isBloomTexture() && tex->mipMapOff() @@ -524,7 +369,6 @@ bool CDriverGL::isTextureRectangle(ITexture * tex) const } // *************************************************************************** - bool CDriverGL::activeFrameBufferObject(ITexture * tex) { if(supportFrameBufferObject()/* && supportPackedDepthStencil()*/) @@ -545,7 +389,6 @@ bool CDriverGL::activeFrameBufferObject(ITexture * tex) } // -------------------------------------------------- - void CDriverGL::disableHardwareVertexProgram() { H_AUTO_OGL(CDriverGL_disableHardwareVertexProgram) @@ -565,620 +408,9 @@ void CDriverGL::disableHardwareTextureShader() } // -------------------------------------------------- - -bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool resizeable) throw(EBadDisplay) +bool CDriverGL::setupDisplay() { - H_AUTO_OGL(CDriverGL_setDisplay) - - uint width = mode.Width; - uint height = mode.Height; - -#ifdef NL_OS_WINDOWS - - // Driver caps. - //============= - // Retrieve the WGL extensions before init the driver. - int pf; - - _OffScreen = mode.OffScreen; - - // Init pointers - _PBuffer = NULL; - _hWnd = NULL; - _WindowWidth = _WindowHeight = _WindowX = _WindowY = 0; - _hRC = NULL; - _hDC = NULL; - - // Offscreen mode ? - if (_OffScreen) - { - // Get a hdc - - ULONG WndFlags=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; - WndFlags&=~WS_VISIBLE; - RECT WndRect; - WndRect.left=0; - WndRect.top=0; - WndRect.right=width; - WndRect.bottom=height; - AdjustWindowRect(&WndRect,WndFlags,FALSE); - HWND tmpHWND = CreateWindowW(L"NLClass", - L"", - WndFlags, - CW_USEDEFAULT,CW_USEDEFAULT, - WndRect.right,WndRect.bottom, - NULL, - NULL, - GetModuleHandleW(NULL), - NULL); - if (!tmpHWND) - { - nlwarning ("CDriverGL::setDisplay: CreateWindowW failed"); - return false; - } - - // resize the window - RECT rc; - SetRect (&rc, 0, 0, width, height); - _WindowWidth = width; - _WindowHeight = height; - AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), GetMenu (_hWnd) != NULL, GetWindowExStyle (_hWnd)); - SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); - - // Get the - HDC tempHDC = GetDC(tmpHWND); - - _Depth=uint8(GetDeviceCaps(tempHDC,BITSPIXEL)); - - // --- - memset(&_pfd,0,sizeof(_pfd)); - _pfd.nSize = sizeof(_pfd); - _pfd.nVersion = 1; - _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - _pfd.iPixelType = PFD_TYPE_RGBA; - _pfd.cColorBits = (char)_Depth; - - // Choose best suited Depth Buffer. - if(_Depth<=16) - { - _pfd.cDepthBits = 16; - } - else - { - _pfd.cDepthBits = 24; - _pfd.cAlphaBits = 8; - } - _pfd.iLayerType = PFD_MAIN_PLANE; - pf=ChoosePixelFormat(tempHDC,&_pfd); - if (!pf) - { - nlwarning ("CDriverGL::setDisplay: ChoosePixelFormat failed"); - DestroyWindow (tmpHWND); - return false; - } - if ( !SetPixelFormat(tempHDC,pf,&_pfd) ) - { - nlwarning ("CDriverGL::setDisplay: SetPixelFormat failed"); - DestroyWindow (tmpHWND); - return false; - } - - // Create gl context - HGLRC tempGLRC = wglCreateContext(tempHDC); - if (tempGLRC == NULL) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglCreateContext failed: 0x%x", error); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - - - // Make the context current - if (!wglMakeCurrent(tempHDC,tempGLRC)) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x", error); - wglDeleteContext (tempGLRC); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - // Register WGL functions - registerWGlExtensions (_Extensions, tempHDC); - - HDC hdc = wglGetCurrentDC (); - - if (hdc == NULL) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglGetCurrentDC failed: 0x%x", error); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - // Get ready to query for a suitable pixel format that meets our - // minimum requirements. - int iattributes[2*20]; - float fattributes[2*20]; - int niattribs = 0; - - // Attribute arrays must be "0" terminated - for simplicity, first - // just zero-out the array then fill from left to right. - for ( int a = 0; a < 2*20; a++ ) - { - iattributes[a] = 0; - fattributes[a] = 0; - } - - // Since we are trying to create a pbuffer, the pixel format we - // request (and subsequently use) must be "buffer capable". - iattributes[2*niattribs ] = WGL_DRAW_TO_PBUFFER_ARB; - iattributes[2*niattribs+1] = true; - niattribs++; - - // We require a minimum of 24-bit depth. - iattributes[2*niattribs ] = WGL_DEPTH_BITS_ARB; - iattributes[2*niattribs+1] = 24; - niattribs++; - - // We require a minimum of 8-bits for each R, G, B, and A. - iattributes[2*niattribs ] = WGL_RED_BITS_ARB; - iattributes[2*niattribs+1] = 8; - niattribs++; - iattributes[2*niattribs ] = WGL_GREEN_BITS_ARB; - iattributes[2*niattribs+1] = 8; - niattribs++; - iattributes[2*niattribs ] = WGL_BLUE_BITS_ARB; - iattributes[2*niattribs+1] = 8; - niattribs++; - iattributes[2*niattribs ] = WGL_ALPHA_BITS_ARB; - iattributes[2*niattribs+1] = 8; - niattribs++; - - // Now obtain a list of pixel formats that meet these minimum - // requirements. - int pformat[20]; - unsigned int nformats; - if ( !nwglChoosePixelFormatARB ( hdc, iattributes, fattributes, - 20, pformat, &nformats ) ) - { - nlwarning ( "pbuffer creation error: Couldn't find a suitable pixel format." ); - wglDeleteContext (tempGLRC); - DestroyWindow (tmpHWND); - return false; - } - - /* After determining a compatible pixel format, the next step is to create a pbuffer of the - chosen format. Fortunately this step is fairly easy, as you merely select one of the formats - returned in the list in step #2 and call the function: */ - int iattributes2[1] = {0}; - // int iattributes2[] = {WGL_PBUFFER_LARGEST_ARB, 1, 0}; - _PBuffer = nwglCreatePbufferARB( hdc, pformat[0], width, height, iattributes2 ); - if (_PBuffer == NULL) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglCreatePbufferARB failed: 0x%x", error); - wglDeleteContext (tempGLRC); - - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - /* After creating a pbuffer, you may use this functions to determine the dimensions of the pbuffer actually created. */ - if ( !nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width ) ) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglQueryPbufferARB failed: 0x%x", error); - wglDeleteContext (tempGLRC); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - if ( !nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height ) ) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglQueryPbufferARB failed: 0x%x", error); - wglDeleteContext (tempGLRC); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - _WindowWidth = width; - _WindowHeight = height; - - /* The next step is to create a device context for the newly created pbuffer. To do this, - call the the function: */ - _hDC = nwglGetPbufferDCARB( _PBuffer ); - if (_hDC == NULL) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglGetPbufferDCARB failed: 0x%x", error); - nwglDestroyPbufferARB( _PBuffer ); - - wglDeleteContext (tempGLRC); - - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - - /* The final step of pbuffer creation is to create an OpenGL rendering context and - associate it with the handle for the pbuffer's device context created in step #4. This is done as follows */ - _hRC = wglCreateContext( _hDC ); - if (_hRC == NULL) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglCreateContext failed: 0x%x", error); - nwglReleasePbufferDCARB( _PBuffer, _hDC ); - nwglDestroyPbufferARB( _PBuffer ); - wglDeleteContext (tempGLRC); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - - // Get the depth - _Depth = uint8(GetDeviceCaps (_hDC, BITSPIXEL)); - - // Destroy the temp gl context - if (!wglDeleteContext (tempGLRC)) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglDeleteContext failed: 0x%x", error); - } - - // Destroy the temp windows - if (!DestroyWindow (tmpHWND)) - nlwarning ("CDriverGL::setDisplay: DestroyWindow failed"); - - /* After a pbuffer has been successfully created you can use it for off-screen rendering. To do - so, you'll first need to bind the pbuffer, or more precisely, make its GL rendering context - the current context that will interpret all OpenGL commands and state changes. */ - if (!wglMakeCurrent(_hDC,_hRC)) - { - DWORD error = GetLastError (); - nlwarning ("CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x", error); - wglDeleteContext (_hRC); - nwglReleasePbufferDCARB( _PBuffer, _hDC ); - nwglDestroyPbufferARB( _PBuffer ); - DestroyWindow (tmpHWND); - _PBuffer = NULL; - _hWnd = NULL; - _hRC = NULL; - _hDC = NULL; - return false; - } - } - else - { - _FullScreen= false; - if (wnd) - { - _hWnd=wnd; - _DestroyWindow=false; - } - else - { - ULONG WndFlags; - RECT WndRect; - - // Must destroy this window - _DestroyWindow=true; - - if(mode.Windowed) - if(resizeable) - WndFlags=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; - else - WndFlags=WS_SYSMENU+WS_DLGFRAME+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; - else - { - WndFlags=WS_POPUP; - - _FullScreen= true; - DEVMODE devMode; - _OldScreenMode.dmSize= sizeof(DEVMODE); - _OldScreenMode.dmDriverExtra= 0; - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &_OldScreenMode); - _OldScreenMode.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY ; - - devMode.dmSize= sizeof(DEVMODE); - devMode.dmDriverExtra= 0; - devMode.dmFields= DM_PELSWIDTH | DM_PELSHEIGHT; - devMode.dmPelsWidth= width; - devMode.dmPelsHeight= height; - - if(mode.Depth > 0) - { - devMode.dmBitsPerPel= mode.Depth; - devMode.dmFields |= DM_BITSPERPEL; - } - - if(mode.Frequency > 0) - { - devMode.dmDisplayFrequency= mode.Frequency; - devMode.dmFields |= DM_DISPLAYFREQUENCY; - } - - if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) - return false; - } - WndRect.left=0; - WndRect.top=0; - WndRect.right=width; - WndRect.bottom=height; - AdjustWindowRect(&WndRect,WndFlags,FALSE); - _hWnd = CreateWindowW( L"NLClass", - L"", - WndFlags, - CW_USEDEFAULT,CW_USEDEFAULT, - WndRect.right,WndRect.bottom, - NULL, - NULL, - GetModuleHandleW(NULL), - NULL); - if (_hWnd == NULL) - { - DWORD res = GetLastError(); - nlwarning("CreateWindow failed: %u", res); - return false; - } - - SetWindowLongPtr (_hWnd, GWLP_USERDATA, (LONG_PTR)this); - - // resize the window - RECT rc; - SetRect (&rc, 0, 0, width, height); - AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), GetMenu (_hWnd) != NULL, GetWindowExStyle (_hWnd)); - UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; - if (mode.Windowed) - flags |= SWP_NOMOVE; - SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, flags); - - if (show || _FullScreen) - showWindow(true); - } - - // Init Window Width and Height - RECT clientRect; - GetClientRect (_hWnd, &clientRect); - _WindowWidth = clientRect.right-clientRect.left; - _WindowHeight = clientRect.bottom-clientRect.top; - GetWindowRect (_hWnd, &clientRect); - _WindowX = clientRect.left; - _WindowY = clientRect.top; - - _hDC=GetDC(_hWnd); - wglMakeCurrent(_hDC,NULL); - - _Depth=uint8(GetDeviceCaps(_hDC,BITSPIXEL)); - // --- - memset(&_pfd,0,sizeof(_pfd)); - _pfd.nSize = sizeof(_pfd); - _pfd.nVersion = 1; - _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - _pfd.iPixelType = PFD_TYPE_RGBA; - _pfd.cColorBits = (char)_Depth; - // Choose best suited Depth Buffer. - if(_Depth<=16) - { - _pfd.cDepthBits = 16; - } - else - { - _pfd.cDepthBits = 24; - _pfd.cAlphaBits = 8; - _pfd.cStencilBits = 8; - } - _pfd.iLayerType = PFD_MAIN_PLANE; - pf=ChoosePixelFormat(_hDC,&_pfd); - if (!pf) - { - return false; - } - - if ( !SetPixelFormat(_hDC,pf,&_pfd) ) - { - return false; - } - _hRC=wglCreateContext(_hDC); - - wglMakeCurrent(_hDC,_hRC); - - } - - /// release old emitter - while (_EventEmitter.getNumEmitters() != 0) - { - _EventEmitter.removeEmitter(_EventEmitter.getEmitter(_EventEmitter.getNumEmitters() - 1)); - } - NLMISC::CWinEventEmitter *we = new NLMISC::CWinEventEmitter; - // setup the event emitter, and try to retrieve a direct input interface - _EventEmitter.addEmitter(we, true /*must delete*/); // the main emitter - /// try to get direct input - try - { - NLMISC::CDIEventEmitter *diee = NLMISC::CDIEventEmitter::create(GetModuleHandle(NULL), _hWnd, we); - if (diee) - { - _EventEmitter.addEmitter(diee, true); - } - } - catch(EDirectInput &e) - { - nlinfo(e.what()); - } - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) - - NL3D::MAC::setDisplay(wnd, mode, show, resizeable); - -#elif defined (NL_OS_UNIX) - - static int sAttribList16bpp[] = - { - GLX_RGBA, - GLX_DOUBLEBUFFER, - //GLX_BUFFER_SIZE, 16, - GLX_DEPTH_SIZE, 16, - GLX_RED_SIZE, 4, - GLX_GREEN_SIZE, 4, - GLX_BLUE_SIZE, 4, - GLX_STENCIL_SIZE, 8, - None - }; - - static int sAttribList24bpp[] = - { - GLX_RGBA, - GLX_DOUBLEBUFFER, - //GLX_BUFFER_SIZE, 16, - GLX_DEPTH_SIZE, 24, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_STENCIL_SIZE, 8, - None - }; - - static int sAttribList32bpp[] = - { - GLX_RGBA, - GLX_DOUBLEBUFFER, - //GLX_BUFFER_SIZE, 32, - GLX_DEPTH_SIZE, 32, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_STENCIL_SIZE, 8, - None - }; - - // first try 32bpp and if that fails 24bpp or 16bpp - XVisualInfo *visual_info = glXChooseVisual (dpy, DefaultScreen(dpy), sAttribList32bpp); - if (visual_info == NULL) - visual_info = glXChooseVisual(dpy, DefaultScreen(dpy), sAttribList24bpp); - if (visual_info == NULL) - visual_info = glXChooseVisual(dpy, DefaultScreen(dpy), sAttribList16bpp); - if(visual_info == NULL) - { - nlerror("glXChooseVisual() failed"); - } - else - { - nldebug("3D: glXChooseVisual OK"); - } - - ctx = glXCreateContext (dpy, visual_info, None, GL_TRUE); - if(ctx == NULL) - { - nlerror("glXCreateContext() failed"); - } - else - { - nldebug("3D: glXCreateContext() OK"); - } - - XSetWindowAttributes attr; - attr.background_pixel = BlackPixel(dpy, DefaultScreen(dpy)); - attr.override_redirect = False; - - int attr_flags = CWOverrideRedirect | CWBackPixel; - - if(wnd == EmptyWindow) - { - nlWindow root = RootWindow(dpy, DefaultScreen(dpy)); - - attr.colormap = XCreateColormap(dpy, root, visual_info->visual, AllocNone); - attr_flags |= CWColormap; - - win = XCreateWindow (dpy, root, 0, 0, width, height, 0, visual_info->depth, InputOutput, visual_info->visual, attr_flags, &attr); - - if (win == EmptyWindow) - { - nlerror("3D: XCreateWindow() failed"); - } - else - { - nldebug("3D: XCreateWindow() OK"); - } - } - else - { - win = wnd; - XChangeWindowAttributes(dpy, win, attr_flags, &attr); - } - - const char *title="NeL window"; - - XSizeHints size_hints; - size_hints.x = 0; - size_hints.y = 0; - size_hints.width = width; - size_hints.height = height; - size_hints.flags = PSize | PMinSize | PMaxSize; - size_hints.min_width = width; - size_hints.min_height = height; - size_hints.max_width = width; - size_hints.max_height = height; - -#ifdef X_HAVE_UTF8_STRING - Xutf8SetWMProperties (dpy, win, (char*)title, (char*)title, NULL, 0, &size_hints, NULL, NULL); -#else - XTextProperty text_property; - XStringListToTextProperty((char**)&title, 1, &text_property); - XSetWMProperties (dpy, win, &text_property, &text_property, 0, 0, &size_hints, 0, 0); -#endif - - glXMakeCurrent (dpy, win, ctx); - XMapRaised (dpy, win); - - XSelectInput (dpy, win, KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask); - - XMapWindow(dpy, win); - - _EventEmitter.init (dpy, win); - -// XEvent event; -// XIfEvent(dpy, &event, WaitForNotify, (char *)this); - - setMode(mode); - -#endif // NL_OS_UNIX - + H_AUTO_OGL(CDriverGL_setupDisplay) // Driver caps. //============= @@ -1206,7 +438,6 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re nlwarning("Missing Important GL extension: GL_EXT_texture_env_combine => All envcombine are setup to GL_MODULATE!!!"); } - // Get num of light for this driver int numLight; glGetIntegerv (GL_MAX_LIGHTS, &numLight); @@ -1222,13 +453,12 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re // init _DriverGLStates _DriverGLStates.init(_Extensions.ARBTextureCubeMap, (_Extensions.NVTextureRectangle || _Extensions.EXTTextureRectangle || _Extensions.ARBTextureRectangle), _MaxDriverLight); - // Init OpenGL/Driver defaults. //============================= - glViewport(0,0,width,height); + glViewport(0,0,_WindowWidth,_WindowHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0,width,height,0,-1.0f,1.0f); + glOrtho(0,_WindowWidth,_WindowHeight,0,-1.0f,1.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_AUTO_NORMAL); @@ -1264,7 +494,6 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re _VertexProgramEnabled= false; _LastSetupGLArrayVertexProgram= false; - // Init VertexArrayRange according to supported extenstion. _SupportVBHard= false; _SlowUnlockVBHard= false; @@ -1313,7 +542,8 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re _CurrentVertexBufferHard= NULL; _NVCurrentVARPtr= NULL; _NVCurrentVARSize= 0; - if(_SupportVBHard) + + if (_SupportVBHard) { // try to allocate 16Mo by default of AGP Ram. initVertexBufferHard(NL3D_DRV_VERTEXARRAY_AGP_INIT_SIZE, 0); @@ -1345,8 +575,6 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re //=========================================================== initFragmentShaders(); - - // Activate the default texture environnments for all stages. //=========================================================== for(uint stage=0;stage 0) - { - newDevMode.dmBitsPerPel= mode.Depth; - newDevMode.dmFields |= DM_BITSPERPEL; - } - - if(mode.Frequency > 0) - { - newDevMode.dmDisplayFrequency= mode.Frequency; - newDevMode.dmFields |= DM_DISPLAYFREQUENCY; - } - - // try to really change the display mode - if (ChangeDisplaySettings(&newDevMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) - return false; - - // mode ok => copy changes - _WindowWidth = mode.Width; - _WindowHeight = mode.Height; - _Depth= mode.Depth; - // bkup user mode - if (!_FullScreen) - _OldScreenMode= oldDevMode; - - // if old mode was not fullscreen - if (!_FullScreen) - { - // Under the XP theme desktop, this function call the winproc WM_SIZE and change _WindowWidth and _WindowHeight - sint32 windowWidth = _WindowWidth; - sint32 windowHeight = _WindowHeight; - modifyStyle(_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS, WS_POPUP); - _WindowWidth = windowWidth; - _WindowHeight = windowHeight; - } - } - - // Resize the window - RECT rc; - SetRect (&rc, 0, 0, _WindowWidth, _WindowHeight); - AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), false, GetWindowExStyle (_hWnd)); - UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; - if (mode.Windowed) - flags |= SWP_NOMOVE; - SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, flags); - - showWindow(true); - - // Init Window Width and Height - RECT clientRect; - GetClientRect (_hWnd, &clientRect); - _WindowWidth = clientRect.right-clientRect.left; - _WindowHeight = clientRect.bottom-clientRect.top; - GetWindowRect (_hWnd, &clientRect); - _WindowX = clientRect.left; - _WindowY = clientRect.top; - _FullScreen = !mode.Windowed; - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); -#elif defined(NL_OS_UNIX) - -#ifdef XF86VIDMODE - if (!mode.Windowed) - { - // Store old mdoe in order to restore it when leaving fullscreen - if (mode.Windowed == _FullScreen) - { - memset(&_OldScreenMode, 0, sizeof(_OldScreenMode)); - XF86VidModeGetModeLine(dpy, DefaultScreen(dpy), &_OldDotClock, &_OldScreenMode); - XF86VidModeGetViewPort(dpy, DefaultScreen(dpy), &_OldX, &_OldY); - } - - // Find the requested mode and use it - XF86VidModeModeInfo **modes; - int nmodes; - if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &nmodes, &modes)) - { - for (int i = 0; i < nmodes; i++) - { - nldebug("3D: Available mode - %dx%d", modes[i]->hdisplay, modes[i]->vdisplay); - if(modes[i]->hdisplay == mode.Width && modes[i]->vdisplay == mode.Height) - { - if(XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), modes[i])) - { - nlinfo("3D: Switching to mode %dx%d", modes[i]->hdisplay, modes[i]->vdisplay); - XF86VidModeSetViewPort(dpy, DefaultScreen(dpy), 0, 0); - } - break; - } - } - } - } - else if (mode.Windowed == _FullScreen) - switchBackToOldMode(); -#endif // XF86VIDMODE - - // Update WM hints (update size and disallow resizing) - XSizeHints size_hints; - size_hints.x = 0; - size_hints.y = 0; - size_hints.width = mode.Width; - size_hints.height = mode.Height; - size_hints.flags = PSize; - if (!mode.Windowed) - { - size_hints.flags = PSize | PMinSize | PMaxSize; - size_hints.min_width = mode.Width; - size_hints.min_height = mode.Height; - size_hints.max_width = mode.Width; - size_hints.max_height = mode.Height; - } - - XSetWMNormalHints(dpy, win, &size_hints); - - // Toggle fullscreen - if (mode.Windowed == _FullScreen) - { - XEvent xev; - memset(&xev, 0, sizeof(xev)); - xev.type = ClientMessage; - xev.xclient.window = win; - xev.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", false); - xev.xclient.format = 32; - xev.xclient.data.l[0] = !mode.Windowed; - xev.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", false); - xev.xclient.data.l[2] = 0; - XSendEvent(dpy, DefaultRootWindow(dpy), false, SubstructureNotifyMask, &xev); - } - _FullScreen = !mode.Windowed; - - // Resize and update the window - XResizeWindow(dpy, win, mode.Width, mode.Height); - XMapWindow(dpy, win); - -#endif // NL_OS_UNIX - return true; -} - -// -------------------------------------------------- -bool CDriverGL::getModes(std::vector &modes) -{ - H_AUTO_OGL(CDriverGL_getModes) -#ifdef NL_OS_WINDOWS - sint modeIndex = 0; - DEVMODE devMode; - while (EnumDisplaySettings (NULL, modeIndex, &devMode)) - { - // Keep only 16 and 32 bits - if ((devMode.dmBitsPerPel == 16 ) || (devMode.dmBitsPerPel == 32)) - { - // Add this mode - GfxMode mode; - mode.Width = (uint16)devMode.dmPelsWidth; - mode.Height = (uint16)devMode.dmPelsHeight; - mode.Depth = (uint8)devMode.dmBitsPerPel; - mode.Frequency = devMode.dmDisplayFrequency; - modes.push_back (mode); - } - - // Mode index - modeIndex++; - } -#elif defined(NL_OS_MAC) - getMacModes(modes); -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - -# ifdef XF86VIDMODE - int nmodes; - XF86VidModeModeInfo **ms; - Bool ok = XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &nmodes, &ms); - if(ok) - { - nldebug("3D: %d available modes:", nmodes); - for (int j = 0; j < nmodes; j++) - { - // Add this mode - GfxMode mode; - mode.Width = (uint16)ms[j]->hdisplay; - mode.Height = (uint16)ms[j]->vdisplay; - mode.Frequency = 1000 * ms[j]->dotclock / (ms[j]->htotal * ms[j]->vtotal); - nldebug("3D: Mode %d: %dx%d, %d Hz", j, ms[j]->hdisplay,ms[j]->vdisplay, 1000 * ms[j]->dotclock / (ms[j]->htotal * ms[j]->vtotal)); - modes.push_back (mode); - } - XFree(ms); - } - else - { - nlwarning("XF86VidModeGetAllModeLines returns 0, cannot get available video mode"); - return false; - } -# endif - -#endif - return true; -} - -// -------------------------------------------------- -bool CDriverGL::getCurrentScreenMode(GfxMode &mode) -{ - H_AUTO_OGL(CDriverGL_getCurrentScreenMode) -#ifdef NL_OS_WINDOWS - DEVMODE devmode; - devmode.dmSize= sizeof(DEVMODE); - devmode.dmDriverExtra= 0; - EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode); - - mode.Windowed= !_FullScreen; - mode.OffScreen= false; - mode.Depth= (uint8)devmode.dmBitsPerPel; - mode.Frequency= devmode.dmDisplayFrequency, - mode.Width= (uint16)devmode.dmPelsWidth; - mode.Height= (uint16)devmode.dmPelsHeight; - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Temporary Mac Implementation" - nlwarning("OpenGL Driver: Temporary Mac Implementation"); - mode.Depth = 24; - -#elif defined(NL_OS_MAC) - /* - TODO this is just a hack to get the ryzom client running on mac os x x11. - the implementation below relies on the vidmode extension which is not - availeble on mac os x's x11. for that reason the color depth value is - hard coded here. - FIXME replace this hack by native cocoa color depth retrieval - */ - nlwarning("FIXME: returning hardcoded color depth of 24bit"); - mode.Depth= 24; - -#elif defined(NL_OS_UNIX) - -# ifdef XF86VIDMODE - sint pixelClock; - XF86VidModeModeLine xmode; - - if (!XF86VidModeGetModeLine(dpy, DefaultScreen(dpy), &pixelClock, &xmode)) - { - nlwarning("XF86VidModeGetModeLine returns 0, cannot get current video mode"); - return false; - } - - mode.Windowed = !_FullScreen; - mode.OffScreen = false; - mode.Depth = (uint) DefaultDepth(dpy, DefaultScreen(dpy)); - mode.Frequency = 1000 * pixelClock / (xmode.htotal * xmode.vtotal) ; - mode.Width = xmode.hdisplay; - mode.Height = xmode.vdisplay; - - nldebug("Current mode : %dx%d, %d Hz, %dbit", mode.Width, mode.Height, mode.Frequency, mode.Depth); -# endif - -#endif - return true; -} - -// -------------------------------------------------- -void CDriverGL::setWindowTitle(const ucstring &title) -{ -#ifdef NL_OS_WINDOWS - SetWindowTextW(_hWnd,(WCHAR*)title.c_str()); - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) - NL3D::MAC::setWindowTitle(title); - -#elif defined (NL_OS_UNIX) - XTextProperty text_property; - char *t = (char*)title.toUtf8().c_str(); - XStringListToTextProperty(&t, 1, &text_property); - XSetWMName(dpy, win, &text_property); -#endif // NL_OS_WINDOWS -} - -// *************************************************************************** -void CDriverGL::setWindowPos(uint32 x, uint32 y) -{ - _WindowX = (sint32)x; - _WindowY = (sint32)y; -#ifdef NL_OS_WINDOWS - SetWindowPos(_hWnd, NULL, _WindowX, _WindowY, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) - NL3D::MAC::setWindowPos(x, y); - -#elif defined (NL_OS_UNIX) - XMoveWindow(dpy, win, _WindowX, _WindowY); - -#endif // NL_OS_WINDOWS -} - -// *************************************************************************** -void CDriverGL::showWindow(bool show) -{ -#ifdef NL_OS_WINDOWS - ShowWindow (_hWnd, show ? SW_SHOW:SW_HIDE); -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - if (show) - XMapWindow(dpy, win); - else - XUnmapWindow(dpy, win); -#endif // NL_OS_WINDOWS -} - // -------------------------------------------------- void CDriverGL::resetTextureShaders() { @@ -1855,71 +690,26 @@ void CDriverGL::resetTextureShaders() { glEnable(GL_TEXTURE_SHADER_NV); - for (uint stage = 0; stage < inlGetNumTextStages(); ++stage) { _DriverGLStates.activeTextureARB(stage); if (stage != 0) { glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB + stage - 1); - - } - glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE); + glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE); _CurrentTexAddrMode[stage] = GL_NONE; } - glDisable(GL_TEXTURE_SHADER_NV); + glDisable(GL_TEXTURE_SHADER_NV); _NVTextureShaderEnabled = false; } } // -------------------------------------------------- - -emptyProc CDriverGL::getWindowProc() -{ - H_AUTO_OGL(CDriverGL_getWindowProc) -#ifdef NL_OS_WINDOWS - return (emptyProc)GlWndProc; -#else // NL_OS_WINDOWS - return NULL; -#endif // NL_OS_WINDOWS -} - -// -------------------------------------------------- - -bool CDriverGL::activate() -{ - H_AUTO_OGL(CDriverGL_activate) -#ifdef NL_OS_WINDOWS - HGLRC hglrc=wglGetCurrentContext(); - - - if (hglrc!=_hRC) - { - wglMakeCurrent(_hDC,_hRC); - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Temporary Mac Implementation" - nlwarning("OpenGL Driver: Temporary Mac Implementation"); - - // already done in setDisplay, not needed here - unclean! FIXME - -#elif defined (NL_OS_UNIX) - GLXContext nctx=glXGetCurrentContext(); - if (nctx != NULL && nctx!=ctx) - { - glXMakeCurrent(dpy, win,ctx); - } -#endif // NL_OS_WINDOWS - return true; -} - -// -------------------------------------------------- - bool CDriverGL::isTextureExist(const ITexture&tex) { H_AUTO_OGL(CDriverGL_isTextureExist) @@ -1930,7 +720,7 @@ bool CDriverGL::isTextureExist(const ITexture&tex) getTextureShareName (tex, name); { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); result = (rTexDrvInfos.find(name) != rTexDrvInfos.end()); } @@ -1938,7 +728,6 @@ bool CDriverGL::isTextureExist(const ITexture&tex) } // -------------------------------------------------- - bool CDriverGL::clear2D(CRGBA rgba) { H_AUTO_OGL(CDriverGL_clear2D) @@ -1950,7 +739,6 @@ bool CDriverGL::clear2D(CRGBA rgba) } // -------------------------------------------------- - bool CDriverGL::clearZBuffer(float zval) { H_AUTO_OGL(CDriverGL_clearZBuffer) @@ -1963,7 +751,6 @@ bool CDriverGL::clearZBuffer(float zval) } // -------------------------------------------------- - bool CDriverGL::clearStencilBuffer(float stencilval) { H_AUTO_OGL(CDriverGL_clearStencilBuffer) @@ -1975,7 +762,6 @@ bool CDriverGL::clearStencilBuffer(float stencilval) } // -------------------------------------------------- - void CDriverGL::setColorMask (bool bRed, bool bGreen, bool bBlue, bool bAlpha) { H_AUTO_OGL(CDriverGL_setColorMask ) @@ -1986,6 +772,7 @@ void CDriverGL::setColorMask (bool bRed, bool bGreen, bool bBlue, bool bAlpha) bool CDriverGL::swapBuffers() { H_AUTO_OGL(CDriverGL_swapBuffers) + ++ _SwapBufferCounter; // Reset texture shaders //resetTextureShaders(); @@ -2131,7 +918,6 @@ bool CDriverGL::swapBuffers() } // -------------------------------------------------- - bool CDriverGL::release() { H_AUTO_OGL(CDriverGL_release) @@ -2220,8 +1006,8 @@ bool CDriverGL::release() } #elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); + + NL3D::MAC::release(); #elif defined (NL_OS_UNIX) if(_FullScreen) @@ -2252,51 +1038,6 @@ bool CDriverGL::release() } // -------------------------------------------------- - -IDriver::TMessageBoxId CDriverGL::systemMessageBox (const char* message, const char* title, IDriver::TMessageBoxType type, TMessageBoxIcon icon) -{ - H_AUTO_OGL(CDriverGL_systemMessageBox) -#ifdef NL_OS_WINDOWS - switch (::MessageBox (NULL, message, title, ((type==retryCancelType)?MB_RETRYCANCEL: - (type==yesNoCancelType)?MB_YESNOCANCEL: - (type==okCancelType)?MB_OKCANCEL: - (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: - (type==yesNoType)?MB_YESNO|MB_ICONQUESTION:MB_OK)| - - ((icon==handIcon)?MB_ICONHAND: - (icon==questionIcon)?MB_ICONQUESTION: - (icon==exclamationIcon)?MB_ICONEXCLAMATION: - (icon==asteriskIcon)?MB_ICONASTERISK: - (icon==warningIcon)?MB_ICONWARNING: - (icon==errorIcon)?MB_ICONERROR: - (icon==informationIcon)?MB_ICONINFORMATION: - (icon==stopIcon)?MB_ICONSTOP:0))) - { - case IDOK: - return okId; - case IDCANCEL: - return cancelId; - case IDABORT: - return abortId; - case IDRETRY: - return retryId; - case IDIGNORE: - return ignoreId; - case IDYES: - return yesId; - case IDNO: - return noId; - } - nlstop; -#else // NL_OS_WINDOWS - // Call the console version! - IDriver::systemMessageBox (message, title, type, icon); -#endif // NL_OS_WINDOWS - return okId; -} - -// -------------------------------------------------- - void CDriverGL::setupViewport (const class CViewport& viewport) { H_AUTO_OGL(CDriverGL_setupViewport ) @@ -2359,9 +1100,6 @@ void CDriverGL::setupViewport (const class CViewport& viewport) int iheight=(int)((float)clientHeight*height+0.5f); clamp (iheight, 0, clientHeight-iy); glViewport (ix, iy, iwidth, iheight); - - - } // -------------------------------------------------- @@ -2371,10 +1109,8 @@ void CDriverGL::getViewport(CViewport &viewport) viewport = _CurrViewport; } - - // -------------------------------------------------- -void CDriverGL::setupScissor (const class CScissor& scissor) +void CDriverGL::setupScissor (const class CScissor& scissor) { H_AUTO_OGL(CDriverGL_setupScissor ) #ifdef NL_OS_WINDOWS @@ -2459,167 +1195,6 @@ void CDriverGL::setupScissor (const class CScissor& scissor) } } - - -// -------------------------------------------------- - -void CDriverGL::showCursor(bool b) -{ - H_AUTO_OGL(CDriverGL_showCursor) -#ifdef NL_OS_WINDOWS - if (b) - { - while (ShowCursor(b) < 0) - ; - } - else - { - while (ShowCursor(b) >= 0) - ; - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - - if (b) - { - if (cursor != None) - { - XFreeCursor(dpy, cursor); - cursor = None; - } - XUndefineCursor(dpy, win); - } - else - { - if (cursor == None) - { - char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; - Pixmap pixmap_no_data = XCreateBitmapFromData (dpy, win, bm_no_data, 8, 8); - XColor black; - memset(&black, 0, sizeof (XColor)); - black.flags = DoRed | DoGreen | DoBlue; - cursor = XCreatePixmapCursor (dpy, pixmap_no_data, pixmap_no_data, &black, &black, 0, 0); - XFreePixmap(dpy, pixmap_no_data); - } - XDefineCursor(dpy, win, cursor); - } -#endif // NL_OS_UNIX -} - - -// -------------------------------------------------- - -void CDriverGL::setMousePos(float x, float y) -{ - H_AUTO_OGL(CDriverGL_setMousePos) -#ifdef NL_OS_WINDOWS - if (_hWnd) - { - // NeL window coordinate to MSWindows coordinates - POINT pt; - pt.x = (int)((float)(_WindowWidth)*x); - pt.y = (int)((float)(_WindowHeight)*(1.0f-y)); - ClientToScreen (_hWnd, &pt); - SetCursorPos(pt.x, pt.y); - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - XWindowAttributes xwa; - XGetWindowAttributes (dpy, win, &xwa); - int x1 = (int)(x * (float) xwa.width); - int y1 = (int)((1.0f - y) * (float) xwa.height); - XWarpPointer (dpy, None, win, None, None, None, None, x1, y1); -#endif // NL_OS_UNIX -} - - -void CDriverGL::getWindowSize(uint32 &width, uint32 &height) -{ - H_AUTO_OGL(CDriverGL_getWindowSize) -#ifdef NL_OS_WINDOWS - // Off-srceen rendering ? - if (_OffScreen) - { - if (_PBuffer) - { - nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width ); - nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height ); - } - } - else - { - if (_hWnd) - { - width = (uint32)(_WindowWidth); - height = (uint32)(_WindowHeight); - } - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) - - NL3D::MAC::getWindowSize(width, height); - -#elif defined (NL_OS_UNIX) - XWindowAttributes xwa; - XGetWindowAttributes (dpy, win, &xwa); - width = (uint32) xwa.width; - height = (uint32) xwa.height; -#endif // NL_OS_UNIX -} - -void CDriverGL::getWindowPos(uint32 &x, uint32 &y) -{ - H_AUTO_OGL(CDriverGL_getWindowPos) -#ifdef NL_OS_WINDOWS - // Off-srceen rendering ? - if (_OffScreen) - { - if (_PBuffer) - { - x = y = 0; - } - } - else - { - if (_hWnd) - { - x = (uint32)(_WindowX); - y = (uint32)(_WindowY); - } - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) - - NL3D::MAC::getWindowPos(x, y); - -#elif defined (NL_OS_UNIX) - x = y = 0; -#endif // NL_OS_UNIX -} - - - -// -------------------------------------------------- - -bool CDriverGL::isActive() -{ - H_AUTO_OGL(CDriverGL_isActive) -#ifdef NL_OS_WINDOWS - return (IsWindow(_hWnd) != 0); -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - // nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - -#endif // NL_OS_UNIX - return true; -} - uint8 CDriverGL::getBitPerPixel () { H_AUTO_OGL(CDriverGL_getBitPerPixel ) @@ -2637,69 +1212,10 @@ const char *CDriverGL::getVideocardInformation () const char *renderer = (const char *) glGetString (GL_RENDERER); const char *version = (const char *) glGetString (GL_VERSION); - - smprintf(name, 1024, "OpenGL / %s / %s / %s", vendor, renderer, version); return name; } - -void CDriverGL::setCapture (bool b) -{ - H_AUTO_OGL(CDriverGL_setCapture ) - -#ifdef NL_OS_WINDOWS - - if (b) - { - RECT client; - GetClientRect (_hWnd, &client); - POINT pt1,pt2; - pt1.x = client.left; - pt1.y = client.top; - ClientToScreen (_hWnd, &pt1); - pt2.x = client.right; - pt2.y = client.bottom; - ClientToScreen (_hWnd, &pt2); - client.bottom = pt2.y; - client.top = pt1.y; - client.left = pt1.x; - client.right = pt2.x; - ClipCursor (&client); - } - else - ClipCursor (NULL); - - /* - if (b) - SetCapture (_hWnd); - else - ReleaseCapture (); - */ - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - - /* - TODO x11 funtion: setCapture - */ - - if(b) // capture the cursor. - { - XGrabPointer(dpy, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime); - } - else // release the cursor. - { - XUngrabPointer(dpy, CurrentTime); - } - -#endif // NL_OS_UNIX -} - - bool CDriverGL::clipRect(NLMISC::CRect &rect) { H_AUTO_OGL(CDriverGL_clipRect) @@ -2719,8 +1235,6 @@ bool CDriverGL::clipRect(NLMISC::CRect &rect) return rect.Width>0 && rect.Height>0; } - - void CDriverGL::getBufferPart (CBitmap &bitmap, NLMISC::CRect &rect) { H_AUTO_OGL(CDriverGL_getBufferPart ) @@ -2779,9 +1293,6 @@ bool CDriverGL::fillBuffer (CBitmap &bitmap) } // *************************************************************************** - - - void CDriverGL::copyFrameBufferToTexture(ITexture *tex, uint32 level, uint32 offsetx, @@ -2827,7 +1338,7 @@ void CDriverGL::copyFrameBufferToTexture(ITexture *tex, // gltext->activeFrameBufferObject(tex); } - +// *************************************************************************** void CDriverGL::setPolygonMode (TPolygonMode mode) { H_AUTO_OGL(CDriverGL_setPolygonMode ) @@ -2848,21 +1359,23 @@ void CDriverGL::setPolygonMode (TPolygonMode mode) } } - -bool CDriverGL::fogEnabled() +// *************************************************************************** +bool CDriverGL::fogEnabled() { H_AUTO_OGL(CDriverGL_fogEnabled) return _FogEnabled; } -void CDriverGL::enableFog(bool enable) +// *************************************************************************** +void CDriverGL::enableFog(bool enable) { H_AUTO_OGL(CDriverGL_enableFog) _DriverGLStates.enableFog(enable); _FogEnabled= enable; } -void CDriverGL::setupFog(float start, float end, CRGBA color) +// *************************************************************************** +void CDriverGL::setupFog(float start, float end, CRGBA color) { H_AUTO_OGL(CDriverGL_setupFog) glFogf(GL_FOG_MODE, GL_LINEAR); @@ -2897,23 +1410,22 @@ void CDriverGL::setupFog(float start, float end, CRGBA color) _FogEnd = end; } - // *************************************************************************** -float CDriverGL::getFogStart() const +float CDriverGL::getFogStart() const { H_AUTO_OGL(CDriverGL_getFogStart) return _FogStart; } // *************************************************************************** -float CDriverGL::getFogEnd() const +float CDriverGL::getFogEnd() const { H_AUTO_OGL(CDriverGL_getFogEnd) return _FogEnd; } // *************************************************************************** -CRGBA CDriverGL::getFogColor() const +CRGBA CDriverGL::getFogColor() const { H_AUTO_OGL(CDriverGL_getFogColor) CRGBA ret; @@ -3097,7 +1609,7 @@ bool CDriverGL::supportPerPixelLighting(bool specular) const } // *************************************************************************** -void CDriverGL::setPerPixelLightingLight(CRGBA diffuse, CRGBA specular, float shininess) +void CDriverGL::setPerPixelLightingLight(CRGBA diffuse, CRGBA specular, float shininess) { H_AUTO_OGL(CDriverGL_setPerPixelLightingLight) @@ -3107,139 +1619,14 @@ void CDriverGL::setPerPixelLightingLight(CRGBA diffuse, CRGBA specular, float sh } // *************************************************************************** -NLMISC::IMouseDevice *CDriverGL::enableLowLevelMouse(bool enable, bool exclusive) -{ - H_AUTO_OGL(CDriverGL_enableLowLevelMouse) - -#ifdef NL_OS_WINDOWS - if (_EventEmitter.getNumEmitters() < 2) return NULL; - NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); - if (enable) - { - try - { - NLMISC::IMouseDevice *md = diee->getMouseDevice(exclusive); - return md; - } - catch (EDirectInput &) - { - return NULL; - } - } - else - { - diee->releaseMouse(); - return NULL; - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - -#endif - return NULL; -} - -// *************************************************************************** -NLMISC::IKeyboardDevice *CDriverGL::enableLowLevelKeyboard(bool enable) -{ - H_AUTO_OGL(CDriverGL_enableLowLevelKeyboard) -#ifdef NL_OS_WINDOWS - if (_EventEmitter.getNumEmitters() < 2) return NULL; - NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); - if (enable) - { - try - { - NLMISC::IKeyboardDevice *md = diee->getKeyboardDevice(); - return md; - } - catch (EDirectInput &) - { - return NULL; - } - } - else - { - diee->releaseKeyboard(); - return NULL; - } -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - -#endif - return NULL; -} - -// *************************************************************************** -NLMISC::IInputDeviceManager *CDriverGL::getLowLevelInputDeviceManager() -{ - H_AUTO_OGL(CDriverGL_getLowLevelInputDeviceManager) -#ifdef NL_OS_WINDOWS - if (_EventEmitter.getNumEmitters() < 2) return NULL; - NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); - return diee; -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - -#endif - return NULL; -} - -// *************************************************************************** -uint CDriverGL::getDoubleClickDelay(bool hardwareMouse) -{ - H_AUTO_OGL(CDriverGL_getDoubleClickDelay) - -#ifdef NL_OS_WINDOWS - NLMISC::IMouseDevice *md = NULL; - if (_EventEmitter.getNumEmitters() >= 2) - { - NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); - if (diee->isMouseCreated()) - { - try - { - md = diee->getMouseDevice(hardwareMouse); - } - catch (EDirectInput &) - { - // could not get device .. - } - } - } - if (md) - { - return md->getDoubleClickDelay(); - } - // try to read the good value from windows - return ::GetDoubleClickTime(); -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - // TODO for Linux FIXME: FAKE FIX - return 250; -#endif -} - -// *************************************************************************** -bool CDriverGL::supportBlendConstantColor() const +bool CDriverGL::supportBlendConstantColor() const { H_AUTO_OGL(CDriverGL_supportBlendConstantColor) return _Extensions.EXTBlendColor; } // *************************************************************************** -void CDriverGL::setBlendConstantColor(NLMISC::CRGBA col) +void CDriverGL::setBlendConstantColor(NLMISC::CRGBA col) { H_AUTO_OGL(CDriverGL_setBlendConstantColor) @@ -3254,7 +1641,7 @@ void CDriverGL::setBlendConstantColor(NLMISC::CRGBA col) } // *************************************************************************** -NLMISC::CRGBA CDriverGL::getBlendConstantColor() const +NLMISC::CRGBA CDriverGL::getBlendConstantColor() const { H_AUTO_OGL(CDriverGL_CDriverGL) @@ -3268,7 +1655,6 @@ uint CDriverGL::getNbTextureStages() const return inlGetNumTextStages(); } - // *************************************************************************** void CDriverGL::refreshProjMatrixFromGL() { @@ -3281,70 +1667,6 @@ void CDriverGL::refreshProjMatrixFromGL() _ProjMatDirty = false; } -// *************************************************************************** -bool CDriverGL::setMonitorColorProperties (const CMonitorColorProperties &properties) -{ - H_AUTO_OGL(CDriverGL_setMonitorColorProperties ) - -#ifdef NL_OS_WINDOWS - - // Get a DC - HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); - if (dc) - { - // The ramp - WORD ramp[256*3]; - - // For each composant - uint c; - for( c=0; c<3; c++ ) - { - uint i; - for( i=0; i<256; i++ ) - { - // Floating value - float value = (float)i / 256; - - // Contrast - value = (float) max (0.0f, (value-0.5f) * (float) pow (3.f, properties.Contrast[c]) + 0.5f ); - - // Gamma - value = (float) pow (value, (properties.Gamma[c]>0) ? 1 - 3 * properties.Gamma[c] / 4 : 1 - properties.Gamma[c] ); - - // Luminosity - value = value + properties.Luminosity[c] / 2.f; - ramp[i+(c<<8)] = (WORD)min ((int)65535, max (0, (int)(value * 65535))); - } - } - - // Set the ramp - bool result = SetDeviceGammaRamp (dc, ramp) != FALSE; - - // Release the DC - ReleaseDC (NULL, dc); - - // Returns result - return result; - } - else - { - nlwarning ("(CDriverGL::setMonitorColorProperties): can't create DC"); - return false; - } - -#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) -# warning "OpenGL Driver: Missing Mac Implementation" - nlwarning("OpenGL Driver: Missing Mac Implementation"); - -#elif defined (NL_OS_UNIX) - - // TODO for Linux: implement CDriverGL::setMonitorColorProperties - nlwarning ("CDriverGL::setMonitorColorProperties not implemented"); - return false; - -#endif -} - // *************************************************************************** bool CDriverGL::supportEMBM() const { @@ -3435,9 +1757,6 @@ void CDriverGL::initEMBM() } } - - - // *************************************************************************** /** Water fragment program with extension ARB_fragment_program */ @@ -3499,8 +1818,6 @@ MAD_SAT tmpFog, fogValue.x, fogFactor.x, fogFactor.y; \n\ LRP oCol, tmpFog.x, envMap, fogColor; \n\ END "; - - // ************************************************************************************** /** Water fragment program with extension ARB_fragment_program and a diffuse map applied */ @@ -3572,7 +1889,6 @@ MUL diffuse, diffuse, envMap; \n\ LRP oCol, tmpFog.x, diffuse, fogColor; \n\ END "; - // *************************************************************************** /** Load a ARB_fragment_program_code, and ensure it is loaded natively */ @@ -3611,7 +1927,6 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra return 0; } - // *************************************************************************** /** R200 Fragment Shader : * Send fragment shader to fetch a perturbed envmap from the addition of 2 bumpmap @@ -3643,6 +1958,7 @@ void CDriverGL::forceNativeFragmentPrograms(bool nativeOnly) _ForceNativeFragmentPrograms = nativeOnly; } +// *************************************************************************** void CDriverGL::initFragmentShaders() { H_AUTO_OGL(CDriverGL_initFragmentShaders) @@ -3797,7 +2113,6 @@ void CDriverGL::deleteFragmentShaders() } } - // *************************************************************************** void CDriverGL::finish() { @@ -4111,7 +2426,6 @@ void CDriverGL::retrieveATIDriverVersion() #endif } - // *************************************************************************** bool CDriverGL::supportMADOperator() const { @@ -4120,7 +2434,6 @@ bool CDriverGL::supportMADOperator() const return _Extensions.NVTextureEnvCombine4 || _Extensions.ATITextureEnvCombine3; } - // *************************************************************************** uint CDriverGL::getNumAdapter() const { @@ -4130,7 +2443,6 @@ uint CDriverGL::getNumAdapter() const } // *************************************************************************** - bool CDriverGL::getAdapter(uint adapter, CAdapter &desc) const { H_AUTO_OGL(CDriverGL_getAdapter) @@ -4153,7 +2465,6 @@ bool CDriverGL::getAdapter(uint adapter, CAdapter &desc) const } // *************************************************************************** - bool CDriverGL::setAdapter(uint adapter) { H_AUTO_OGL(CDriverGL_setAdapter) @@ -4162,7 +2473,6 @@ bool CDriverGL::setAdapter(uint adapter) } // *************************************************************************** - CVertexBuffer::TVertexColorType CDriverGL::getVertexColorFormat() const { H_AUTO_OGL(CDriverGL_CDriverGL) @@ -4171,7 +2481,6 @@ CVertexBuffer::TVertexColorType CDriverGL::getVertexColorFormat() const } // *************************************************************************** - bool CDriverGL::activeShader(CShader * /* shd */) { H_AUTO_OGL(CDriverGL_activeShader) @@ -4180,21 +2489,18 @@ bool CDriverGL::activeShader(CShader * /* shd */) } // *************************************************************************** - void CDriverGL::startBench (bool wantStandardDeviation, bool quick, bool reset) { CHTimer::startBench (wantStandardDeviation, quick, reset); } // *************************************************************************** - void CDriverGL::endBench () { CHTimer::endBench (); } // *************************************************************************** - void CDriverGL::displayBench (class NLMISC::CLog *log) { // diplay @@ -4376,7 +2682,6 @@ uint COcclusionQueryGL::getVisibleCount() return VisibleCount; } - // *************************************************************************** void CDriverGL::setDepthRange(float znear, float zfar) { @@ -4482,12 +2787,10 @@ void CDriverGL::stencilOp(TStencilOp fail, TStencilOp zfail, TStencilOp zpass) default: nlstop; } - _DriverGLStates.stencilOp(glFail, glZFail, glZPass); } // *************************************************************************** - void CDriverGL::stencilMask(uint mask) { H_AUTO_OGL(CDriverGL_CDriverGL) @@ -4514,6 +2817,7 @@ void CDriverGL::endDialogMode() } // NL3D +// *************************************************************************** void displayGLError(GLenum error) { switch(error) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index aad98fc5d..605acd3a0 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -842,6 +842,7 @@ private: private: void switchBackToOldMode(); + bool setupDisplay(); // Get the proj matrix setupped in GL void refreshProjMatrixFromGL(); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.vcproj b/code/nel/src/3d/driver/opengl/driver_opengl.vcproj index ad7e0e227..3ef826e2f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.vcproj +++ b/code/nel/src/3d/driver/opengl/driver_opengl.vcproj @@ -467,6 +467,10 @@ RelativePath="driver_opengl_vertex_program.cpp" > + + diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 62732625c..346218a99 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -620,10 +620,12 @@ static bool setupATITextureEnvCombine3(const char *glext) { H_AUTO_OGL(setupATITextureEnvCombine3); -#ifdef NL_OS_MAC -// Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled - return false; -#endif +// reenabled to allow bloom on mac, TODO: cleanly fix the water issue +// i think this issue was mtp target related - is this the case in ryzom too? +// #ifdef NL_OS_MAC +// // Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled +// return false; +// #endif CHECK_EXT("GL_ATI_texture_env_combine3"); return true; @@ -671,10 +673,12 @@ static bool setupNVVertexProgram(const char *glext) { H_AUTO_OGL(setupNVVertexProgram); -#ifdef NL_OS_MAC -// Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled - return false; -#endif +// reenabled to allow bloom on mac, TODO: cleanly fix the water issue +// i think this issue was mtp target related - is this the case in ryzom too? +// #ifdef NL_OS_MAC +// // Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled +// return false; +// #endif CHECK_EXT("GL_NV_vertex_program"); CHECK_ADDRESS(NEL_PFNGLAREPROGRAMSRESIDENTNVPROC, glAreProgramsResidentNV); @@ -882,10 +886,12 @@ static bool setupNVTextureShader(const char *glext) { H_AUTO_OGL(setupNVTextureShader); -#ifdef NL_OS_MAC -// Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled - return false; -#endif +// reenabled to allow bloom on mac, TODO: cleanly fix the water issue +// i think this issue was mtp target related - is this the case in ryzom too? +// #ifdef NL_OS_MAC +// // Water doesn't render on GeForce 8600M GT (on MAC OS X) if this extension is enabled +// return false; +// #endif CHECK_EXT("GL_NV_texture_shader"); return true; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index 2eafa4b1a..c22b54f67 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -179,12 +179,8 @@ void CDriverGLStates::forceDefaults(uint nbStages) // Cull order _CullMode = CCW; glCullFace(GL_BACK); - - } - - // *************************************************************************** void CDriverGLStates::enableBlend(uint enable) { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 4d4166591..0acd2c57d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -656,7 +656,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded, // insert or get the texture. { - CSynchronized::CAccessor access(&_SyncTexDrvInfos); + CUnfairSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); ItTexDrvInfoPtrMap itTex; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp new file mode 100644 index 000000000..ff78f43a1 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -0,0 +1,1691 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdopengl.h" +#include "driver_opengl.h" +#include "driver_opengl_extension.h" +#include "driver_opengl_vertex_buffer_hard.h" + +// by default, we disable the windows menu keys (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) +#define NL_DISABLE_MENU + +#ifdef NL_OS_WINDOWS +# include +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# define GL_GLEXT_LEGACY +# include +# include "mac/glext.h" +# include "mac/cocoa_adapter.h" +#elif defined (NL_OS_UNIX) +# include +# include +#endif // NL_OS_UNIX + +#include "nel/misc/mouse_device.h" +#include "nel/misc/di_event_emitter.h" +#include "nel/3d/u_driver.h" + +using namespace std; +using namespace NLMISC; + +namespace NL3D +{ + +#ifdef NL_OS_WINDOWS + +static bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + H_AUTO_OGL(GlWndProc) + if(message == WM_SIZE) + { + if (driver != NULL) + { + RECT rect; + GetClientRect (driver->_hWnd, &rect); + + // Setup gl viewport + driver->_WindowWidth = rect.right-rect.left; + driver->_WindowHeight = rect.bottom-rect.top; + } + } + else if(message == WM_MOVE) + { + if (driver != NULL) + { + RECT rect; + GetWindowRect (hWnd, &rect); + driver->_WindowX = rect.left; + driver->_WindowY = rect.top; + } + } + else if (message == WM_ACTIVATE) + { + WORD fActive = LOWORD(wParam); + if (fActive == WA_INACTIVE) + { + driver->_WndActive = false; + } + else + { + driver->_WndActive = true; + } + } + + bool trapMessage = false; + if (driver->_EventEmitter.getNumEmitters() > 0) + { + CWinEventEmitter *we = NLMISC::safe_cast(driver->_EventEmitter.getEmitter(0)); + // Process the message by the emitter + we->setHWnd(hWnd); + trapMessage = we->processMessage (hWnd, message, wParam, lParam); + } + return trapMessage; +} + +static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + H_AUTO_OGL(DriverGL_WndProc) + // Get the driver pointer.. + CDriverGL *pDriver=(CDriverGL*)GetWindowLongPtr (hWnd, GWLP_USERDATA); + bool trapMessage = false; + if (pDriver != NULL) + { + trapMessage = GlWndProc (pDriver, hWnd, message, wParam, lParam); + } + +#ifdef NL_DISABLE_MENU + // disable menu (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) + if(message == WM_SYSCOMMAND && wParam == SC_KEYMENU) + return 0; +#endif // NL_DISABLE_MENU + + // disable menu (default ALT-F4 behavior is disabled) + if(message == WM_CLOSE) + { + if(pDriver && pDriver->ExitFunc) + { + pDriver->ExitFunc(); + } + else + { +#ifndef NL_DISABLE_MENU + // if we don't disable menu, alt F4 make a direct exit else we discard the message + exit(0); +#endif // NL_DISABLE_MENU + } + return 0; + } + + return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam); +} + +#endif // NL_OS_UNIX + +// *************************************************************************** +bool CDriverGL::init (uint windowIcon, emptyProc exitFunc) +{ + H_AUTO_OGL(CDriverGL_init) + + ExitFunc = exitFunc; + +#ifdef NL_OS_WINDOWS + WNDCLASSW wc; + + if (!_Registered) + { + memset(&wc,0,sizeof(wc)); + wc.style = CS_HREDRAW | CS_VREDRAW ;//| CS_DBLCLKS; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandle(NULL); + wc.hIcon = (HICON)windowIcon; + wc.hCursor = LoadCursorW(NULL,(LPCWSTR)IDC_ARROW); + wc.hbrBackground = WHITE_BRUSH; + wc.lpszClassName = L"NLClass"; + wc.lpszMenuName = NULL; + if ( !RegisterClassW(&wc) ) + { + return false; + } + _Registered=1; + } + + // Backup monitor color parameters + HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); + if (dc) + { + _NeedToRestaureGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE; + + // Release the DC + ReleaseDC (NULL, dc); + } + else + { + nlwarning ("(CDriverGL::init): can't create DC"); + } + + // ati specific : try to retrieve driver version + retrieveATIDriverVersion(); +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + return NL3D::MAC::init(windowIcon, exitFunc); + +#elif defined (NL_OS_UNIX) + + dpy = XOpenDisplay(NULL); + if (dpy == NULL) + { + nlerror ("XOpenDisplay failed on '%s'", getenv("DISPLAY")); + } + else + { + nldebug("3D: XOpenDisplay on '%s' OK", getenv("DISPLAY")); + } + +#endif + return true; +} + +// -------------------------------------------------- +bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool resizeable) throw(EBadDisplay) +{ + H_AUTO_OGL(CDriverGL_setDisplay) + + uint width = mode.Width; + uint height = mode.Height; + +#ifdef NL_OS_WINDOWS + + // Driver caps. + //============= + // Retrieve the WGL extensions before init the driver. + int pf; + + _OffScreen = mode.OffScreen; + + // Init pointers + _PBuffer = NULL; + _hWnd = NULL; + _WindowWidth = _WindowHeight = _WindowX = _WindowY = 0; + _hRC = NULL; + _hDC = NULL; + + // Offscreen mode ? + if (_OffScreen) + { + // Get a hdc + + ULONG WndFlags=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; + WndFlags&=~WS_VISIBLE; + RECT WndRect; + WndRect.left=0; + WndRect.top=0; + WndRect.right=width; + WndRect.bottom=height; + AdjustWindowRect(&WndRect,WndFlags,FALSE); + HWND tmpHWND = CreateWindowW(L"NLClass", + L"", + WndFlags, + CW_USEDEFAULT,CW_USEDEFAULT, + WndRect.right,WndRect.bottom, + NULL, + NULL, + GetModuleHandleW(NULL), + NULL); + if (!tmpHWND) + { + nlwarning ("CDriverGL::setDisplay: CreateWindowW failed"); + return false; + } + + // resize the window + RECT rc; + SetRect (&rc, 0, 0, width, height); + _WindowWidth = width; + _WindowHeight = height; + AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), GetMenu (_hWnd) != NULL, GetWindowExStyle (_hWnd)); + SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); + + // Get the + HDC tempHDC = GetDC(tmpHWND); + + _Depth=uint8(GetDeviceCaps(tempHDC,BITSPIXEL)); + + // --- + memset(&_pfd,0,sizeof(_pfd)); + _pfd.nSize = sizeof(_pfd); + _pfd.nVersion = 1; + _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + _pfd.iPixelType = PFD_TYPE_RGBA; + _pfd.cColorBits = (char)_Depth; + + // Choose best suited Depth Buffer. + if(_Depth<=16) + { + _pfd.cDepthBits = 16; + } + else + { + _pfd.cDepthBits = 24; + _pfd.cAlphaBits = 8; + } + _pfd.iLayerType = PFD_MAIN_PLANE; + pf=ChoosePixelFormat(tempHDC,&_pfd); + if (!pf) + { + nlwarning ("CDriverGL::setDisplay: ChoosePixelFormat failed"); + DestroyWindow (tmpHWND); + return false; + } + if ( !SetPixelFormat(tempHDC,pf,&_pfd) ) + { + nlwarning ("CDriverGL::setDisplay: SetPixelFormat failed"); + DestroyWindow (tmpHWND); + return false; + } + + // Create gl context + HGLRC tempGLRC = wglCreateContext(tempHDC); + if (tempGLRC == NULL) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglCreateContext failed: 0x%x", error); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + // Make the context current + if (!wglMakeCurrent(tempHDC,tempGLRC)) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x", error); + wglDeleteContext (tempGLRC); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + // Register WGL functions + registerWGlExtensions (_Extensions, tempHDC); + + HDC hdc = wglGetCurrentDC (); + + if (hdc == NULL) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglGetCurrentDC failed: 0x%x", error); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + // Get ready to query for a suitable pixel format that meets our + // minimum requirements. + int iattributes[2*20]; + float fattributes[2*20]; + int niattribs = 0; + + // Attribute arrays must be "0" terminated - for simplicity, first + // just zero-out the array then fill from left to right. + for ( int a = 0; a < 2*20; a++ ) + { + iattributes[a] = 0; + fattributes[a] = 0; + } + + // Since we are trying to create a pbuffer, the pixel format we + // request (and subsequently use) must be "buffer capable". + iattributes[2*niattribs ] = WGL_DRAW_TO_PBUFFER_ARB; + iattributes[2*niattribs+1] = true; + niattribs++; + + // We require a minimum of 24-bit depth. + iattributes[2*niattribs ] = WGL_DEPTH_BITS_ARB; + iattributes[2*niattribs+1] = 24; + niattribs++; + + // We require a minimum of 8-bits for each R, G, B, and A. + iattributes[2*niattribs ] = WGL_RED_BITS_ARB; + iattributes[2*niattribs+1] = 8; + niattribs++; + iattributes[2*niattribs ] = WGL_GREEN_BITS_ARB; + iattributes[2*niattribs+1] = 8; + niattribs++; + iattributes[2*niattribs ] = WGL_BLUE_BITS_ARB; + iattributes[2*niattribs+1] = 8; + niattribs++; + iattributes[2*niattribs ] = WGL_ALPHA_BITS_ARB; + iattributes[2*niattribs+1] = 8; + niattribs++; + + // Now obtain a list of pixel formats that meet these minimum + // requirements. + int pformat[20]; + unsigned int nformats; + if ( !nwglChoosePixelFormatARB ( hdc, iattributes, fattributes, + 20, pformat, &nformats ) ) + { + nlwarning ( "pbuffer creation error: Couldn't find a suitable pixel format." ); + wglDeleteContext (tempGLRC); + DestroyWindow (tmpHWND); + return false; + } + + /* After determining a compatible pixel format, the next step is to create a pbuffer of the + chosen format. Fortunately this step is fairly easy, as you merely select one of the formats + returned in the list in step #2 and call the function: */ + int iattributes2[1] = {0}; + // int iattributes2[] = {WGL_PBUFFER_LARGEST_ARB, 1, 0}; + _PBuffer = nwglCreatePbufferARB( hdc, pformat[0], width, height, iattributes2 ); + if (_PBuffer == NULL) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglCreatePbufferARB failed: 0x%x", error); + wglDeleteContext (tempGLRC); + + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + /* After creating a pbuffer, you may use this functions to determine the dimensions of the pbuffer actually created. */ + if ( !nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width ) ) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglQueryPbufferARB failed: 0x%x", error); + wglDeleteContext (tempGLRC); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + if ( !nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height ) ) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglQueryPbufferARB failed: 0x%x", error); + wglDeleteContext (tempGLRC); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + _WindowWidth = width; + _WindowHeight = height; + + /* The next step is to create a device context for the newly created pbuffer. To do this, + call the the function: */ + _hDC = nwglGetPbufferDCARB( _PBuffer ); + if (_hDC == NULL) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglGetPbufferDCARB failed: 0x%x", error); + nwglDestroyPbufferARB( _PBuffer ); + + wglDeleteContext (tempGLRC); + + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + /* The final step of pbuffer creation is to create an OpenGL rendering context and + associate it with the handle for the pbuffer's device context created in step #4. This is done as follows */ + _hRC = wglCreateContext( _hDC ); + if (_hRC == NULL) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglCreateContext failed: 0x%x", error); + nwglReleasePbufferDCARB( _PBuffer, _hDC ); + nwglDestroyPbufferARB( _PBuffer ); + wglDeleteContext (tempGLRC); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + + // Get the depth + _Depth = uint8(GetDeviceCaps (_hDC, BITSPIXEL)); + + // Destroy the temp gl context + if (!wglDeleteContext (tempGLRC)) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglDeleteContext failed: 0x%x", error); + } + + // Destroy the temp windows + if (!DestroyWindow (tmpHWND)) + nlwarning ("CDriverGL::setDisplay: DestroyWindow failed"); + + /* After a pbuffer has been successfully created you can use it for off-screen rendering. To do + so, you'll first need to bind the pbuffer, or more precisely, make its GL rendering context + the current context that will interpret all OpenGL commands and state changes. */ + if (!wglMakeCurrent(_hDC,_hRC)) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x", error); + wglDeleteContext (_hRC); + nwglReleasePbufferDCARB( _PBuffer, _hDC ); + nwglDestroyPbufferARB( _PBuffer ); + DestroyWindow (tmpHWND); + _PBuffer = NULL; + _hWnd = NULL; + _hRC = NULL; + _hDC = NULL; + return false; + } + } + else + { + _FullScreen= false; + if (wnd) + { + _hWnd=wnd; + _DestroyWindow=false; + } + else + { + ULONG WndFlags; + RECT WndRect; + + // Must destroy this window + _DestroyWindow=true; + + if(mode.Windowed) + if(resizeable) + WndFlags=WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; + else + WndFlags=WS_SYSMENU+WS_DLGFRAME+WS_CLIPCHILDREN+WS_CLIPSIBLINGS; + else + { + WndFlags=WS_POPUP; + + _FullScreen= true; + DEVMODE devMode; + _OldScreenMode.dmSize= sizeof(DEVMODE); + _OldScreenMode.dmDriverExtra= 0; + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &_OldScreenMode); + _OldScreenMode.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY ; + + devMode.dmSize= sizeof(DEVMODE); + devMode.dmDriverExtra= 0; + devMode.dmFields= DM_PELSWIDTH | DM_PELSHEIGHT; + devMode.dmPelsWidth= width; + devMode.dmPelsHeight= height; + + if(mode.Depth > 0) + { + devMode.dmBitsPerPel= mode.Depth; + devMode.dmFields |= DM_BITSPERPEL; + } + + if(mode.Frequency > 0) + { + devMode.dmDisplayFrequency= mode.Frequency; + devMode.dmFields |= DM_DISPLAYFREQUENCY; + } + + if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) + return false; + } + WndRect.left=0; + WndRect.top=0; + WndRect.right=width; + WndRect.bottom=height; + AdjustWindowRect(&WndRect,WndFlags,FALSE); + _hWnd = CreateWindowW( L"NLClass", + L"", + WndFlags, + CW_USEDEFAULT,CW_USEDEFAULT, + WndRect.right,WndRect.bottom, + NULL, + NULL, + GetModuleHandleW(NULL), + NULL); + if (_hWnd == NULL) + { + DWORD res = GetLastError(); + nlwarning("CreateWindow failed: %u", res); + return false; + } + + SetWindowLongPtr (_hWnd, GWLP_USERDATA, (LONG_PTR)this); + + // resize the window + RECT rc; + SetRect (&rc, 0, 0, width, height); + AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), GetMenu (_hWnd) != NULL, GetWindowExStyle (_hWnd)); + UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; + if (mode.Windowed) + flags |= SWP_NOMOVE; + SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, flags); + + if (show || _FullScreen) + showWindow(true); + } + + // Init Window Width and Height + RECT clientRect; + GetClientRect (_hWnd, &clientRect); + _WindowWidth = clientRect.right-clientRect.left; + _WindowHeight = clientRect.bottom-clientRect.top; + GetWindowRect (_hWnd, &clientRect); + _WindowX = clientRect.left; + _WindowY = clientRect.top; + + _hDC=GetDC(_hWnd); + wglMakeCurrent(_hDC,NULL); + + _Depth=uint8(GetDeviceCaps(_hDC,BITSPIXEL)); + // --- + memset(&_pfd,0,sizeof(_pfd)); + _pfd.nSize = sizeof(_pfd); + _pfd.nVersion = 1; + _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + _pfd.iPixelType = PFD_TYPE_RGBA; + _pfd.cColorBits = (char)_Depth; + // Choose best suited Depth Buffer. + if(_Depth<=16) + { + _pfd.cDepthBits = 16; + } + else + { + _pfd.cDepthBits = 24; + _pfd.cAlphaBits = 8; + _pfd.cStencilBits = 8; + } + _pfd.iLayerType = PFD_MAIN_PLANE; + pf=ChoosePixelFormat(_hDC,&_pfd); + if (!pf) + { + return false; + } + + if ( !SetPixelFormat(_hDC,pf,&_pfd) ) + { + return false; + } + _hRC=wglCreateContext(_hDC); + + wglMakeCurrent(_hDC,_hRC); + + } + + /// release old emitter + while (_EventEmitter.getNumEmitters() != 0) + { + _EventEmitter.removeEmitter(_EventEmitter.getEmitter(_EventEmitter.getNumEmitters() - 1)); + } + NLMISC::CWinEventEmitter *we = new NLMISC::CWinEventEmitter; + // setup the event emitter, and try to retrieve a direct input interface + _EventEmitter.addEmitter(we, true /*must delete*/); // the main emitter + /// try to get direct input + try + { + NLMISC::CDIEventEmitter *diee = NLMISC::CDIEventEmitter::create(GetModuleHandle(NULL), _hWnd, we); + if (diee) + { + _EventEmitter.addEmitter(diee, true); + } + } + catch(EDirectInput &e) + { + nlinfo(e.what()); + } + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + NL3D::MAC::setDisplay(wnd, mode, show, resizeable); + +#elif defined (NL_OS_UNIX) + + static int sAttribList16bpp[] = + { + GLX_RGBA, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 16, + GLX_RED_SIZE, 4, + GLX_GREEN_SIZE, 4, + GLX_BLUE_SIZE, 4, + GLX_ALPHA_SIZE, 4, + GLX_STENCIL_SIZE, 8, + None + }; + + static int sAttribList24bpp[] = + { + GLX_RGBA, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 24, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, + GLX_STENCIL_SIZE, 8, + None + }; + + // first try 24bpp and if that fails 16bpp + XVisualInfo *visual_info = glXChooseVisual (dpy, DefaultScreen(dpy), sAttribList24bpp); + if (visual_info == NULL) + visual_info = glXChooseVisual(dpy, DefaultScreen(dpy), sAttribList16bpp); + if(visual_info == NULL) + { + nlerror("glXChooseVisual() failed"); + } + else + { + nldebug("3D: glXChooseVisual OK"); + } + + ctx = glXCreateContext (dpy, visual_info, None, GL_TRUE); + if(ctx == NULL) + { + nlerror("glXCreateContext() failed"); + } + else + { + nldebug("3D: glXCreateContext() OK"); + } + + XSetWindowAttributes attr; + attr.background_pixel = BlackPixel(dpy, DefaultScreen(dpy)); + attr.override_redirect = False; + + int attr_flags = CWOverrideRedirect | CWBackPixel; + + if(wnd == EmptyWindow) + { + nlWindow root = RootWindow(dpy, DefaultScreen(dpy)); + + attr.colormap = XCreateColormap(dpy, root, visual_info->visual, AllocNone); + attr_flags |= CWColormap; + + win = XCreateWindow (dpy, root, 0, 0, width, height, 0, visual_info->depth, InputOutput, visual_info->visual, attr_flags, &attr); + + if (win == EmptyWindow) + { + nlerror("3D: XCreateWindow() failed"); + } + else + { + nldebug("3D: XCreateWindow() OK"); + } + } + else + { + win = wnd; + XChangeWindowAttributes(dpy, win, attr_flags, &attr); + } + + const char *title="NeL window"; + + XSizeHints size_hints; + size_hints.x = 0; + size_hints.y = 0; + size_hints.width = width; + size_hints.height = height; + size_hints.flags = PSize | PMinSize | PMaxSize; + size_hints.min_width = width; + size_hints.min_height = height; + size_hints.max_width = width; + size_hints.max_height = height; + +#ifdef X_HAVE_UTF8_STRING + Xutf8SetWMProperties (dpy, win, (char*)title, (char*)title, NULL, 0, &size_hints, NULL, NULL); +#else + XTextProperty text_property; + XStringListToTextProperty((char**)&title, 1, &text_property); + XSetWMProperties (dpy, win, &text_property, &text_property, 0, 0, &size_hints, 0, 0); +#endif + + glXMakeCurrent (dpy, win, ctx); + XMapRaised (dpy, win); + + XSelectInput (dpy, win, KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask|PointerMotionMask); + + XMapWindow(dpy, win); + + _EventEmitter.init (dpy, win); + +// XEvent event; +// XIfEvent(dpy, &event, WaitForNotify, (char *)this); + + setMode(mode); + +#endif // NL_OS_UNIX + + return setupDisplay(); +} + +#ifdef NL_OS_WINDOWS +// -------------------------------------------------- +// This code comes from MFC +static void modifyStyle (HWND hWnd, int nStyleOffset, LONG_PTR dwRemove, LONG_PTR dwAdd) +{ + H_AUTO_OGL(modifyStyle) + LONG_PTR dwStyle = ::GetWindowLongPtr(hWnd, nStyleOffset); + LONG_PTR dwNewStyle = (dwStyle & ~dwRemove) | dwAdd; + if (dwStyle == dwNewStyle) + return; + + ::SetWindowLongPtr(hWnd, nStyleOffset, dwNewStyle); +} +#endif + +// -------------------------------------------------- +void CDriverGL::switchBackToOldMode() +{ +#ifdef NL_OS_WINDOWS + ChangeDisplaySettings(&_OldScreenMode, 0); +#elif defined(XF86VIDMODE) + XF86VidModeModeInfo info; + nlinfo("3D: Switching back to original mode"); + + // This is UGLY + info.dotclock = _OldDotClock; + info.hdisplay = _OldScreenMode.hdisplay; + info.hsyncstart = _OldScreenMode.hsyncstart; + info.hsyncend = _OldScreenMode.hsyncend; + info.htotal = _OldScreenMode.htotal; + info.vdisplay = _OldScreenMode.vdisplay; + info.vsyncstart = _OldScreenMode.vsyncstart; + info.vsyncend = _OldScreenMode.vsyncend; + info.vtotal = _OldScreenMode.vtotal; + info.flags = _OldScreenMode.flags; + info.privsize = _OldScreenMode.privsize; + info.c_private = _OldScreenMode.c_private; + + nlinfo("3D: Switching back mode to %dx%d", info.hdisplay, info.vdisplay); + XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), &info); + nlinfo("3D: Switching back viewport to %d,%d",_OldX, _OldY); + XF86VidModeSetViewPort(dpy, DefaultScreen(dpy), _OldX, _OldY); +#endif // XF86VIDMODE +} + + +// -------------------------------------------------- +bool CDriverGL::setMode(const GfxMode& mode) +{ + H_AUTO_OGL(CDriverGL_setMode) +#ifdef NL_OS_WINDOWS + if (mode.Windowed) + { + if (_FullScreen) + { + switchBackToOldMode(); + modifyStyle(_hWnd, GWL_STYLE, WS_POPUP, WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS); + } + _WindowWidth = mode.Width; + _WindowHeight = mode.Height; + + } + else + { + // get old mode. + DEVMODE oldDevMode; + if (!_FullScreen) + { + oldDevMode.dmSize= sizeof(DEVMODE); + oldDevMode.dmDriverExtra= 0; + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &oldDevMode); + oldDevMode.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY ; + } + + // setup new mode + DEVMODE newDevMode; + newDevMode.dmSize= sizeof(DEVMODE); + newDevMode.dmDriverExtra= 0; + newDevMode.dmFields= DM_PELSWIDTH | DM_PELSHEIGHT; + newDevMode.dmPelsWidth= mode.Width; + newDevMode.dmPelsHeight= mode.Height; + + if(mode.Depth > 0) + { + newDevMode.dmBitsPerPel= mode.Depth; + newDevMode.dmFields |= DM_BITSPERPEL; + } + + if(mode.Frequency > 0) + { + newDevMode.dmDisplayFrequency= mode.Frequency; + newDevMode.dmFields |= DM_DISPLAYFREQUENCY; + } + + // try to really change the display mode + if (ChangeDisplaySettings(&newDevMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) + return false; + + // mode ok => copy changes + _WindowWidth = mode.Width; + _WindowHeight = mode.Height; + _Depth= mode.Depth; + // bkup user mode + if (!_FullScreen) + _OldScreenMode= oldDevMode; + + // if old mode was not fullscreen + if (!_FullScreen) + { + // Under the XP theme desktop, this function call the winproc WM_SIZE and change _WindowWidth and _WindowHeight + sint32 windowWidth = _WindowWidth; + sint32 windowHeight = _WindowHeight; + modifyStyle(_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW+WS_CLIPCHILDREN+WS_CLIPSIBLINGS, WS_POPUP); + _WindowWidth = windowWidth; + _WindowHeight = windowHeight; + } + } + + // Resize the window + RECT rc; + SetRect (&rc, 0, 0, _WindowWidth, _WindowHeight); + AdjustWindowRectEx (&rc, GetWindowStyle (_hWnd), false, GetWindowExStyle (_hWnd)); + UINT flags = SWP_NOZORDER | SWP_NOACTIVATE; + if (mode.Windowed) + flags |= SWP_NOMOVE; + SetWindowPos (_hWnd, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top, flags); + + showWindow(true); + + // Init Window Width and Height + RECT clientRect; + GetClientRect (_hWnd, &clientRect); + _WindowWidth = clientRect.right-clientRect.left; + _WindowHeight = clientRect.bottom-clientRect.top; + GetWindowRect (_hWnd, &clientRect); + _WindowX = clientRect.left; + _WindowY = clientRect.top; + _FullScreen = !mode.Windowed; + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + NL3D::MAC::setMode(mode); +#elif defined(NL_OS_UNIX) + +#ifdef XF86VIDMODE + if (!mode.Windowed) + { + // Store old mdoe in order to restore it when leaving fullscreen + if (mode.Windowed == _FullScreen) + { + memset(&_OldScreenMode, 0, sizeof(_OldScreenMode)); + XF86VidModeGetModeLine(dpy, DefaultScreen(dpy), &_OldDotClock, &_OldScreenMode); + XF86VidModeGetViewPort(dpy, DefaultScreen(dpy), &_OldX, &_OldY); + } + + // Find the requested mode and use it + XF86VidModeModeInfo **modes; + int nmodes; + if (XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &nmodes, &modes)) + { + for (int i = 0; i < nmodes; i++) + { + nldebug("3D: Available mode - %dx%d", modes[i]->hdisplay, modes[i]->vdisplay); + if(modes[i]->hdisplay == mode.Width && modes[i]->vdisplay == mode.Height) + { + if(XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), modes[i])) + { + nlinfo("3D: Switching to mode %dx%d", modes[i]->hdisplay, modes[i]->vdisplay); + XF86VidModeSetViewPort(dpy, DefaultScreen(dpy), 0, 0); + } + break; + } + } + } + } + else if (mode.Windowed == _FullScreen) + switchBackToOldMode(); +#endif // XF86VIDMODE + + // Update WM hints (update size and disallow resizing) + XSizeHints size_hints; + size_hints.x = 0; + size_hints.y = 0; + size_hints.width = mode.Width; + size_hints.height = mode.Height; + size_hints.flags = PSize; + + // x11 fullscreen is not working on mac os x +#if !defined(NL_OS_MAC) + if (!mode.Windowed) + { + size_hints.flags = PSize | PMinSize | PMaxSize; + size_hints.min_width = mode.Width; + size_hints.min_height = mode.Height; + size_hints.max_width = mode.Width; + size_hints.max_height = mode.Height; + } +#endif + + XSetWMNormalHints(dpy, win, &size_hints); + + // x11 fullscreen is not working on mac os x +#if !defined(NL_OS_MAC) + // Toggle fullscreen + if (mode.Windowed == _FullScreen) + { + XEvent xev; + memset(&xev, 0, sizeof(xev)); + xev.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", false); + xev.xclient.format = 32; + xev.xclient.data.l[0] = !mode.Windowed; + xev.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", false); + xev.xclient.data.l[2] = 0; + XSendEvent(dpy, DefaultRootWindow(dpy), false, SubstructureNotifyMask, &xev); + } +#endif + +#if !defined(NL_OS_MAC) + _FullScreen = !mode.Windowed; +#else + _FullScreen = false; +#endif + + // Resize and update the window + XResizeWindow(dpy, win, mode.Width, mode.Height); + XMapWindow(dpy, win); + +#endif // NL_OS_UNIX + return true; +} + +// -------------------------------------------------- +bool CDriverGL::getModes(std::vector &modes) +{ + H_AUTO_OGL(CDriverGL_getModes) +#ifdef NL_OS_WINDOWS + sint modeIndex = 0; + DEVMODE devMode; + while (EnumDisplaySettings (NULL, modeIndex, &devMode)) + { + // Keep only 16 and 32 bits + if ((devMode.dmBitsPerPel == 16 ) || (devMode.dmBitsPerPel == 32)) + { + // Add this mode + GfxMode mode; + mode.Width = (uint16)devMode.dmPelsWidth; + mode.Height = (uint16)devMode.dmPelsHeight; + mode.Depth = (uint8)devMode.dmBitsPerPel; + mode.Frequency = devMode.dmDisplayFrequency; + modes.push_back (mode); + } + + // Mode index + modeIndex++; + } +#elif defined(NL_OS_MAC) + getMacModes(modes); +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + +# ifdef XF86VIDMODE + int nmodes; + XF86VidModeModeInfo **ms; + Bool ok = XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &nmodes, &ms); + if(ok) + { + nldebug("3D: %d available modes:", nmodes); + for (int j = 0; j < nmodes; j++) + { + // Add this mode + GfxMode mode; + mode.Width = (uint16)ms[j]->hdisplay; + mode.Height = (uint16)ms[j]->vdisplay; + mode.Frequency = 1000 * ms[j]->dotclock / (ms[j]->htotal * ms[j]->vtotal); + nldebug("3D: Mode %d: %dx%d, %d Hz", j, ms[j]->hdisplay,ms[j]->vdisplay, 1000 * ms[j]->dotclock / (ms[j]->htotal * ms[j]->vtotal)); + modes.push_back (mode); + } + XFree(ms); + } + else + { + nlwarning("XF86VidModeGetAllModeLines returns 0, cannot get available video mode"); + return false; + } +# endif + +#endif + return true; +} + +// -------------------------------------------------- +bool CDriverGL::getCurrentScreenMode(GfxMode &mode) +{ + H_AUTO_OGL(CDriverGL_getCurrentScreenMode) +#ifdef NL_OS_WINDOWS + DEVMODE devmode; + devmode.dmSize= sizeof(DEVMODE); + devmode.dmDriverExtra= 0; + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode); + + mode.Windowed= !_FullScreen; + mode.OffScreen= false; + mode.Depth= (uint8)devmode.dmBitsPerPel; + mode.Frequency= devmode.dmDisplayFrequency, + mode.Width= (uint16)devmode.dmPelsWidth; + mode.Height= (uint16)devmode.dmPelsHeight; + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Temporary Mac Implementation" + nlwarning("OpenGL Driver: Temporary Mac Implementation"); + mode.Depth = 24; + +#elif defined(NL_OS_MAC) + /* + TODO this is just a hack to get the ryzom client running on mac os x x11. + the implementation below relies on the vidmode extension which is not + availeble on mac os x's x11. for that reason the color depth value is + hard coded here. + FIXME replace this hack by native cocoa color depth retrieval + */ + nlwarning("FIXME: returning hardcoded color depth of 24bit"); + mode.Depth= 24; + +#elif defined(NL_OS_UNIX) + +# ifdef XF86VIDMODE + sint pixelClock; + XF86VidModeModeLine xmode; + + if (!XF86VidModeGetModeLine(dpy, DefaultScreen(dpy), &pixelClock, &xmode)) + { + nlwarning("XF86VidModeGetModeLine returns 0, cannot get current video mode"); + return false; + } + + // x11 fullscreen is not working on mac os x +#if !defined(NL_OS_MAC) + mode.Windowed = !_FullScreen; +#else + mode.Windowed = true; +#endif + + mode.OffScreen = false; + mode.Depth = (uint) DefaultDepth(dpy, DefaultScreen(dpy)); + mode.Frequency = 1000 * pixelClock / (xmode.htotal * xmode.vtotal) ; + mode.Width = xmode.hdisplay; + mode.Height = xmode.vdisplay; + + nldebug("Current mode : %dx%d, %d Hz, %dbit", mode.Width, mode.Height, mode.Frequency, mode.Depth); +# endif + +#endif + return true; +} + +// -------------------------------------------------- +void CDriverGL::setWindowTitle(const ucstring &title) +{ +#ifdef NL_OS_WINDOWS + SetWindowTextW(_hWnd,(WCHAR*)title.c_str()); + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + NL3D::MAC::setWindowTitle(title); + +#elif defined (NL_OS_UNIX) + XTextProperty text_property; + char *t = (char*)title.toUtf8().c_str(); + XStringListToTextProperty(&t, 1, &text_property); + XSetWMName(dpy, win, &text_property); +#endif // NL_OS_WINDOWS +} + +// *************************************************************************** +void CDriverGL::setWindowPos(uint32 x, uint32 y) +{ + _WindowX = (sint32)x; + _WindowY = (sint32)y; +#ifdef NL_OS_WINDOWS + SetWindowPos(_hWnd, NULL, _WindowX, _WindowY, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + NL3D::MAC::setWindowPos(x, y); + +#elif defined (NL_OS_UNIX) + XMoveWindow(dpy, win, _WindowX, _WindowY); + +#endif // NL_OS_WINDOWS +} + +// *************************************************************************** +void CDriverGL::showWindow(bool show) +{ +#ifdef NL_OS_WINDOWS + ShowWindow (_hWnd, show ? SW_SHOW:SW_HIDE); +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + if (show) + XMapWindow(dpy, win); + else + XUnmapWindow(dpy, win); +#endif // NL_OS_WINDOWS +} + +// -------------------------------------------------- +emptyProc CDriverGL::getWindowProc() +{ + H_AUTO_OGL(CDriverGL_getWindowProc) +#ifdef NL_OS_WINDOWS + return (emptyProc)GlWndProc; +#else // NL_OS_WINDOWS + return NULL; +#endif // NL_OS_WINDOWS +} + +// -------------------------------------------------- +bool CDriverGL::activate() +{ + H_AUTO_OGL(CDriverGL_activate) +#ifdef NL_OS_WINDOWS + HGLRC hglrc=wglGetCurrentContext(); + + + if (hglrc!=_hRC) + { + wglMakeCurrent(_hDC,_hRC); + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Temporary Mac Implementation" + nlwarning("OpenGL Driver: Temporary Mac Implementation"); + + // already done in setDisplay, not needed here - unclean! FIXME + +#elif defined (NL_OS_UNIX) + GLXContext nctx=glXGetCurrentContext(); + if (nctx != NULL && nctx!=ctx) + { + glXMakeCurrent(dpy, win,ctx); + } +#endif // NL_OS_WINDOWS + return true; +} + +// -------------------------------------------------- +IDriver::TMessageBoxId CDriverGL::systemMessageBox (const char* message, const char* title, IDriver::TMessageBoxType type, TMessageBoxIcon icon) +{ + H_AUTO_OGL(CDriverGL_systemMessageBox) +#ifdef NL_OS_WINDOWS + switch (::MessageBox (NULL, message, title, ((type==retryCancelType)?MB_RETRYCANCEL: + (type==yesNoCancelType)?MB_YESNOCANCEL: + (type==okCancelType)?MB_OKCANCEL: + (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: + (type==yesNoType)?MB_YESNO|MB_ICONQUESTION:MB_OK)| + + ((icon==handIcon)?MB_ICONHAND: + (icon==questionIcon)?MB_ICONQUESTION: + (icon==exclamationIcon)?MB_ICONEXCLAMATION: + (icon==asteriskIcon)?MB_ICONASTERISK: + (icon==warningIcon)?MB_ICONWARNING: + (icon==errorIcon)?MB_ICONERROR: + (icon==informationIcon)?MB_ICONINFORMATION: + (icon==stopIcon)?MB_ICONSTOP:0))) + { + case IDOK: + return okId; + case IDCANCEL: + return cancelId; + case IDABORT: + return abortId; + case IDRETRY: + return retryId; + case IDIGNORE: + return ignoreId; + case IDYES: + return yesId; + case IDNO: + return noId; + } + nlstop; +#else // NL_OS_WINDOWS + // Call the console version! + IDriver::systemMessageBox (message, title, type, icon); +#endif // NL_OS_WINDOWS + return okId; +} + +// -------------------------------------------------- +void CDriverGL::showCursor(bool b) +{ + H_AUTO_OGL(CDriverGL_showCursor) +#ifdef NL_OS_WINDOWS + if (b) + { + while (ShowCursor(b) < 0) + ; + } + else + { + while (ShowCursor(b) >= 0) + ; + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + NL3D::MAC::showCursor(b); + +#elif defined (NL_OS_UNIX) + + if (b) + { + if (cursor != None) + { + XFreeCursor(dpy, cursor); + cursor = None; + } + XUndefineCursor(dpy, win); + } + else + { + if (cursor == None) + { + char bm_no_data[] = { 0,0,0,0, 0,0,0,0 }; + Pixmap pixmap_no_data = XCreateBitmapFromData (dpy, win, bm_no_data, 8, 8); + XColor black; + memset(&black, 0, sizeof (XColor)); + black.flags = DoRed | DoGreen | DoBlue; + cursor = XCreatePixmapCursor (dpy, pixmap_no_data, pixmap_no_data, &black, &black, 0, 0); + XFreePixmap(dpy, pixmap_no_data); + } + XDefineCursor(dpy, win, cursor); + } +#endif // NL_OS_UNIX +} + + +// -------------------------------------------------- +void CDriverGL::setMousePos(float x, float y) +{ + H_AUTO_OGL(CDriverGL_setMousePos) +#ifdef NL_OS_WINDOWS + if (_hWnd) + { + // NeL window coordinate to MSWindows coordinates + POINT pt; + pt.x = (int)((float)(_WindowWidth)*x); + pt.y = (int)((float)(_WindowHeight)*(1.0f-y)); + ClientToScreen (_hWnd, &pt); + SetCursorPos(pt.x, pt.y); + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + NL3D::MAC::setMousePos(x, y); + +#elif defined (NL_OS_UNIX) + XWindowAttributes xwa; + XGetWindowAttributes (dpy, win, &xwa); + int x1 = (int)(x * (float) xwa.width); + int y1 = (int)((1.0f - y) * (float) xwa.height); + XWarpPointer (dpy, None, win, None, None, None, None, x1, y1); +#endif // NL_OS_UNIX +} + +void CDriverGL::getWindowSize(uint32 &width, uint32 &height) +{ + H_AUTO_OGL(CDriverGL_getWindowSize) +#ifdef NL_OS_WINDOWS + // Off-srceen rendering ? + if (_OffScreen) + { + if (_PBuffer) + { + nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width ); + nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height ); + } + } + else + { + if (_hWnd) + { + width = (uint32)(_WindowWidth); + height = (uint32)(_WindowHeight); + } + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + NL3D::MAC::getWindowSize(width, height); + +#elif defined (NL_OS_UNIX) + XWindowAttributes xwa; + XGetWindowAttributes (dpy, win, &xwa); + width = (uint32) xwa.width; + height = (uint32) xwa.height; +#endif // NL_OS_UNIX +} + +void CDriverGL::getWindowPos(uint32 &x, uint32 &y) +{ + H_AUTO_OGL(CDriverGL_getWindowPos) +#ifdef NL_OS_WINDOWS + // Off-srceen rendering ? + if (_OffScreen) + { + if (_PBuffer) + { + x = y = 0; + } + } + else + { + if (_hWnd) + { + x = (uint32)(_WindowX); + y = (uint32)(_WindowY); + } + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + NL3D::MAC::getWindowPos(x, y); + +#elif defined (NL_OS_UNIX) + x = y = 0; +#endif // NL_OS_UNIX +} + +// -------------------------------------------------- +bool CDriverGL::isActive() +{ + H_AUTO_OGL(CDriverGL_isActive) +#ifdef NL_OS_WINDOWS + return (IsWindow(_hWnd) != 0); +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + // nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + +#endif // NL_OS_UNIX + return true; +} + +void CDriverGL::setCapture (bool b) +{ + H_AUTO_OGL(CDriverGL_setCapture ) + +#ifdef NL_OS_WINDOWS + + if (b) + { + RECT client; + GetClientRect (_hWnd, &client); + POINT pt1,pt2; + pt1.x = client.left; + pt1.y = client.top; + ClientToScreen (_hWnd, &pt1); + pt2.x = client.right; + pt2.y = client.bottom; + ClientToScreen (_hWnd, &pt2); + client.bottom = pt2.y; + client.top = pt1.y; + client.left = pt1.x; + client.right = pt2.x; + ClipCursor (&client); + } + else + ClipCursor (NULL); + + /* + if (b) + SetCapture (_hWnd); + else + ReleaseCapture (); + */ + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) + + NL3D::MAC::setCapture(b); + +#elif defined (NL_OS_UNIX) + + /* + TODO x11 funtion: setCapture + */ + + if(b) // capture the cursor. + { + XGrabPointer(dpy, win, True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime); + } + else // release the cursor. + { + XUngrabPointer(dpy, CurrentTime); + } + +#endif // NL_OS_UNIX +} + +// *************************************************************************** +NLMISC::IMouseDevice* CDriverGL::enableLowLevelMouse(bool enable, bool exclusive) +{ + H_AUTO_OGL(CDriverGL_enableLowLevelMouse) + +#ifdef NL_OS_WINDOWS + if (_EventEmitter.getNumEmitters() < 2) return NULL; + NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); + if (enable) + { + try + { + NLMISC::IMouseDevice *md = diee->getMouseDevice(exclusive); + return md; + } + catch (EDirectInput &) + { + return NULL; + } + } + else + { + diee->releaseMouse(); + return NULL; + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + +#endif + return NULL; +} + +// *************************************************************************** +NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable) +{ + H_AUTO_OGL(CDriverGL_enableLowLevelKeyboard) +#ifdef NL_OS_WINDOWS + if (_EventEmitter.getNumEmitters() < 2) return NULL; + NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); + if (enable) + { + try + { + NLMISC::IKeyboardDevice *md = diee->getKeyboardDevice(); + return md; + } + catch (EDirectInput &) + { + return NULL; + } + } + else + { + diee->releaseKeyboard(); + return NULL; + } +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + +#endif + return NULL; +} + +// *************************************************************************** +NLMISC::IInputDeviceManager* CDriverGL::getLowLevelInputDeviceManager() +{ + H_AUTO_OGL(CDriverGL_getLowLevelInputDeviceManager) +#ifdef NL_OS_WINDOWS + if (_EventEmitter.getNumEmitters() < 2) return NULL; + NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); + return diee; +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + +#endif + return NULL; +} + +// *************************************************************************** +uint CDriverGL::getDoubleClickDelay(bool hardwareMouse) +{ + H_AUTO_OGL(CDriverGL_getDoubleClickDelay) + +#ifdef NL_OS_WINDOWS + NLMISC::IMouseDevice *md = NULL; + if (_EventEmitter.getNumEmitters() >= 2) + { + NLMISC::CDIEventEmitter *diee = NLMISC::safe_cast(_EventEmitter.getEmitter(1)); + if (diee->isMouseCreated()) + { + try + { + md = diee->getMouseDevice(hardwareMouse); + } + catch (EDirectInput &) + { + // could not get device .. + } + } + } + if (md) + { + return md->getDoubleClickDelay(); + } + // try to read the good value from windows + return ::GetDoubleClickTime(); +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + +#elif defined (NL_OS_UNIX) + // TODO for Linux FIXME: FAKE FIX + return 250; +#endif +} + +// *************************************************************************** +bool CDriverGL::setMonitorColorProperties (const CMonitorColorProperties &properties) +{ + H_AUTO_OGL(CDriverGL_setMonitorColorProperties ) + +#ifdef NL_OS_WINDOWS + + // Get a DC + HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); + if (dc) + { + // The ramp + WORD ramp[256*3]; + + // For each composant + uint c; + for( c=0; c<3; c++ ) + { + uint i; + for( i=0; i<256; i++ ) + { + // Floating value + float value = (float)i / 256; + + // Contrast + value = (float) max (0.0f, (value-0.5f) * (float) pow (3.f, properties.Contrast[c]) + 0.5f ); + + // Gamma + value = (float) pow (value, (properties.Gamma[c]>0) ? 1 - 3 * properties.Gamma[c] / 4 : 1 - properties.Gamma[c] ); + + // Luminosity + value = value + properties.Luminosity[c] / 2.f; + ramp[i+(c<<8)] = (WORD)min ((int)65535, max (0, (int)(value * 65535))); + } + } + + // Set the ramp + bool result = SetDeviceGammaRamp (dc, ramp) != FALSE; + + // Release the DC + ReleaseDC (NULL, dc); + + // Returns result + return result; + } + else + { + nlwarning ("(CDriverGL::setMonitorColorProperties): can't create DC"); + return false; + } + +#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) +# warning "OpenGL Driver: Missing Mac Implementation" + nlwarning("OpenGL Driver: Missing Mac Implementation"); + return false; + +#elif defined (NL_OS_UNIX) + + // TODO for Linux: implement CDriverGL::setMonitorColorProperties + nlwarning ("CDriverGL::setMonitorColorProperties not implemented"); + return false; + +#endif +} + +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h index bc8ccf48e..4f89f97eb 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h @@ -55,6 +55,9 @@ bool init(uint windowIcon = 0, emptyProc exitFunc = 0); /// mac specific stuff while calling CDriverGL::setDisplay() bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable); +/// mac specific stuff while calling CDriverGL::setMode() +bool setMode(const GfxMode& mode); + /// mac specific stuff while calling CDriverGL::getWindowSize() void getWindowSize(uint32 &width, uint32 &height); @@ -70,10 +73,25 @@ void setWindowTitle(const ucstring &title); /// mac specific stuff while calling CDriverGL::swapBuffers() void swapBuffers(); +/// mac specific stuff while calling CDriverGL::setCapture() +void setCapture(bool b); + +/// mac specific stuff while calling CDriverGL::showCursor() +void showCursor(bool b); + +/// mac specific stuff while calling CDriverGL::setMousePos() +void setMousePos(float x, float y); + +/// mac specific stuff while calling CDriverGL::release() +void release(); + /// mac specific stuff while calling CCocoaEventEmitter::submitEvents() void submitEvents(NLMISC::CEventServer& server, bool allWindows, NLMISC::CCocoaEventEmitter* eventEmitter); +/// mac specific stuff while calling CCocoaEventEmitter::emulateMouseRawMode() +void emulateMouseRawMode(bool enable); + }} #endif diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm index a4eb72077..f01ce8e31 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm @@ -19,13 +19,14 @@ #include "cocoa_adapter.h" #include "nel/misc/events.h" +#include "nel/misc/game_device_events.h" #include "nel/3d/driver.h" #include "cocoa_event_emitter.h" #include "cocoa_opengl_view.h" #include "cocoa_window.h" -// virtual key codes are only defined here. we still do not need to link carbon +// Virtual key codes are only defined here. We still do not need to link carbon. // see: http://lists.apple.com/archives/Cocoa-dev/2009/May/msg01180.html #include @@ -33,16 +34,22 @@ namespace NL3D { namespace MAC { -static NSApplication* g_app = 0; -static NSAutoreleasePool* g_pool = 0; -static CocoaWindow* g_window = 0; -static CocoaOpenGLView* g_glview = 0; -static NSOpenGLContext* g_glctx = 0; +static NSApplication* g_app = nil; +static NSAutoreleasePool* g_pool = nil; +static CocoaWindow* g_window = nil; +static CocoaOpenGLView* g_glview = nil; +static NSOpenGLContext* g_glctx = nil; +static bool g_emulateRawMode = false; + + +#define UGLY_BACKBUFFER_SIZE_WORKAROUND + +#ifdef UGLY_BACKBUFFER_SIZE_WORKAROUND +static int g_bufferSize[2]; +#endif void ctor() { - nldebug("mac cpp bridge called"); - // create a pool, cocoa code would leak memory otherwise g_pool = [[NSAutoreleasePool alloc] init]; @@ -52,7 +59,9 @@ void ctor() void dtor() { - nldebug("mac cpp bridge called"); + /* + TODO there might be some more stuff to release ;) + */ // release the pool [g_pool release]; @@ -60,32 +69,51 @@ void dtor() bool init(uint windowIcon, emptyProc exitFunc) { - nldebug("mac cpp bridge called with %u %u", windowIcon, exitFunc); + /* + TODO nothing to do here? split other stuff to match api cleanly. + */ return true; } bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) { - nldebug("mac cpp bridge called with %u %u %u %u", wnd, &mode, show, resizeable); + /* + TODO use show + */ - // create a window - /* TODO: NSBackingStoreBuffered ??? */ - g_window = [[CocoaWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1024, 768) - styleMask:NSTitledWindowMask | NSResizableWindowMask | - NSClosableWindowMask | NSMiniaturizableWindowMask - backing:NSBackingStoreBuffered - defer:NO]; + /* + TODO add menu, on quit send EventDestroyWindowId + */ + unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | + NSMiniaturizableWindowMask; + + if(resizeable) + styleMask |= NSResizableWindowMask; + + // create a cocoa window with the size provided by the mode parameter + g_window = [[CocoaWindow alloc] + initWithContentRect:NSMakeRect(0, 0, mode.Width, mode.Height) + styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; + + if(!g_window) + nlerror("cannot create window"); + + /* + TODO use mode.Depth + TODO NSOpenGLPFAOffScreen + */ // setup opengl settings NSOpenGLPixelFormatAttribute att[] = { - NSOpenGLPFAWindow, NSOpenGLPFADoubleBuffer, - NSOpenGLPFAColorSize, 24, - NSOpenGLPFAAlphaSize, 8, - NSOpenGLPFADepthSize, 24, + NSOpenGLPFAColorSize, 24, + NSOpenGLPFADepthSize, 24, + NSOpenGLPFAAlphaSize, 8, + NSOpenGLPFAStencilSize, 8, NSOpenGLPFANoRecovery, NSOpenGLPFAAccelerated, + NSOpenGLPFABackingStore, 0 }; @@ -93,63 +121,323 @@ bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:att]; + if(!format) + nlerror("cannot create NSOpenGLPixelFormat"); + // create a opengl view with the created format g_glview = [[CocoaOpenGLView alloc] - initWithFrame:NSMakeRect(0, 0, 1024, 768) pixelFormat: format]; + initWithFrame:NSMakeRect(0, 0, 0, 0) pixelFormat: format]; + + if(!g_glview) + nlerror("cannot create view"); + + // put the view into the window + [g_window setContentView:g_glview]; + + // set the window to non transparent + [g_window setOpaque:YES]; + + // enable mouse move events, NeL wants them + [g_window setAcceptsMouseMovedEvents:YES]; + + // there are no overlapping subviews, so we can use the magical optimization! + [g_window useOptimizedDrawing:YES]; // create a opengl context for the view g_glctx = [g_glview openGLContext]; - // setup some stuff in the window - [g_window setContentView:g_glview]; - [g_window makeKeyAndOrderFront:nil]; - [g_window setAcceptsMouseMovedEvents:YES]; + if(!g_glctx) + nlerror("cannot create context"); - // make the views opengl context the currrent one + // make the view's opengl context the currrent one [g_glctx makeCurrentContext]; + // put the window to the front and make it the key window + [g_window makeKeyAndOrderFront:nil]; + + // this is our main window + [g_window makeMainWindow]; + // tell the application that we are running now [g_app finishLaunching]; // free the pixel format object [format release]; + // further mode setting, like switching to fullscreen and resolution setup + setMode(mode); + + return true; +} + +bool setMode(const GfxMode& mode) +{ + // for fullscreen mode, adjust the back buffer size to the desired resolution + if(!mode.Windowed) + { + // set the back buffer manually to match the desired rendering resolution + GLint dim[2] = { mode.Width, mode.Height }; + CGLError error = CGLSetParameter((CGLContextObj)[g_glctx CGLContextObj], + kCGLCPSurfaceBackingSize, dim); + + if(error != kCGLNoError) + nlerror("cannot set kCGLCPSurfaceBackingSize parameter (%s)", + CGLErrorString(error)); + } + + // leave fullscreen mode, enter windowed mode + if(mode.Windowed && [g_glview isInFullScreenMode]) + { + // disable manual setting of back buffer size, cocoa handles this + // automatically as soon as the view gets resized + CGLError error = CGLDisable((CGLContextObj)[g_glctx CGLContextObj], + kCGLCESurfaceBackingSize); + + if(error != kCGLNoError) + nlerror("cannot disable kCGLCESurfaceBackingSize (%s)", + CGLErrorString(error)); + + // pull the view back from fullscreen restoring window options + [g_glview exitFullScreenModeWithOptions:nil]; + } + + // enter fullscreen, leave windowed mode + else if(!mode.Windowed && ![g_glview isInFullScreenMode]) + { + // enable manual back buffer size for mode setting in fullscreen + CGLError error = CGLEnable((CGLContextObj)[g_glctx CGLContextObj], + kCGLCESurfaceBackingSize); + + if(error != kCGLNoError) + nlerror("cannot enable kCGLCESurfaceBackingSize (%s)", + CGLErrorString(error)); + + // put the view in fullscreen mode, hiding the dock but enabling the menubar + // to pop up if the mouse hits the top screen border. + // NOTE: withOptions:nil disables + application switching! + [g_glview enterFullScreenMode:[NSScreen mainScreen] withOptions: + [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithInt: + NSApplicationPresentationHideDock | + NSApplicationPresentationAutoHideMenuBar], + NSFullScreenModeApplicationPresentationOptions, nil]]; + + /* + TODO check if simply using NSView enterFullScreenMode is a good idea. + the context can be set to full screen as well, performance differences? + */ + } + +#ifdef UGLY_BACKBUFFER_SIZE_WORKAROUND + // due to a back buffer size reading problem, just store the size + g_bufferSize[0] = mode.Width; + g_bufferSize[1] = mode.Height; +#endif + return true; } void getWindowSize(uint32 &width, uint32 &height) { - NSRect rect = [g_glview bounds]; - width = rect.size.width; - height = rect.size.height; + if(!g_glctx) + return; + + // A cocoa fullscreen view stays at the native resolution of the display. + // When changing the rendering resolution, the size of the back buffer gets + // changed, but the view still stays at full resolution. So the scaling of + // the image from the rendered resolution to the view's resolution is done + // by cocoa automatically while flushing buffers. + // That's why, in fullscreen mode, return the resolution of the back buffer, + // not the one from the window. + +#ifdef UGLY_BACKBUFFER_SIZE_WORKAROUND + // in fullscreen mode + if([g_glview isInFullScreenMode]) + { + // use the size stored in setMode() + width = g_bufferSize[0]; + height = g_bufferSize[1]; + } + + // in windowed mode + else + { + // use the size of the view + NSRect rect = [g_glview frame]; + width = rect.size.width; + height = rect.size.height; + } +#else + /* + TODO does not work atm, "invalid enumeration" + */ + // check if manual back buffer sizing is enabled (thats only in fullscreen) + GLint surfaceBackingSizeSet = 0; + CGLError error = CGLIsEnabled((CGLContextObj)[g_glctx CGLContextObj], + kCGLCESurfaceBackingSize, &surfaceBackingSizeSet); + + if(error != kCGLNoError) + nlerror("cannot check kCGLCESurfaceBackingSize state (%s)", + CGLErrorString(error)); + + // if in fullscreen mode (only in fullscreen back buffer sizing is used) + if(surfaceBackingSizeSet) + { + /* + TODO does not work atm, "invalid enumeration" + */ + // get the back buffer size + GLint dim[2]; + CGLError error = CGLGetParameter((CGLContextObj)[g_glctx CGLContextObj], + kCGLCPSurfaceBackingSize, dim); + + if(error != kCGLNoError) + nlerror("cannot get kCGLCPSurfaceBackingSize value (%s)", + CGLErrorString(error)); + + // put size into ref params + width = dim[0]; + height = dim[1]; + } + + // if in windowed mode + else + { + // return the views size + NSRect rect = [g_glview frame]; + + // put size into ref params + width = rect.size.width; + height = rect.size.height; + } +#endif } void getWindowPos(uint32 &x, uint32 &y) { + // get the rect (position, size) of the screen NSRect screenRect = [[g_window screen] frame]; + + // get the rect (position, size) of the window NSRect windowRect = [g_window frame]; + + // simply return x x = windowRect.origin.x; + + // map y from cocoa to NeL coordinates before returning y = screenRect.size.height - windowRect.size.height - windowRect.origin.y; } void setWindowPos(uint32 x, uint32 y) { + // get the size of the screen NSRect screenRect = [[g_window screen] frame]; + + // get the size of the window NSRect windowRect = [g_window frame]; - y = screenRect.size.height - y; + + // convert y from NeL coordinates to cocoa coordinates + y = screenRect.size.height - y; + + // tell cocoa to move the window [g_window setFrameTopLeftPoint:NSMakePoint(x, y)]; } void setWindowTitle(const ucstring &title) { + // well... set the title of the window [g_window setTitle:[NSString stringWithUTF8String:title.toUtf8().c_str()]]; } void swapBuffers() { + // make cocoa draw buffer contents to the view [g_glctx flushBuffer]; } +void setCapture(bool b) +{ + // no need to capture +} + +void showCursor(bool b) +{ + // Mac OS manages a show/hide counter for the cursor, so hiding the cursor + // twice requires two calls to "show" to make the cursor visible again. + // Since other platforms seem to not do this, the functionality is masked here + // by only calling hide if the cursor is visible and only calling show if + // the cursor was hidden. + + CGDisplayErr error = kCGErrorSuccess; + static bool visible = true; + + if(b && !visible) + { + error = CGDisplayShowCursor(kCGDirectMainDisplay); + visible = true; + } + else if(!b && visible) + { + error = CGDisplayHideCursor(kCGDirectMainDisplay); + visible = false; + } + + if(error != kCGErrorSuccess) + nlerror("cannot capture / un-capture cursor"); +} + +void setMousePos(float x, float y) +{ + /* + TODO FIXME for windows placed on non primary monitor + */ + + // CG wants absolute coordinates related to screen top left + CGFloat fromScreenLeft = 0.0; + CGFloat fromScreenTop = 0.0; + + // get the gl view's rect for height and width + NSRect viewRect = [g_glview frame]; + + // if the view is not fullscreen, window top left is needed as offset + if(![g_glview isInFullScreenMode]) + { + // get the rect (position, size) of the screen + NSRect screenRect = [[g_window screen] frame]; + + // get the rect (position, size) of the window + NSRect windowRect = [g_window frame]; + + // window's x is ok + fromScreenLeft = windowRect.origin.x; + + // TODO this code assumes, that the view fills the window + + // map window bottom to view top + fromScreenTop = screenRect.size.height - + viewRect.size.height - windowRect.origin.y; + } + + // position inside the view + fromScreenLeft += (viewRect.size.width * x); + fromScreenTop += (viewRect.size.height * (1 - y)); + + // actually set the mouse position + CGDisplayErr error = CGDisplayMoveCursorToPoint( + kCGDirectMainDisplay, CGPointMake(fromScreenLeft, fromScreenTop)); + + if(error != kCGErrorSuccess) + nlerror("cannot set mouse position"); +} + +void release() +{ + /* + TODO release some stuff + */ + nlwarning("not implemented"); +} + /* TODO: this function has to be moved to a more central place to handle key mapping on mac x11 as well @@ -262,8 +550,8 @@ NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode) case kVK_RightArrow: return NLMISC::KeyRIGHT; case kVK_DownArrow: return NLMISC::KeyDOWN; case kVK_UpArrow: return NLMISC::KeyUP; - case kVK_Command:break; - case kVK_Option:break; + case kVK_Command:break; + case kVK_Option:break; case kVK_RightOption:break; case kVK_Function:break; case kVK_VolumeUp:break; @@ -296,7 +584,7 @@ NLMISC::TKeyButton modifierFlagsToNelKeyButton(unsigned int modifierFlags) bool isTextKeyEvent(NSEvent* event) { - // if there are no characters provided with this event, is is not a text event + // if there are no characters provided with this event, it is not a text event if([[event characters] length] == 0) return false; @@ -312,33 +600,33 @@ bool isTextKeyEvent(NSEvent* event) // get the character reported by cocoa unsigned int character = [[event characters] characterAtIndex:0]; - + // printable ascii characters if(isprint(character)) return true; - + /* - TODO check why iswprint(character) does not solve it. + TODO check why iswprint(character) does not solve it. it always returns false, even for Ï€, é, ... */ - // > 127 but not printable - if( nelKey == NLMISC::KeyF1 || nelKey == NLMISC::KeyF2 || - nelKey == NLMISC::KeyF3 || nelKey == NLMISC::KeyF4 || - nelKey == NLMISC::KeyF5 || nelKey == NLMISC::KeyF6 || - nelKey == NLMISC::KeyF7 || nelKey == NLMISC::KeyF8 || + // characters > 127 but not printable + if( nelKey == NLMISC::KeyF1 || nelKey == NLMISC::KeyF2 || + nelKey == NLMISC::KeyF3 || nelKey == NLMISC::KeyF4 || + nelKey == NLMISC::KeyF5 || nelKey == NLMISC::KeyF6 || + nelKey == NLMISC::KeyF7 || nelKey == NLMISC::KeyF8 || nelKey == NLMISC::KeyF9 || nelKey == NLMISC::KeyF10 || - nelKey == NLMISC::KeyF11 || nelKey == NLMISC::KeyF12 || - nelKey == NLMISC::KeyF13 || nelKey == NLMISC::KeyF14 || - nelKey == NLMISC::KeyF15 || nelKey == NLMISC::KeyF16 || - nelKey == NLMISC::KeyF17 || nelKey == NLMISC::KeyF18 || + nelKey == NLMISC::KeyF11 || nelKey == NLMISC::KeyF12 || + nelKey == NLMISC::KeyF13 || nelKey == NLMISC::KeyF14 || + nelKey == NLMISC::KeyF15 || nelKey == NLMISC::KeyF16 || + nelKey == NLMISC::KeyF17 || nelKey == NLMISC::KeyF18 || nelKey == NLMISC::KeyF19 || nelKey == NLMISC::KeyF20 || - nelKey == NLMISC::KeyUP || nelKey == NLMISC::KeyDOWN || + nelKey == NLMISC::KeyUP || nelKey == NLMISC::KeyDOWN || nelKey == NLMISC::KeyLEFT || nelKey == NLMISC::KeyRIGHT || nelKey == NLMISC::KeyHOME || nelKey == NLMISC::KeyEND || nelKey == NLMISC::KeyPRIOR || nelKey == NLMISC::KeyNEXT || nelKey == NLMISC::KeyDELETE) return false; - + // all the fancy wide characters if(character > 127) return true; @@ -346,6 +634,11 @@ bool isTextKeyEvent(NSEvent* event) return false; } +void emulateMouseRawMode(bool enable) +{ + g_emulateRawMode = enable; +} + void submitEvents(NLMISC::CEventServer& server, bool allWindows, NLMISC::CCocoaEventEmitter* eventEmitter) { @@ -354,7 +647,7 @@ void submitEvents(NLMISC::CEventServer& server, g_pool = [[NSAutoreleasePool alloc] init]; // we break if there was no event to handle - /* TODO maximum? */ + /* TODO maximum number of events processed in one update? */ while(true) { // get the next event to handle @@ -366,82 +659,173 @@ void submitEvents(NLMISC::CEventServer& server, if(!event) break; - // NSLog(@"%@", event); + // get the views size + NSRect rect = [g_glview frame]; - uint32 width, height; - /* TODO cache? */ - getWindowSize(width, height); + // TODO this code assumes, that the view fills the window + // convert the mouse position to NeL style (relative) + float mouseX = event.locationInWindow.x / (float)rect.size.width; + float mouseY = event.locationInWindow.y / (float)rect.size.height; - // get the mouse position in nel style (relative) - float mouseX = event.locationInWindow.x / (float)width; - float mouseY = event.locationInWindow.y / (float)height; + // if the mouse event was placed on the window's titlebar, don't tell NeL :) + if(mouseY > 1.0 && event.type != NSKeyDown && event.type != NSKeyUp) + { + [g_app sendEvent:event]; + [g_app updateWindows]; + continue; + } switch(event.type) { case NSLeftMouseDown: + { + /* + TODO modifiers with mouse events + */ server.postEvent(new NLMISC::CEventMouseDown( mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); + } break; case NSLeftMouseUp: + { + /* + TODO modifiers with mouse events + */ server.postEvent(new NLMISC::CEventMouseUp( mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); - break; + break; + } case NSRightMouseDown: + { + /* + TODO modifiers with mouse events + */ server.postEvent(new NLMISC::CEventMouseDown( mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); - break; + break; + } case NSRightMouseUp: + { + /* + TODO modifiers with mouse events + */ server.postEvent(new NLMISC::CEventMouseUp( mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); - break; + break; + } case NSMouseMoved: - server.postEvent(new NLMISC::CEventMouseMove( - mouseX, mouseY, (NLMISC::TMouseButton)0 /* modifiers */, eventEmitter)); - break; + { + /* + TODO modifiers with mouse events + */ + NLMISC::CEvent* nelEvent; + + // when emulating raw mode, send the delta in a CGDMouseMove event + if(g_emulateRawMode) + nelEvent = new NLMISC::CGDMouseMove( + eventEmitter, NULL /* no mouse device */, event.deltaX, -event.deltaY); + + // normally send position in a CEventMouseMove + else + nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, + (NLMISC::TMouseButton)0 /* modifiers */, eventEmitter); + + + server.postEvent(nelEvent); + break; + } case NSLeftMouseDragged: - server.postEvent(new NLMISC::CEventMouseMove( - mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); - break; - case NSRightMouseDragged:break; - server.postEvent(new NLMISC::CEventMouseMove( - mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); + { + /* + TODO modifiers with mouse events + */ + NLMISC::CEvent* nelEvent; + + // when emulating raw mode, send the delta in a CGDMouseMove event + if(g_emulateRawMode) + nelEvent = new NLMISC::CGDMouseMove( + eventEmitter, NULL /* no mouse device */, event.deltaX, -event.deltaY); + + // normally send position in a CEventMouseMove + else + nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, + NLMISC::leftButton /* modifiers */, eventEmitter); + + server.postEvent(nelEvent); + break; + } + case NSRightMouseDragged: + { + /* + TODO modifiers with mouse events + */ + NLMISC::CEvent* nelEvent; + + // when emulating raw mode, send the delta in a CGDMouseMove event + if(g_emulateRawMode) + nelEvent = new NLMISC::CGDMouseMove( + eventEmitter, NULL /* no mouse device */, event.deltaX, -event.deltaY); + + // normally send position in a CEventMouseMove + else + nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, + NLMISC::rightButton /* modifiers */, eventEmitter); + + server.postEvent(nelEvent); + break; + } case NSMouseEntered:break; case NSMouseExited:break; case NSKeyDown: - // push the key press event to the new event server + { + // push the key press event to the event server server.postEvent(new NLMISC::CEventKeyDown( - virtualKeycodeToNelKey([event keyCode]), - modifierFlagsToNelKeyButton([event modifierFlags]), - [event isARepeat] == NO, + virtualKeycodeToNelKey([event keyCode]), + modifierFlagsToNelKeyButton([event modifierFlags]), + [event isARepeat] == NO, eventEmitter)); - - if(isTextKeyEvent(event)) + + // if this was a text event + if(isTextKeyEvent(event)) { ucstring ucstr; // get the string associated with the key press event ucstr.fromUtf8([[event characters] UTF8String]); - // push to event server + // push the text event to event server as well server.postEvent(new NLMISC::CEventChar( - ucstr[0], - NLMISC::noKeyButton, + ucstr[0], + NLMISC::noKeyButton, eventEmitter)); } - break; + break; + } case NSKeyUp: + { + // push the key release event to the event server server.postEvent(new NLMISC::CEventKeyUp( - virtualKeycodeToNelKey([event keyCode]), - modifierFlagsToNelKeyButton([event modifierFlags]), + virtualKeycodeToNelKey([event keyCode]), + modifierFlagsToNelKeyButton([event modifierFlags]), eventEmitter)); - break; + break; + } case NSFlagsChanged:break; case NSAppKitDefined:break; case NSSystemDefined:break; case NSApplicationDefined:break; case NSPeriodic:break; case NSCursorUpdate:break; - case NSScrollWheel:break; + case NSScrollWheel: + { + /* + TODO modifiers with mouse events + */ + server.postEvent(new NLMISC::CEventMouseWheel( + mouseX, mouseY, (NLMISC::TMouseButton)0 /* modifiers */, + (event.deltaY > 0), eventEmitter)); + break; + } case NSTabletPoint:break; case NSTabletProximity:break; case NSOtherMouseDown:break; @@ -454,9 +838,11 @@ void submitEvents(NLMISC::CEventServer& server, case NSEventTypeBeginGesture:break; case NSEventTypeEndGesture:break; default: + { nlwarning("Unknown event type. dropping."); // NSLog(@"%@", event); - break; + break; + } } [g_app sendEvent:event]; diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp index 4cef1c3a4..81225ab9a 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp @@ -27,4 +27,10 @@ void CCocoaEventEmitter::submitEvents(CEventServer & server, bool allWindows) NL3D::MAC::submitEvents(server, allWindows, this); } +void CCocoaEventEmitter::emulateMouseRawMode(bool enable) +{ + // just forwarding to our cocoa adapter + NL3D::MAC::emulateMouseRawMode(enable); +} + } diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h index 5763d53df..b31272b8f 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h @@ -26,6 +26,7 @@ class CCocoaEventEmitter : public IEventEmitter { public: virtual void submitEvents(CEventServer & server, bool allWindows); + virtual void emulateMouseRawMode(bool enable); }; } diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h index 6557128e1..1ccc7e9e2 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h @@ -23,7 +23,7 @@ */ @interface CocoaOpenGLView : NSOpenGLView { - NSMutableAttributedString* backingStore; + NSMutableAttributedString* characterStorage; NSRange markedRange; } diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m index 0c816a4d4..c9c080dd6 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m @@ -24,7 +24,7 @@ { if(self = [super initWithFrame:frame]) { - backingStore = [[NSMutableAttributedString alloc] initWithString:@""]; + characterStorage = [[NSMutableAttributedString alloc] initWithString:@""]; return self; } return nil; @@ -32,9 +32,10 @@ - (void)dealloc { - [backingStore release]; + [characterStorage release]; [super dealloc]; } + -(BOOL)acceptsFirstResponder { return YES; @@ -77,13 +78,13 @@ if([aString length] == 0) { - [backingStore deleteCharactersInRange:replacementRange]; + [characterStorage deleteCharactersInRange:replacementRange]; [self unmarkText]; } else { markedRange = NSMakeRange(replacementRange.location, [aString length]); - [backingStore replaceCharactersInRange:replacementRange withString:aString]; + [characterStorage replaceCharactersInRange:replacementRange withString:aString]; } } @@ -102,7 +103,7 @@ -(NSAttributedString*)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { - return [backingStore attributedSubstringFromRange:aRange]; + return [characterStorage attributedSubstringFromRange:aRange]; } -(void)insertText:(id)aString @@ -111,7 +112,7 @@ if(replacementRange.location == NSNotFound) replacementRange = markedRange; - [backingStore replaceCharactersInRange:replacementRange withString:aString]; + [characterStorage replaceCharactersInRange:replacementRange withString:aString]; } -(NSUInteger)characterIndexForPoint:(NSPoint)aPoint diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index 0f131fcab..d2d8f5a66 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -29,7 +29,7 @@ namespace NLMISC { -CUnixEventEmitter::CUnixEventEmitter ():_dpy(NULL), _win(0), _PreviousKey(KeyNOKEY) +CUnixEventEmitter::CUnixEventEmitter ():_dpy(NULL), _win(0), _PreviousKey(KeyNOKEY), _emulateRawMode(false) { _im = 0; _ic = 0; @@ -83,6 +83,19 @@ void CUnixEventEmitter::submitEvents(CEventServer & server, bool allWindows) } } +void CUnixEventEmitter::emulateMouseRawMode(bool enable) +{ + _emulateRawMode = enable; + + if(_emulateRawMode) + { + XWindowAttributes xwa; + XGetWindowAttributes(_dpy, _win, &xwa); + XWarpPointer(_dpy, None, _win, None, None, None, None, + (xwa.width / 2), (xwa.height / 2)); + } +} + #ifndef AltMask # ifdef NL_OS_MAC # define AltMask (8192) @@ -120,6 +133,9 @@ TKey getKeyFromKeycode (uint keycode) switch (keycode) { #ifdef NL_OS_MAC + /* + TODO use key mapping from driver/opengl/mac/cocoa_adapter.mm + */ case 0x12: return Key1; case 0x13: return Key2; case 0x14: return Key3; @@ -162,10 +178,37 @@ TKey getKeyFromKeycode (uint keycode) case 0x31: return KeyAPOSTROPHE; case 0x33: return KeyBACKSLASH; case 0x5e: return KeyOEM_102; - case 0x3a: return KeyCOMMA; +// case 0x3a: return KeyCOMMA; case 0x3b: return KeyPERIOD; case 0x3c: return KeySLASH; case 0x3d: return KeyPARAGRAPH; + // for non-standard keyboards, maps to QWERTY keys + case 0x18: return KeyQ; + case 0x19: return KeyW; + case 0x1a: return KeyE; + case 0x1b: return KeyR; + case 0x1c: return KeyT; + case 0x1d: return KeyY; + case 0x1e: return KeyU; + case 0x1f: return KeyI; + case 0x20: return KeyO; + case 0x21: return KeyP; + case 0x26: return KeyQ; + case 0x27: return KeyS; + case 0x28: return KeyD; + case 0x29: return KeyF; + case 0x2a: return KeyG; + case 0x2b: return KeyH; + case 0x2c: return KeyJ; + case 0x2d: return KeyK; + case 0x2e: return KeyL; + case 0x34: return KeyZ; + case 0x35: return KeyX; + case 0x36: return KeyC; + case 0x37: return KeyV; + case 0x38: return KeyB; + case 0x39: return KeyN; + case 0x3a: return KeyM; #endif default: // nlwarning("missing keycode 0x%x %d '%c'", keycode, keycode, keycode); @@ -316,6 +359,9 @@ TKey getKeyFromKeySym (KeySym keysym) void CUnixEventEmitter::processMessage (XEvent &event, CEventServer &server) { + XWindowAttributes xwa; + XGetWindowAttributes (_dpy, _win, &xwa); + switch (event.type) { Case(ReparentNotify) @@ -325,8 +371,6 @@ void CUnixEventEmitter::processMessage (XEvent &event, CEventServer &server) Case(ButtonPress) { //nlinfo("%d %d %d", event.xbutton.button, event.xbutton.x, event.xbutton.y); - XWindowAttributes xwa; - XGetWindowAttributes (_dpy, _win, &xwa); float fX = (float) event.xbutton.x / (float) xwa.width; float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height; TMouseButton button=getMouseButton(event.xbutton.state); @@ -353,8 +397,6 @@ void CUnixEventEmitter::processMessage (XEvent &event, CEventServer &server) Case(ButtonRelease) { //nlinfo("%d %d %d", event.xbutton.button, event.xbutton.x, event.xbutton.y); - XWindowAttributes xwa; - XGetWindowAttributes (_dpy, _win, &xwa); float fX = (float) event.xbutton.x / (float) xwa.width; float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height; switch(event.xbutton.button) @@ -373,13 +415,36 @@ void CUnixEventEmitter::processMessage (XEvent &event, CEventServer &server) } Case(MotionNotify) { - XWindowAttributes xwa; - XGetWindowAttributes (_dpy, _win, &xwa); - float fX = (float) event.xbutton.x / (float) xwa.width; - float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height; - if ((fX == 0.5f) && (fY == 0.5f)) break; TMouseButton button=getMouseButton (event.xbutton.state); - server.postEvent (new CEventMouseMove (fX, fY, button, this)); + + // if raw mode should be emulated + if(_emulateRawMode) + { + // when we just wrapped back the pointer to 0.5 / 0.5, ignore event + if(event.xbutton.x == xwa.width / 2 && event.xbutton.y == xwa.height / 2) + break; + + // post a CGDMouseMove with the movement delta to the event server + server.postEvent( + new CGDMouseMove(this, NULL /* no mouse device */, + event.xbutton.x - (xwa.width / 2), + (xwa.height / 2) - event.xbutton.y)); + + // move the pointer back to the center of the window + XWarpPointer(_dpy, None, _win, None, None, None, None, + (xwa.width / 2), (xwa.height / 2)); + } + + // if in normal mouse mode + else + { + // get the relative mouse position + float fX = (float) event.xbutton.x / (float) xwa.width; + float fY = 1.0f - (float) event.xbutton.y / (float) xwa.height; + + // post a normal mouse move event to the event server + server.postEvent (new CEventMouseMove (fX, fY, button, this)); + } break; } Case(KeyPress) diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.h b/code/nel/src/3d/driver/opengl/unix_event_emitter.h index ea0dde021..45c5e868a 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.h +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.h @@ -22,6 +22,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/event_emitter.h" #include "nel/misc/events.h" +#include "nel/misc/game_device_events.h" #ifdef NL_OS_UNIX @@ -54,6 +55,8 @@ public: */ virtual void submitEvents(CEventServer & server, bool allWindows); + virtual void emulateMouseRawMode(bool); + public: void processMessage (XEvent &event, CEventServer &server); @@ -65,6 +68,7 @@ private: TKey _PreviousKey; XIM _im; XIC _ic; + bool _emulateRawMode; }; diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index 89a1d0197..255d3e4ed 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -34,6 +34,7 @@ #include "nel/3d/water_pool_manager.h" #include "nel/3d/u_camera.h" #include "nel/misc/hierarchical_timer.h" +#include "nel/misc/event_emitter.h" using namespace NLMISC; @@ -1594,6 +1595,11 @@ NLMISC::IKeyboardDevice *CDriverUser::enableLowLevelKeyboard(bool enable) return _Driver->enableLowLevelKeyboard(enable); } +void CDriverUser::emulateMouseRawMode(bool enable) +{ + _Driver->getEventEmitter()->emulateMouseRawMode(enable); +} + uint CDriverUser::getDoubleClickDelay(bool hardwareMouse) { NL3D_HAUTO_UI_DRIVER; diff --git a/code/nel/src/3d/flare_model.cpp b/code/nel/src/3d/flare_model.cpp index 27f26192c..67b8d963c 100644 --- a/code/nel/src/3d/flare_model.cpp +++ b/code/nel/src/3d/flare_model.cpp @@ -41,7 +41,7 @@ CVertexBuffer CFlareModel::_OcclusionQueryVB; using NLMISC::CVector; -//******************************************************************************************************************** +// ******************************************************************************************************************** CFlareModel::CFlareModel() { std::fill(_Intensity, _Intensity + MaxNumContext, 0.f); @@ -56,7 +56,7 @@ CFlareModel::CFlareModel() Next = NULL; } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::resetOcclusionQuerries() { for(uint k = 0; k < MaxNumContext; ++k) @@ -69,7 +69,7 @@ void CFlareModel::resetOcclusionQuerries() } } -//******************************************************************************************************************** +// ******************************************************************************************************************** CFlareModel::~CFlareModel() { // if driver hasn't changed, delete all querries @@ -92,7 +92,7 @@ CFlareModel::~CFlareModel() } } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::registerBasic() { // register the model @@ -117,7 +117,7 @@ static inline void vbWrite(uint8 *&dest, float uCoord, float vCoord) dest += 2 * sizeof(float); } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::traverseRender() { CRenderTrav &renderTrav = getOwnerScene()->getRenderTrav(); @@ -540,7 +540,7 @@ void CFlareModel::traverseRender() } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::initStatics() { if (!_OcclusionQuerySettuped) @@ -560,7 +560,7 @@ void CFlareModel::initStatics() } } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::updateOcclusionQueryBegin(IDriver *drv) { nlassert(drv); @@ -571,13 +571,13 @@ void CFlareModel::updateOcclusionQueryBegin(IDriver *drv) } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::updateOcclusionQueryEnd(IDriver *drv) { drv->setColorMask(true, true, true, true); } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::updateOcclusionQuery(IDriver *drv) { nlassert(drv); @@ -604,7 +604,7 @@ void CFlareModel::updateOcclusionQuery(IDriver *drv) oq->end(); } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::renderOcclusionMeshPrimitives(CMesh &mesh, IDriver &drv) { uint numMatrixBlock = mesh.getNbMatrixBlock(); @@ -620,7 +620,7 @@ void CFlareModel::renderOcclusionMeshPrimitives(CMesh &mesh, IDriver &drv) } } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::setupOcclusionMeshMatrix(IDriver &drv, CScene &scene) const { nlassert(Shape); @@ -638,7 +638,7 @@ void CFlareModel::setupOcclusionMeshMatrix(IDriver &drv, CScene &scene) const } } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::occlusionTest(CMesh &mesh, IDriver &drv) { nlassert(_Scene); @@ -676,7 +676,7 @@ void CFlareModel::occlusionTest(CMesh &mesh, IDriver &drv) drv.setColorMask(true, true, true, true); // restore pixel writes } -//******************************************************************************************************************** +// ******************************************************************************************************************** void CFlareModel::renderOcclusionTestMesh(IDriver &drv) { nlassert(_Scene); diff --git a/code/nel/src/3d/flare_shape.cpp b/code/nel/src/3d/flare_shape.cpp index daca909a3..a9d2001d7 100644 --- a/code/nel/src/3d/flare_shape.cpp +++ b/code/nel/src/3d/flare_shape.cpp @@ -28,7 +28,7 @@ namespace NL3D { -//*************************************************************************************************************** +// *************************************************************************************************************** CFlareShape::CFlareShape() : _Color(NLMISC::CRGBA::White), _DazzleColor(NLMISC::CRGBA::Black), _SizeDisappear(0.f), @@ -59,7 +59,7 @@ CFlareShape::CFlareShape() : _Color(NLMISC::CRGBA::White), } -//*************************************************************************************************************** +// *************************************************************************************************************** void CFlareShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // Version 4 : - added occlusion test mesh, size reduction, angle modification when object is occluded @@ -112,7 +112,7 @@ void CFlareShape::serial(NLMISC::IStream &f) throw(NLMISC::EStream) } } -//*************************************************************************************************************** +// *************************************************************************************************************** CTransformShape *CFlareShape::createInstance(CScene &scene) { CFlareModel *fm = NLMISC::safe_cast(scene.createModel(FlareModelClassId) ); @@ -123,7 +123,7 @@ CTransformShape *CFlareShape::createInstance(CScene &scene) return fm; } -//*************************************************************************************************************** +// *************************************************************************************************************** float CFlareShape::getNumTriangles (float distance) { float count = 0; @@ -134,7 +134,7 @@ float CFlareShape::getNumTriangles (float distance) return count; } -//*************************************************************************************************************** +// *************************************************************************************************************** bool CFlareShape::clip(const std::vector &pyramid, const CMatrix &worldMatrix) { // compute flare pos in world basis : @@ -150,7 +150,7 @@ bool CFlareShape::clip(const std::vector &pyramid, const CMatrix &wor return true; } -//*************************************************************************************************************** +// *************************************************************************************************************** void CFlareShape::getAABBox(NLMISC::CAABBox &bbox) const { // the flare himself is a point @@ -158,7 +158,7 @@ void CFlareShape::getAABBox(NLMISC::CAABBox &bbox) const bbox.setHalfSize(CVector::Null); } -//*************************************************************************************************************** +// *************************************************************************************************************** void CFlareShape::flushTextures (IDriver &driver, uint selectedTexture) { // Flush each texture @@ -175,7 +175,7 @@ void CFlareShape::flushTextures (IDriver &driver, uint selectedTexture) } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CFlareShape::setOcclusionTestMeshName(const std::string &shapeName) { if (shapeName == _OcclusionTestMeshName) return; @@ -184,7 +184,7 @@ void CFlareShape::setOcclusionTestMeshName(const std::string &shapeName) } -//*************************************************************************************************************** +// *************************************************************************************************************** CMesh *CFlareShape::getOcclusionTestMesh(CShapeBank &sb) { if (_OcclusionTestMesh) return _OcclusionTestMesh; diff --git a/code/nel/src/3d/landscape_user.cpp b/code/nel/src/3d/landscape_user.cpp index 8496ad74d..d2b0ca2ef 100644 --- a/code/nel/src/3d/landscape_user.cpp +++ b/code/nel/src/3d/landscape_user.cpp @@ -48,20 +48,20 @@ CLandscapeUser::~CLandscapeUser() } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setZonePath(const std::string &zonePath) { NL3D_HAUTO_UI_LANDSCAPE; _ZoneManager.setZonePath(zonePath); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::invalidateAllTiles() { _Landscape->Landscape.invalidateAllTiles(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::loadBankFiles(const std::string &tileBankFile, const std::string &farBankFile) { NL3D_HAUTO_LOAD_LANDSCAPE; @@ -89,7 +89,7 @@ void CLandscapeUser::loadBankFiles(const std::string &tileBankFile, const std::s farbankFile.close(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::flushTiles (NLMISC::IProgressCallback &progress) { @@ -147,7 +147,7 @@ void CLandscapeUser::flushTiles (NLMISC::IProgressCallback &progress) } } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::loadAllZonesAround(const CVector &pos, float radius, std::vector &zonesAdded) { @@ -189,7 +189,7 @@ void CLandscapeUser::loadAllZonesAround(const CVector &pos, float radius, std::v _Landscape->Landscape.checkBinds(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::refreshAllZonesAround(const CVector &pos, float radius, std::vector &zonesAdded, std::vector &zonesRemoved, NLMISC::IProgressCallback &progress, const std::vector *validZoneIds) { @@ -241,7 +241,7 @@ void CLandscapeUser::getAllZoneLoaded(std::vector &zoneLoaded) cons } } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::loadAllZonesAround(const CVector &pos, float radius) { std::vector dummy; @@ -249,7 +249,7 @@ void CLandscapeUser::loadAllZonesAround(const CVector &pos, float radius) } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius) { NL3D_HAUTO_LOAD_LANDSCAPE; @@ -257,7 +257,7 @@ void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius) std::string dummy1, dummy2; refreshZonesAround(pos, radius, dummy1, dummy2); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius, std::string &zoneAdded, std::string &zoneRemoved, const std::vector *validZoneIds) { NL3D_HAUTO_LOAD_LANDSCAPE; @@ -307,7 +307,7 @@ void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius, std::s _ZoneManager.checkZonesAround((uint)pos.x, (uint)(-pos.y), (uint)radius, validZoneIds); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::removeAllZones() { NL3D_HAUTO_LOAD_LANDSCAPE; @@ -349,7 +349,7 @@ void CLandscapeUser::removeAllZones() _ZoneManager.clear(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setupStaticLight (const CRGBA &diffuse, const CRGBA &ambiant, float multiply) { NL3D_HAUTO_UI_LANDSCAPE; @@ -358,37 +358,37 @@ void CLandscapeUser::setupStaticLight (const CRGBA &diffuse, const CRGBA &ambian -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setThreshold (float thre) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setThreshold(thre); } -//**************************************************************************** +// **************************************************************************** float CLandscapeUser::getThreshold () const { NL3D_HAUTO_UI_LANDSCAPE; return _Landscape->Landscape.getThreshold(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setTileNear (float tileNear) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setTileNear(tileNear); } -//**************************************************************************** +// **************************************************************************** float CLandscapeUser::getTileNear () const { NL3D_HAUTO_UI_LANDSCAPE; return _Landscape->Landscape.getTileNear(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setTileMaxSubdivision (uint tileDiv) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setTileMaxSubdivision(tileDiv); } -//**************************************************************************** +// **************************************************************************** uint CLandscapeUser::getTileMaxSubdivision () { NL3D_HAUTO_UI_LANDSCAPE; @@ -396,7 +396,7 @@ uint CLandscapeUser::getTileMaxSubdivision () } -//**************************************************************************** +// **************************************************************************** std::string CLandscapeUser::getZoneName(const CVector &pos) { NL3D_HAUTO_UI_LANDSCAPE; @@ -404,14 +404,14 @@ std::string CLandscapeUser::getZoneName(const CVector &pos) } -//**************************************************************************** +// **************************************************************************** CVector CLandscapeUser::getHeightFieldDeltaZ(float x, float y) const { NL3D_HAUTO_UI_LANDSCAPE; return _Landscape->Landscape.getHeightFieldDeltaZ(x,y); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setHeightField(const CHeightMap &hf) { NL3D_HAUTO_UI_LANDSCAPE; @@ -419,35 +419,35 @@ void CLandscapeUser::setHeightField(const CHeightMap &hf) } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::enableVegetable(bool enable) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.enableVegetable(enable); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::loadVegetableTexture(const std::string &textureFileName) { NL3D_HAUTO_LOAD_LANDSCAPE; _Landscape->Landscape.loadVegetableTexture(textureFileName); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setupVegetableLighting(const CRGBA &ambient, const CRGBA &diffuse, const CVector &directionalLight) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setupVegetableLighting(ambient, diffuse, directionalLight); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setVegetableWind(const CVector &windDir, float windFreq, float windPower, float windBendMin) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setVegetableWind(windDir, windFreq, windPower, windBendMin); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setVegetableUpdateLightingFrequency(float freq) { NL3D_HAUTO_UI_LANDSCAPE; @@ -455,7 +455,7 @@ void CLandscapeUser::setVegetableUpdateLightingFrequency(float freq) } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setUpdateLightingFrequency(float freq) { NL3D_HAUTO_UI_LANDSCAPE; @@ -463,57 +463,57 @@ void CLandscapeUser::setUpdateLightingFrequency(float freq) } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::enableAdditive (bool enable) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->enableAdditive(enable); } -//**************************************************************************** +// **************************************************************************** bool CLandscapeUser::isAdditiveEnabled () const { NL3D_HAUTO_UI_LANDSCAPE; return _Landscape->isAdditive (); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setPointLightDiffuseMaterial(CRGBA diffuse) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setPointLightDiffuseMaterial(diffuse); } -//**************************************************************************** +// **************************************************************************** CRGBA CLandscapeUser::getPointLightDiffuseMaterial () const { NL3D_HAUTO_UI_LANDSCAPE; return _Landscape->Landscape.getPointLightDiffuseMaterial(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::setDLMGlobalVegetableColor(CRGBA gvc) { NL3D_HAUTO_UI_LANDSCAPE; _Landscape->Landscape.setDLMGlobalVegetableColor(gvc); } -//**************************************************************************** +// **************************************************************************** CRGBA CLandscapeUser::getDLMGlobalVegetableColor() const { NL3D_HAUTO_UI_LANDSCAPE; return _Landscape->Landscape.getDLMGlobalVegetableColor(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::updateLightingAll() { NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL; _Landscape->Landscape.updateLightingAll(); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::postfixTileFilename (const char *postfix) { NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL; _Landscape->Landscape.TileBank.postfixTileFilename (postfix); } -//**************************************************************************** +// **************************************************************************** void CLandscapeUser::postfixTileVegetableDesc (const char *postfix) { NL3D_HAUTO_LANDSCAPE_UPDATE_LIGHTING_ALL; diff --git a/code/nel/src/3d/mesh.cpp b/code/nel/src/3d/mesh.cpp index e61522aaf..40cb58700 100644 --- a/code/nel/src/3d/mesh.cpp +++ b/code/nel/src/3d/mesh.cpp @@ -2429,7 +2429,7 @@ void CMesh::CMeshBuild::serial(NLMISC::IStream &f) throw(NLMISC::EStream) }*/ -//************************************ +// ************************************ CMesh::CMeshBuild::CMeshBuild() { for (uint k = 0; k < CVertexBuffer::MaxStage; ++k) diff --git a/code/nel/src/3d/nel-3d.pc.in b/code/nel/src/3d/nel-3d.pc.in index fe31bd8f8..ade3e2d08 100644 --- a/code/nel/src/3d/nel-3d.pc.in +++ b/code/nel/src/3d/nel-3d.pc.in @@ -4,8 +4,8 @@ libdir=@libdir@ includedir=@includedir@ Name: nel-3d -Version: @VERSION@ -Description: NeL @VERSION@ +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ Reqiures: Libs: -L${libdir} Libs.private: @LIBS@ @FREETYPE_LIBS@ -lc diff --git a/code/nel/src/3d/packed_world.cpp b/code/nel/src/3d/packed_world.cpp index 8a3acbb7c..1f23b65c5 100644 --- a/code/nel/src/3d/packed_world.cpp +++ b/code/nel/src/3d/packed_world.cpp @@ -27,7 +27,7 @@ namespace NL3D { -//************************************************************************************************* +// ************************************************************************************************* void CPackedWorld::build(std::vector &packedZones) { _ZoneGrid.clear(); @@ -77,7 +77,7 @@ void CPackedWorld::build(std::vector &packedZones) _RaytraceCounter = ~0; } -//************************************************************************************************* +// ************************************************************************************************* bool CPackedWorld::raytrace(const NLMISC::CVector &start, const NLMISC::CVector &end, CVector &inter, std::vector *testedTriangles /*= NULL*/, NLMISC::CVector *normal) { if (_ZoneGrid.empty()) return false; @@ -138,7 +138,7 @@ bool CPackedWorld::raytrace(const NLMISC::CVector &start, const NLMISC::CVector return false; } -//************************************************************************************************* +// ************************************************************************************************* void CPackedWorld::getZones(std::vector &zones) { zones.clear(); @@ -148,7 +148,7 @@ void CPackedWorld::getZones(std::vector &zones) } } -//************************************************************************************************* +// ************************************************************************************************* void CPackedWorld::serialZoneNames(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); @@ -156,7 +156,7 @@ void CPackedWorld::serialZoneNames(NLMISC::IStream &f) throw(NLMISC::EStream) f.serialCont(ZoneNames); } -//************************************************************************************************* +// ************************************************************************************************* void CPackedWorld::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { serialZoneNames(f); @@ -166,7 +166,7 @@ void CPackedWorld::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serial(_ZoneMinY); } -//************************************************************************************************* +// ************************************************************************************************* void CPackedWorld::select(const NLMISC::CPolygon2D &poly, std::vector &selectedTriangles) const { selectedTriangles.clear(); diff --git a/code/nel/src/3d/particle_system_process.cpp b/code/nel/src/3d/particle_system_process.cpp index 76d78f067..c36ec6c82 100644 --- a/code/nel/src/3d/particle_system_process.cpp +++ b/code/nel/src/3d/particle_system_process.cpp @@ -23,7 +23,7 @@ uint PSEnterLeaveDepth = 0; uint PSEnterLeaveMaxDepth = 1; std::string PSCurrName; -//*********************************************************************************************************** +// *********************************************************************************************************** CPSEnterLeave::CPSEnterLeave(const char *name) { ++ PSEnterLeaveDepth; @@ -35,7 +35,7 @@ CPSEnterLeave::CPSEnterLeave(const char *name) } } -//*********************************************************************************************************** +// *********************************************************************************************************** CPSEnterLeave::~CPSEnterLeave() { if (PSEnterLeaveDepth <= PSEnterLeaveMaxDepth) @@ -54,7 +54,7 @@ namespace NL3D { // CParticleSystemProcess implementation // ///////////////////////////////////////////// -//*********************************************************************************************************** +// *********************************************************************************************************** void CParticleSystemProcess::setOwner(CParticleSystem *ps) { NL_PS_FUNC(CParticleSystemProcess_setOwner) @@ -69,14 +69,14 @@ void CParticleSystemProcess::setOwner(CParticleSystem *ps) } -//*********************************************************************************************************** +// *********************************************************************************************************** uint CParticleSystemProcess::getUserMatrixUsageCount() const { NL_PS_FUNC(CParticleSystemProcess_getUserMatrixUsageCount) return _MatrixMode == PSUserMatrix; } -//*********************************************************************************************************** +// *********************************************************************************************************** void CParticleSystemProcess::setMatrixMode(TPSMatrixMode matrixMode) { NL_PS_FUNC(CParticleSystemProcess_setMatrixMode) @@ -90,7 +90,7 @@ void CParticleSystemProcess::setMatrixMode(TPSMatrixMode matrixMode) } -//*********************************************************************************************************** +// *********************************************************************************************************** CFontGenerator *CParticleSystemProcess::getFontGenerator(void) { NL_PS_FUNC(CParticleSystemProcess_getFontGenerator) @@ -98,7 +98,7 @@ CFontGenerator *CParticleSystemProcess::getFontGenerator(void) return _Owner->getFontGenerator(); } -//*********************************************************************************************************** +// *********************************************************************************************************** const CFontGenerator *CParticleSystemProcess::getFontGenerator(void) const { NL_PS_FUNC(CParticleSystemProcess_getFontGenerator) @@ -106,7 +106,7 @@ const CFontGenerator *CParticleSystemProcess::getFontGenerator(void) const return _Owner->getFontGenerator(); } -//*********************************************************************************************************** +// *********************************************************************************************************** CFontManager *CParticleSystemProcess::getFontManager(void) { NL_PS_FUNC(CParticleSystemProcess_getFontManager) @@ -114,7 +114,7 @@ CFontManager *CParticleSystemProcess::getFontManager(void) return _Owner->getFontManager(); } -//*********************************************************************************************************** +// *********************************************************************************************************** const CFontManager *CParticleSystemProcess::getFontManager(void) const { NL_PS_FUNC(CParticleSystemProcess_getFontManager) @@ -124,7 +124,7 @@ const CFontManager *CParticleSystemProcess::getFontManager(void) const -//*********************************************************************************************************** +// *********************************************************************************************************** void CParticleSystemProcess::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CParticleSystemProcess_serial) diff --git a/code/nel/src/3d/patch.cpp b/code/nel/src/3d/patch.cpp index 81aa3f42b..199202317 100644 --- a/code/nel/src/3d/patch.cpp +++ b/code/nel/src/3d/patch.cpp @@ -2293,7 +2293,7 @@ CTileElement *CPatch::getTileElement(const CUV &uv) return &(Tiles[ts+tt*OrderS]); } -//*************************************************************** +// *************************************************************** uint32 CPatch::countNumTriFar0() const { uint32 numIndex = MasterBlock.Far0FaceVector ? *MasterBlock.Far0FaceVector : 0; @@ -2311,7 +2311,7 @@ uint32 CPatch::countNumTriFar0() const return numIndex; } -//*************************************************************** +// *************************************************************** uint32 CPatch::countNumTriFar1() const { uint32 numIndex = MasterBlock.Far1FaceVector ? *MasterBlock.Far1FaceVector : 0; diff --git a/code/nel/src/3d/ps_attrib_maker_helper.cpp b/code/nel/src/3d/ps_attrib_maker_helper.cpp index 4e6c22d76..6c9a94baa 100644 --- a/code/nel/src/3d/ps_attrib_maker_helper.cpp +++ b/code/nel/src/3d/ps_attrib_maker_helper.cpp @@ -21,7 +21,7 @@ namespace NL3D { -//*********************************************************************************** +// *********************************************************************************** void CPSAttribMakerMemory::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { CPSAttribMakerMemoryBase::serial(f); @@ -39,7 +39,7 @@ void CPSAttribMakerMemory::serial(NLMISC::IStream &f) throw(NLMISC::EStr } } -//*********************************************************************************** +// *********************************************************************************** void CPSAttribMakerMemory::newElement(const CPSEmitterInfo &info) { CPSAttribMakerMemoryBase::newElement(info); @@ -54,7 +54,7 @@ void CPSAttribMakerMemory::newElement(const CPSEmitterInfo &info) } } -//*********************************************************************************** +// *********************************************************************************** void CPSAttribMakerMemory::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { CPSAttribMakerMemoryBase::serial(f); @@ -72,7 +72,7 @@ void CPSAttribMakerMemory::serial(NLMISC::IStream &f) throw(NLMISC::EStr } } -//*********************************************************************************** +// *********************************************************************************** void CPSAttribMakerMemory::newElement(const CPSEmitterInfo &info) { CPSAttribMakerMemoryBase::newElement(info); @@ -87,7 +87,7 @@ void CPSAttribMakerMemory::newElement(const CPSEmitterInfo &info) } } -//*********************************************************************************** +// *********************************************************************************** void CPSAttribMakerMemory::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { CPSAttribMakerMemoryBase::serial(f); @@ -105,7 +105,7 @@ void CPSAttribMakerMemory::serial(NLMISC::IStream &f) throw(NLMISC::EStre } } -//*********************************************************************************** +// *********************************************************************************** void CPSAttribMakerMemory::newElement(const CPSEmitterInfo &info) { CPSAttribMakerMemoryBase::newElement(info); diff --git a/code/nel/src/3d/ps_light.cpp b/code/nel/src/3d/ps_light.cpp index 6b90394a7..5c879742c 100644 --- a/code/nel/src/3d/ps_light.cpp +++ b/code/nel/src/3d/ps_light.cpp @@ -29,7 +29,7 @@ namespace NL3D { -//*************************************************************************************************************** +// *************************************************************************************************************** CPSLight::CPSLight() : _Color(CRGBA::White), _ColorScheme(NULL), _AttenStart(0.1f), @@ -40,7 +40,7 @@ CPSLight::CPSLight() : _Color(CRGBA::White), NL_PS_FUNC(CPSLight_CPSLight) } -//*************************************************************************************************************** +// *************************************************************************************************************** CPSLight::~CPSLight() { NL_PS_FUNC(CPSLight_CPSLight) @@ -67,7 +67,7 @@ CPSLight::~CPSLight() delete _AttenEndScheme; } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSLight_serial) @@ -134,14 +134,14 @@ void CPSLight::serial(NLMISC::IStream &f) throw(NLMISC::EStream) } } -//*************************************************************************************************************** +// *************************************************************************************************************** uint32 CPSLight::getType(void) const { NL_PS_FUNC(CPSLight_getType) return PSLight; } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::onShow(bool shown) { for(uint k = 0; k < _Lights.getSize(); ++k) @@ -160,7 +160,7 @@ void CPSLight::onShow(bool shown) } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::step(TPSProcessPass pass) { NL_PS_FUNC(CPSLight_step) @@ -287,7 +287,7 @@ void CPSLight::step(TPSProcessPass pass) } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::setColor(NLMISC::CRGBA color) { NL_PS_FUNC(CPSLight_setColor) @@ -296,7 +296,7 @@ void CPSLight::setColor(NLMISC::CRGBA color) _Color = color; } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::setColorScheme(CPSAttribMaker *scheme) { NL_PS_FUNC(CPSLight_setColorScheme) @@ -308,7 +308,7 @@ void CPSLight::setColorScheme(CPSAttribMaker *scheme) } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::setAttenStart(float radius) { NL_PS_FUNC(CPSLight_setAttenStart) @@ -318,7 +318,7 @@ void CPSLight::setAttenStart(float radius) _AttenStart = radius; } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::setAttenStartScheme(CPSAttribMaker *scheme) { NL_PS_FUNC(CPSLight_setAttenStartScheme) @@ -330,7 +330,7 @@ void CPSLight::setAttenStartScheme(CPSAttribMaker *scheme) } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::setAttenEnd(float radius) { NL_PS_FUNC(CPSLight_setAttenEnd) @@ -339,7 +339,7 @@ void CPSLight::setAttenEnd(float radius) _AttenEnd = radius; } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::setAttenEndScheme(CPSAttribMaker *scheme) { NL_PS_FUNC(CPSLight_setAttenEndScheme) @@ -351,7 +351,7 @@ void CPSLight::setAttenEndScheme(CPSAttribMaker *scheme) } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::newElement(const CPSEmitterInfo &info) { NL_PS_FUNC(CPSLight_newElement) @@ -361,7 +361,7 @@ void CPSLight::newElement(const CPSEmitterInfo &info) _Lights.insert(NULL); // instance is created during step() } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::deleteElement(uint32 index) { NL_PS_FUNC(CPSLight_deleteElement) @@ -376,7 +376,7 @@ void CPSLight::deleteElement(uint32 index) _Lights.remove(index); } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::resize(uint32 size) { NL_PS_FUNC(CPSLight_resize) @@ -387,7 +387,7 @@ void CPSLight::resize(uint32 size) _Lights.resize(size); } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::releaseAllRef() { NL_PS_FUNC(CPSLight_releaseAllRef) @@ -404,7 +404,7 @@ void CPSLight::releaseAllRef() } } -//*************************************************************************************************************** +// *************************************************************************************************************** void CPSLight::show() { NL_PS_FUNC(CPSLight_show) diff --git a/code/nel/src/3d/ps_located.cpp b/code/nel/src/3d/ps_located.cpp index a62162ab9..32816846e 100644 --- a/code/nel/src/3d/ps_located.cpp +++ b/code/nel/src/3d/ps_located.cpp @@ -56,7 +56,7 @@ CPSCollisionInfo *CPSLocated::_FirstCollision = NULL; -///*************************************************************************************** +/// *************************************************************************************** /** * Constructor */ @@ -81,7 +81,7 @@ CPSLocated::CPSLocated() : /*_MaxNumFaces(0),*/ } -//***************************************************************************************************** +// ***************************************************************************************************** const NLMISC::CMatrix &CPSLocated::getLocalToWorldMatrix() const { NL_PS_FUNC(CPSLocated_getLocalToWorldMatrix) @@ -98,7 +98,7 @@ const NLMISC::CMatrix &CPSLocated::getLocalToWorldMatrix() const return NLMISC::CMatrix::Identity; } -//***************************************************************************************************** +// ***************************************************************************************************** const NLMISC::CMatrix &CPSLocated::getWorldToLocalMatrix() const { NL_PS_FUNC(CPSLocated_getWorldToLocalMatrix) @@ -116,7 +116,7 @@ const NLMISC::CMatrix &CPSLocated::getWorldToLocalMatrix() const } -///*************************************************************************************** +/// *************************************************************************************** float CPSLocated::evalMaxDuration() const { NL_PS_FUNC(CPSLocated_evalMaxDuration) @@ -125,7 +125,7 @@ float CPSLocated::evalMaxDuration() const } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::checkIntegrity() const { NL_PS_FUNC(CPSLocated_checkIntegrity) @@ -147,7 +147,7 @@ void CPSLocated::checkIntegrity() const // } -///*************************************************************************************** +/// *************************************************************************************** bool CPSLocated::setLastForever() { NL_PS_FUNC(CPSLocated_setLastForever) @@ -168,7 +168,7 @@ bool CPSLocated::setLastForever() } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::systemDateChanged() { NL_PS_FUNC(CPSLocated_systemDateChanged) @@ -181,7 +181,7 @@ void CPSLocated::systemDateChanged() } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::releaseRefTo(const CParticleSystemProcess *other) { NL_PS_FUNC(CPSLocated_releaseRefTo) @@ -209,7 +209,7 @@ void CPSLocated::releaseRefTo(const CParticleSystemProcess *other) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::releaseAllRef() { NL_PS_FUNC(CPSLocated_releaseAllRef) @@ -241,7 +241,7 @@ void CPSLocated::releaseAllRef() } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::notifyMotionTypeChanged(void) { NL_PS_FUNC(CPSLocated_notifyMotionTypeChanged) @@ -254,7 +254,7 @@ void CPSLocated::notifyMotionTypeChanged(void) } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::integrateSingle(float startDate, float deltaT, uint numStep, uint32 indexInLocated, NLMISC::CVector *destPos, @@ -302,7 +302,7 @@ void CPSLocated::integrateSingle(float startDate, float deltaT, uint numStep, } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::performParametricMotion(TAnimationTime date) { NL_PS_FUNC(CPSLocated_performParametricMotion) @@ -340,7 +340,7 @@ void CPSLocated::performParametricMotion(TAnimationTime date) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** /// allocate parametric infos void CPSLocated::allocateParametricInfos(void) { @@ -364,7 +364,7 @@ void CPSLocated::allocateParametricInfos(void) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** /// release parametric infos void CPSLocated::releaseParametricInfos(void) { @@ -377,7 +377,7 @@ void CPSLocated::releaseParametricInfos(void) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** /// Test whether this located support parametric motion bool CPSLocated::supportParametricMotion(void) const { @@ -385,7 +385,7 @@ bool CPSLocated::supportParametricMotion(void) const return _NonIntegrableForceNbRefs == 0 && _NumIntegrableForceWithDifferentBasis == 0; } -///*************************************************************************************** +/// *************************************************************************************** /** When set to true, this tells the system to use parametric motion. This is needed in a few case only, * and can only work if all the forces that apply to the system are integrable */ @@ -405,7 +405,7 @@ void CPSLocated::enableParametricMotion(bool enable /*= true*/) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setMatrixMode(TPSMatrixMode matrixMode) { NL_PS_FUNC(CPSLocated_setMatrixMode) @@ -426,7 +426,7 @@ void CPSLocated::setMatrixMode(TPSMatrixMode matrixMode) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** /* void CPSLocated::notifyMaxNumFacesChanged(void) { @@ -448,7 +448,7 @@ void CPSLocated::notifyMaxNumFacesChanged(void) } */ -///*************************************************************************************** +/// *************************************************************************************** uint CPSLocated::getNumWantedTris() const { NL_PS_FUNC(CPSLocated_getNumWantedTris) @@ -488,7 +488,7 @@ bool CPSLocated::hasParticles(void) const return false; } -///*************************************************************************************** +/// *************************************************************************************** /// tells whether there are alive emitters bool CPSLocated::hasEmitters(void) const { @@ -502,7 +502,7 @@ bool CPSLocated::hasEmitters(void) const return false; } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::getLODVect(NLMISC::CVector &v, float &offset, TPSMatrixMode matrixMode) { NL_PS_FUNC(CPSLocated_getLODVect) @@ -512,7 +512,7 @@ void CPSLocated::getLODVect(NLMISC::CVector &v, float &offset, TPSMatrixMode mat CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** float CPSLocated::getUserParam(uint numParam) const { NL_PS_FUNC(CPSLocated_getUserParam) @@ -521,7 +521,7 @@ float CPSLocated::getUserParam(uint numParam) const return _Owner->getUserParam(numParam); } -///*************************************************************************************** +/// *************************************************************************************** CScene *CPSLocated::getScene(void) { NL_PS_FUNC(CPSLocated_getScene) @@ -530,7 +530,7 @@ CScene *CPSLocated::getScene(void) return _Owner->getScene(); } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::incrementNbDrawnParticles(uint num) { NL_PS_FUNC(CPSLocated_incrementNbDrawnParticles) @@ -538,7 +538,7 @@ void CPSLocated::incrementNbDrawnParticles(uint num) CParticleSystem::NbParticlesDrawn += num; // for benchmark purpose } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setInitialLife(TAnimationTime lifeTime) { NL_PS_FUNC(CPSLocated_setInitialLife) @@ -563,7 +563,7 @@ void CPSLocated::setInitialLife(TAnimationTime lifeTime) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setLifeScheme(CPSAttribMaker *scheme) { NL_PS_FUNC(CPSLocated_setLifeScheme) @@ -581,7 +581,7 @@ void CPSLocated::setLifeScheme(CPSAttribMaker *scheme) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setInitialMass(float mass) { NL_PS_FUNC(CPSLocated_setInitialMass) @@ -592,7 +592,7 @@ void CPSLocated::setInitialMass(float mass) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setMassScheme(CPSAttribMaker *scheme) { NL_PS_FUNC(CPSLocated_setMassScheme) @@ -604,7 +604,7 @@ void CPSLocated::setMassScheme(CPSAttribMaker *scheme) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** /// get a matrix that helps to express located B coordinate in located A basis const NLMISC::CMatrix &CPSLocated::getConversionMatrix(const CParticleSystem &ps, TPSMatrixMode destMode, TPSMatrixMode srcMode) { @@ -648,7 +648,7 @@ const NLMISC::CMatrix &CPSLocated::getConversionMatrix(const CParticleSystem &ps return NLMISC::CMatrix::Identity; } -///*************************************************************************************** +/// *************************************************************************************** NLMISC::CVector CPSLocated::computeI(void) const { NL_PS_FUNC(CPSLocated_computeI) @@ -679,7 +679,7 @@ NLMISC::CVector CPSLocated::computeI(void) const } } -///*************************************************************************************** +/// *************************************************************************************** NLMISC::CVector CPSLocated::computeIWithZAxisAligned(void) const { NL_PS_FUNC(CPSLocated_computeIWithZAxisAligned) @@ -713,7 +713,7 @@ NLMISC::CVector CPSLocated::computeIWithZAxisAligned(void) const } } -///*************************************************************************************** +/// *************************************************************************************** NLMISC::CVector CPSLocated::computeJ(void) const { NL_PS_FUNC(CPSLocated_computeJ) @@ -744,7 +744,7 @@ NLMISC::CVector CPSLocated::computeJ(void) const } } -///*************************************************************************************** +/// *************************************************************************************** NLMISC::CVector CPSLocated::computeK(void) const { NL_PS_FUNC(CPSLocated_computeK) @@ -776,7 +776,7 @@ NLMISC::CVector CPSLocated::computeK(void) const } } -///*************************************************************************************** +/// *************************************************************************************** NLMISC::CVector CPSLocated::computeKWithZAxisAligned(void) const { NL_PS_FUNC(CPSLocated_computeKWithZAxisAligned) @@ -807,7 +807,7 @@ NLMISC::CVector CPSLocated::computeKWithZAxisAligned(void) const } } -///*************************************************************************************** +/// *************************************************************************************** IDriver *CPSLocated::getDriver() const { NL_PS_FUNC(CPSLocated_getDriver) @@ -817,7 +817,7 @@ IDriver *CPSLocated::getDriver() const return _Owner->getDriver(); } -///*************************************************************************************** +/// *************************************************************************************** /// dtor CPSLocated::~CPSLocated() { @@ -852,7 +852,7 @@ CPSLocated::~CPSLocated() CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** /** * sorted insertion (by decreasing priority order) of a bindable (particle e.g an aspect, emitter) in a located */ @@ -915,7 +915,7 @@ bool CPSLocated::bind(CPSLocatedBindable *lb) return true; } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::remove(const CPSLocatedBindable *p) { NL_PS_FUNC(CPSLocated_remove) @@ -932,7 +932,7 @@ void CPSLocated::remove(const CPSLocatedBindable *p) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::registerDtorObserver(CPSLocatedBindable *anObserver) { NL_PS_FUNC(CPSLocated_registerDtorObserver) @@ -943,7 +943,7 @@ void CPSLocated::registerDtorObserver(CPSLocatedBindable *anObserver) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::unregisterDtorObserver(CPSLocatedBindable *anObserver) { NL_PS_FUNC(CPSLocated_unregisterDtorObserver) @@ -956,7 +956,7 @@ void CPSLocated::unregisterDtorObserver(CPSLocatedBindable *anObserver) } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::postNewElement(const NLMISC::CVector &pos, const NLMISC::CVector &speed, CPSLocated &emitterLocated, @@ -1028,7 +1028,7 @@ void CPSLocated::postNewElement(const NLMISC::CVector &pos, } -///*************************************************************************************** +/// *************************************************************************************** sint32 CPSLocated::newElement(const CPSSpawnInfo &si, bool doEmitOnce /* = false */, TAnimationTime ellapsedTime) { NL_PS_FUNC(CPSLocated_newElement) @@ -1236,7 +1236,7 @@ sint32 CPSLocated::newElement(const CPSSpawnInfo &si, bool doEmitOnce /* = false } -///*************************************************************************************** +/// *************************************************************************************** sint32 CPSLocated::newElement(const CVector &pos, const CVector &speed, CPSLocated *emitter, uint32 indexInEmitter, TPSMatrixMode speedCoordSystem, bool doEmitOnce /* = false */) { @@ -1265,7 +1265,7 @@ sint32 CPSLocated::newElement(const CVector &pos, const CVector &speed, CPSLocat } -///*************************************************************************************** +/// *************************************************************************************** static inline uint32 IDToLittleEndian(uint32 input) { NL_PS_FUNC(IDToLittleEndian) @@ -1279,7 +1279,7 @@ static inline uint32 IDToLittleEndian(uint32 input) #endif } -///*************************************************************************************** +/// *************************************************************************************** inline void CPSLocated::deleteElementBase(uint32 index) { NL_PS_FUNC(CPSLocated_deleteElementBase) @@ -1316,7 +1316,7 @@ inline void CPSLocated::deleteElementBase(uint32 index) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::deleteElement(uint32 index) { NL_PS_FUNC(CPSLocated_deleteElement) @@ -1336,7 +1336,7 @@ void CPSLocated::deleteElement(uint32 index) } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::deleteElement(uint32 index, TAnimationTime timeToNextSimStep) { NL_PS_FUNC(CPSLocated_deleteElement) @@ -1355,7 +1355,7 @@ void CPSLocated::deleteElement(uint32 index, TAnimationTime timeToNextSimStep) } /// Resize the located container -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::resize(uint32 newSize) { NL_PS_FUNC(CPSLocated_resize) @@ -1417,7 +1417,7 @@ public: }; }; -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSLocated_serial) @@ -1636,7 +1636,7 @@ void CPSLocated::serial(NLMISC::IStream &f) throw(NLMISC::EStream) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** // integrate speed of particles. Makes eventually use of SSE instructions when present static void IntegrateSpeed(uint count, float *src1, const float *src2, float *dest, float ellapsedTime) { @@ -1767,7 +1767,7 @@ static void IntegrateSpeed(uint count, float *src1, const float *src2, float *de } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::computeMotion() { NL_PS_FUNC(CPSLocated_computeMotion) @@ -1797,7 +1797,7 @@ void CPSLocated::computeMotion() -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::computeNewParticleMotion(uint firstInstanceIndex) { NL_PS_FUNC(CPSLocated_computeNewParticleMotion) @@ -1806,7 +1806,7 @@ void CPSLocated::computeNewParticleMotion(uint firstInstanceIndex) computeCollisions(firstInstanceIndex, &CParticleSystem::_SpawnPos[0], &_Pos[0]); } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::resetCollisions(uint numInstances) { NL_PS_FUNC(CPSLocated_resetCollisions) @@ -1828,7 +1828,7 @@ void CPSLocated::resetCollisions(uint numInstances) } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::updateCollisions() { NL_PS_FUNC(CPSLocated_updateCollisions) @@ -1908,7 +1908,7 @@ void CPSLocated::updateCollisions() } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::doLODDegradation() { NL_PS_FUNC(CPSLocated_doLODDegradation) @@ -1940,7 +1940,7 @@ void CPSLocated::doLODDegradation() CParticleSystem::InsideRemoveLoop = false; } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::step(TPSProcessPass pass) { NL_PS_FUNC(CPSLocated_step) @@ -1989,7 +1989,7 @@ void CPSLocated::step(TPSProcessPass pass) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::updateLife() { NL_PS_FUNC(CPSLocated_updateLife) @@ -2086,7 +2086,7 @@ void CPSLocated::updateLife() } -///*************************************************************************************** +/// *************************************************************************************** // When a particle is deleted, it is replaced by the last particle in the array // if this particle is to be deleted to, must update its new index static inline void removeParticleFromRemoveList(uint indexToRemove, uint arraySize) @@ -2131,7 +2131,7 @@ void checkRemoveArray(uint size) } -///*************************************************************************************** +/// *************************************************************************************** #ifndef NL_DEBUG inline #endif @@ -2150,7 +2150,7 @@ TAnimationTime CPSLocated::computeDateFromCollisionToNextSimStep(uint particleIn return std::max(0.f, result); } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::removeOldParticles() { NL_PS_FUNC(CPSLocated_removeOldParticles) @@ -2360,7 +2360,7 @@ void CPSLocated::removeOldParticles() #endif } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::addNewlySpawnedParticles() { NL_PS_FUNC(CPSLocated_addNewlySpawnedParticles) @@ -2418,7 +2418,7 @@ void CPSLocated::addNewlySpawnedParticles() #endif } -///*************************************************************************************** +/// *************************************************************************************** bool CPSLocated::computeBBox(NLMISC::CAABBox &box) const { NL_PS_FUNC(CPSLocated_computeBBox) @@ -2478,7 +2478,7 @@ bool CPSLocated::computeBBox(NLMISC::CAABBox &box) const /// Setup the driver model matrix. It is set accordingly to the basis used for rendering -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setupDriverModelMatrix(void) { NL_PS_FUNC(CPSLocated_setupDriverModelMatrix) @@ -2487,7 +2487,7 @@ void CPSLocated::setupDriverModelMatrix(void) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::queryCollisionInfo(void) { NL_PS_FUNC(CPSLocated_queryCollisionInfo) @@ -2509,7 +2509,7 @@ void CPSLocated::queryCollisionInfo(void) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::releaseCollisionInfo(void) { NL_PS_FUNC(CPSLocated_releaseCollisionInfo) @@ -2527,7 +2527,7 @@ void CPSLocated::releaseCollisionInfo(void) -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::registerIntegrableForce(CPSForce *f) { NL_PS_FUNC(CPSLocated_registerIntegrableForce) @@ -2543,7 +2543,7 @@ void CPSLocated::registerIntegrableForce(CPSForce *f) } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::unregisterIntegrableForce(CPSForce *f) { NL_PS_FUNC(CPSLocated_unregisterIntegrableForce) @@ -2559,7 +2559,7 @@ void CPSLocated::unregisterIntegrableForce(CPSForce *f) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::addNonIntegrableForceRef(void) { NL_PS_FUNC(CPSLocated_addNonIntegrableForceRef) @@ -2569,7 +2569,7 @@ void CPSLocated::addNonIntegrableForceRef(void) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::releaseNonIntegrableForceRef(void) { NL_PS_FUNC(CPSLocated_releaseNonIntegrableForceRef) @@ -2580,7 +2580,7 @@ void CPSLocated::releaseNonIntegrableForceRef(void) } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::integrableForceBasisChanged(TPSMatrixMode matrixMode) { NL_PS_FUNC(CPSLocated_integrableForceBasisChanged) @@ -2598,7 +2598,7 @@ void CPSLocated::integrableForceBasisChanged(TPSMatrixMode matrixMode) } -///*************************************************************************************** +/// *************************************************************************************** CPSLocatedBindable *CPSLocated::unbind(uint index) { NL_PS_FUNC(CPSLocated_unbind) @@ -2611,7 +2611,7 @@ CPSLocatedBindable *CPSLocated::unbind(uint index) CHECK_PS_INTEGRITY } -///*************************************************************************************** +/// *************************************************************************************** bool CPSLocated::isBound(const CPSLocatedBindable *lb) const { NL_PS_FUNC(CPSLocated_isBound) @@ -2620,7 +2620,7 @@ bool CPSLocated::isBound(const CPSLocatedBindable *lb) const return it != _LocatedBoundCont.end(); } -///*************************************************************************************** +/// *************************************************************************************** uint CPSLocated::getIndexOf(const CPSLocatedBindable *lb) const { NL_PS_FUNC(CPSLocated_getIndexOf) @@ -2640,14 +2640,14 @@ uint CPSLocated::getIndexOf(const CPSLocatedBindable *lb) const /////////////////////////////////////// -///*************************************************************************************** +/// *************************************************************************************** CPSLocatedBindable::CPSLocatedBindable() : _Owner(NULL), _ExternID(0), _LOD(PSLod1n2), _Active(true) { NL_PS_FUNC(CPSLocatedBindable_CPSLocatedBindable) _Owner = NULL; } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::setOwner(CPSLocated *psl) { NL_PS_FUNC(CPSLocatedBindable_setOwner) @@ -2675,7 +2675,7 @@ void CPSLocatedBindable::setOwner(CPSLocated *psl) } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::finalize(void) { NL_PS_FUNC(CPSLocatedBindable_finalize) @@ -2685,7 +2685,7 @@ void CPSLocatedBindable::finalize(void) } } -///*************************************************************************************** +/// *************************************************************************************** CPSLocatedBindable::~CPSLocatedBindable() { NL_PS_FUNC(CPSLocatedBindable_CPSLocatedBindableDtor) @@ -2698,14 +2698,14 @@ CPSLocatedBindable::~CPSLocatedBindable() } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::notifyTargetRemoved(CPSLocated *ptr) { NL_PS_FUNC(CPSLocatedBindable_notifyTargetRemoved) ptr->unregisterDtorObserver(this); } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSLocatedBindable_IStream ) @@ -2742,7 +2742,7 @@ void CPSLocatedBindable::serial(NLMISC::IStream &f) throw(NLMISC::EStream) } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::displayIcon2d(const CVector tab[], uint nbSegs, float scale) { NL_PS_FUNC(CPSLocatedBindable_displayIcon2d) @@ -2796,7 +2796,7 @@ void CPSLocatedBindable::displayIcon2d(const CVector tab[], uint nbSegs, float s } -///*************************************************************************************** +/// *************************************************************************************** CFontManager *CPSLocatedBindable::getFontManager(void) { NL_PS_FUNC(CPSLocatedBindable_getFontManager) @@ -2804,7 +2804,7 @@ CFontManager *CPSLocatedBindable::getFontManager(void) return _Owner->getFontManager(); } -///*************************************************************************************** +/// *************************************************************************************** /// Shortcut to get the font manager if one was set (const version) const CFontManager *CPSLocatedBindable::getFontManager(void) const { @@ -2814,7 +2814,7 @@ const CFontManager *CPSLocatedBindable::getFontManager(void) const } -///*************************************************************************************** +/// *************************************************************************************** // Shortcut to get the matrix of the system const NLMISC::CMatrix &CPSLocatedBindable::getSysMat(void) const { @@ -2823,7 +2823,7 @@ const CFontManager *CPSLocatedBindable::getFontManager(void) const return _Owner->getOwner()->getSysMat(); } - ///*************************************************************************************** + /// *************************************************************************************** /// shortcut to get the inverted matrix of the system const NLMISC::CMatrix &CPSLocatedBindable::getInvertedSysMat(void) const { @@ -2833,7 +2833,7 @@ const NLMISC::CMatrix &CPSLocatedBindable::getInvertedSysMat(void) const } -///*************************************************************************************** +/// *************************************************************************************** /// shortcut to get the view matrix const NLMISC::CMatrix &CPSLocatedBindable::getViewMat(void) const { @@ -2843,7 +2843,7 @@ const NLMISC::CMatrix &CPSLocatedBindable::getViewMat(void) const } -///*************************************************************************************** +/// *************************************************************************************** /// shortcut to get the inverted view matrix const NLMISC::CMatrix &CPSLocatedBindable::getInvertedViewMat(void) const { @@ -2852,7 +2852,7 @@ const NLMISC::CMatrix &CPSLocatedBindable::getInvertedViewMat(void) const return _Owner->getOwner()->getInvertedViewMat(); } -///*************************************************************************************** +/// *************************************************************************************** /// shortcut to setup the model matrix (system basis or world basis) void CPSLocatedBindable::setupDriverModelMatrix(void) { @@ -2861,7 +2861,7 @@ void CPSLocatedBindable::setupDriverModelMatrix(void) _Owner->setupDriverModelMatrix(); } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::setExternID(uint32 id) { NL_PS_FUNC(CPSLocatedBindable_setExternID) @@ -2883,7 +2883,7 @@ void CPSLocatedBindable::setExternID(uint32 id) } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocatedBindable::releaseAllRef() { NL_PS_FUNC(CPSLocatedBindable_releaseAllRef) @@ -2897,7 +2897,7 @@ void CPSLocatedBindable::releaseAllRef() // CPSTargetLocatedBindable implementation // ///////////////////////////////////////////// -///*************************************************************************************** +/// *************************************************************************************** void CPSTargetLocatedBindable::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSTargetLocatedBindable_serial) @@ -2917,7 +2917,7 @@ void CPSTargetLocatedBindable::serial(NLMISC::IStream &f) throw(NLMISC::EStream) } -///*************************************************************************************** +/// *************************************************************************************** void CPSTargetLocatedBindable::attachTarget(CPSLocated *ptr) { NL_PS_FUNC(CPSTargetLocatedBindable_attachTarget) @@ -2939,7 +2939,7 @@ void CPSTargetLocatedBindable::attachTarget(CPSLocated *ptr) } -///*************************************************************************************** +/// *************************************************************************************** void CPSTargetLocatedBindable::notifyTargetRemoved(CPSLocated *ptr) { NL_PS_FUNC(CPSTargetLocatedBindable_notifyTargetRemoved) @@ -2955,7 +2955,7 @@ void CPSTargetLocatedBindable::notifyTargetRemoved(CPSLocated *ptr) // dtor -///*************************************************************************************** +/// *************************************************************************************** void CPSTargetLocatedBindable::finalize(void) { NL_PS_FUNC(CPSTargetLocatedBindable_finalize) @@ -2969,7 +2969,7 @@ void CPSTargetLocatedBindable::finalize(void) CPSLocatedBindable::finalize(); } -///*************************************************************************************** +/// *************************************************************************************** CPSTargetLocatedBindable::~CPSTargetLocatedBindable() { NL_PS_FUNC(CPSTargetLocatedBindable_CPSTargetLocatedBindable) @@ -2980,7 +2980,7 @@ CPSTargetLocatedBindable::~CPSTargetLocatedBindable() } } -///*************************************************************************************** +/// *************************************************************************************** void CPSTargetLocatedBindable::releaseRefTo(const CParticleSystemProcess *other) { NL_PS_FUNC(CPSTargetLocatedBindable_releaseRefTo) @@ -2992,7 +2992,7 @@ void CPSTargetLocatedBindable::releaseRefTo(const CParticleSystemProcess *other) nlassert(std::find(_Targets.begin(), _Targets.end(), other) == _Targets.end()); } -///*************************************************************************************** +/// *************************************************************************************** void CPSTargetLocatedBindable::releaseAllRef() { NL_PS_FUNC(CPSTargetLocatedBindable_releaseAllRef) @@ -3005,7 +3005,7 @@ void CPSTargetLocatedBindable::releaseAllRef() CPSLocatedBindable::releaseAllRef(); } -///*************************************************************************************** +/// *************************************************************************************** uint CPSLocated::getUserMatrixUsageCount() const { NL_PS_FUNC(CPSLocated_getUserMatrixUsageCount) @@ -3017,7 +3017,7 @@ uint CPSLocated::getUserMatrixUsageCount() const return count + CParticleSystemProcess::getUserMatrixUsageCount(); } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::enumTexs(std::vector > &dest, IDriver &drv) { NL_PS_FUNC(CPSLocated_enumTexs) @@ -3027,7 +3027,7 @@ void CPSLocated::enumTexs(std::vector > &dest, IDriv } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::setZBias(float value) { NL_PS_FUNC(CPSLocated_setZBias) @@ -3037,7 +3037,7 @@ void CPSLocated::setZBias(float value) } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::computeCollisions(uint firstInstanceIndex, const NLMISC::CVector *posBefore, const NLMISC::CVector *posAfter) { NL_PS_FUNC(CPSLocated_computeCollisions) @@ -3050,7 +3050,7 @@ void CPSLocated::computeCollisions(uint firstInstanceIndex, const NLMISC::CVecto } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::computeSpawns(uint firstInstanceIndex, bool includeEmitOnce) { NL_PS_FUNC(CPSLocated_computeSpawns) @@ -3084,7 +3084,7 @@ void CPSLocated::computeSpawns(uint firstInstanceIndex, bool includeEmitOnce) } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::computeForces() { NL_PS_FUNC(CPSLocated_computeForces) @@ -3099,7 +3099,7 @@ void CPSLocated::computeForces() } } -///*************************************************************************************** +/// *************************************************************************************** void CPSCollisionInfo::update(const CPSCollisionInfo &other) { NL_PS_FUNC(CPSCollisionInfo_update) @@ -3122,7 +3122,7 @@ void CPSCollisionInfo::update(const CPSCollisionInfo &other) } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::checkLife() const { NL_PS_FUNC(CPSLocated_checkLife) @@ -3136,7 +3136,7 @@ void CPSLocated::checkLife() const } } -///*************************************************************************************** +/// *************************************************************************************** void CPSLocated::onShow(bool shown) { for(TLocatedBoundCont::iterator it = _LocatedBoundCont.begin(); it != _LocatedBoundCont.end(); ++it) diff --git a/code/nel/src/3d/ps_particle_basic.cpp b/code/nel/src/3d/ps_particle_basic.cpp index 1a3fb465d..2f0c4fa36 100644 --- a/code/nel/src/3d/ps_particle_basic.cpp +++ b/code/nel/src/3d/ps_particle_basic.cpp @@ -1126,7 +1126,7 @@ void CPSMultiTexturedParticle::enumTexs(std::vector if (_Texture2) dest.push_back(_Texture2); } -//***************************************************************************************************** +// ***************************************************************************************************** bool CPSMultiTexturedParticle::isAlternateTextureUsed(IDriver &driver) const { NL_PS_FUNC(CPSMultiTexturedParticle_isAlternateTextureUsed) diff --git a/code/nel/src/3d/ps_quad.cpp b/code/nel/src/3d/ps_quad.cpp index 903e5a8d3..e88ce29ed 100644 --- a/code/nel/src/3d/ps_quad.cpp +++ b/code/nel/src/3d/ps_quad.cpp @@ -666,7 +666,7 @@ void CPSQuad::updateMatBeforeRendering(IDriver *drv, CVertexBuffer &vb) } } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::enumTexs(std::vector > &dest, IDriver &drv) { NL_PS_FUNC(CPSQuad_enumTexs) @@ -674,7 +674,7 @@ void CPSQuad::enumTexs(std::vector > &dest, IDriver CPSMultiTexturedParticle::enumTexs(dest, drv); } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::setZBias(float value) { NL_PS_FUNC(CPSQuad_setZBias) @@ -682,7 +682,7 @@ void CPSQuad::setZBias(float value) } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::setTexture(CSmartPtr tex) { NL_PS_FUNC(CPSQuad_setTexture) @@ -690,7 +690,7 @@ void CPSQuad::setTexture(CSmartPtr tex) CPSMultiTexturedParticle::touch(); } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::setTextureGroup(NLMISC::CSmartPtr texGroup) { NL_PS_FUNC(CPSQuad_setTextureGroup) @@ -698,21 +698,21 @@ void CPSQuad::setTextureGroup(NLMISC::CSmartPtr texGroup) CPSMultiTexturedParticle::touch(); } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::setTexture2(ITexture *tex) { NL_PS_FUNC(CPSQuad_setTexture2) CPSMultiTexturedParticle::setTexture2(tex); } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::setTexture2Alternate(ITexture *tex) { NL_PS_FUNC(CPSQuad_setTexture2Alternate) CPSMultiTexturedParticle::setTexture2Alternate(tex); } -//***************************************************************************************************** +// ***************************************************************************************************** void CPSQuad::updateTexWrapMode(IDriver &drv) { NL_PS_FUNC(CPSQuad_updateTexWrapMode) diff --git a/code/nel/src/3d/ps_sound.cpp b/code/nel/src/3d/ps_sound.cpp index 0eecfe5dc..e2366708a 100644 --- a/code/nel/src/3d/ps_sound.cpp +++ b/code/nel/src/3d/ps_sound.cpp @@ -29,7 +29,7 @@ namespace NL3D static const uint SoundBufSize = 1024; -//*************************************************************************************************** +// *************************************************************************************************** CPSSound::CPSSound() : _Gain(1.f), _GainScheme(NULL), _Pitch(1.f), @@ -46,7 +46,7 @@ CPSSound::CPSSound() : _Gain(1.f), _SoundName = NLMISC::CStringMapper::emptyId(); } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::stopSound() { NL_PS_FUNC(CPSSound_stopSound) @@ -67,7 +67,7 @@ void CPSSound::stopSound() _SoundStopped = true; } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::reactivateSound() { NL_PS_FUNC(CPSSound_reactivateSound) @@ -75,7 +75,7 @@ void CPSSound::reactivateSound() _SoundReactivated = true; } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::removeAllSources(void) { NL_PS_FUNC(CPSSound_removeAllSources) @@ -87,7 +87,7 @@ void CPSSound::removeAllSources(void) } } -//*************************************************************************************************** +// *************************************************************************************************** CPSSound::~CPSSound() { NL_PS_FUNC(CPSSound_CPSSound) @@ -96,7 +96,7 @@ CPSSound::~CPSSound() delete _PitchScheme; } -//*************************************************************************************************** +// *************************************************************************************************** uint32 CPSSound::getType(void) const { NL_PS_FUNC(CPSSound_getType) @@ -105,7 +105,7 @@ uint32 CPSSound::getType(void) const -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::step(TPSProcessPass pass) { NL_PS_FUNC(CPSSound_step) @@ -212,7 +212,7 @@ void CPSSound::step(TPSProcessPass pass) while (leftToDo); } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::setGain(float Gain) { NL_PS_FUNC(CPSSound_setGain) @@ -221,7 +221,7 @@ void CPSSound::setGain(float Gain) _Gain = Gain; } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::setGainScheme(CPSAttribMaker *Gain) { NL_PS_FUNC(CPSSound_setGainScheme) @@ -233,7 +233,7 @@ void CPSSound::setGainScheme(CPSAttribMaker *Gain) } } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::setPitch(float pitch) { NL_PS_FUNC(CPSSound_setPitch) @@ -242,7 +242,7 @@ void CPSSound::setPitch(float pitch) _Pitch = pitch; } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::setPitchScheme(CPSAttribMaker *pitch) { NL_PS_FUNC(CPSSound_setPitchScheme) @@ -254,7 +254,7 @@ void CPSSound::setPitchScheme(CPSAttribMaker *pitch) } } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { NL_PS_FUNC(CPSSound_serial) @@ -366,7 +366,7 @@ void CPSSound::serial(NLMISC::IStream &f) throw(NLMISC::EStream) } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::newElement(const CPSEmitterInfo &info) { NL_PS_FUNC(CPSSound_newElement) @@ -414,7 +414,7 @@ void CPSSound::newElement(const CPSEmitterInfo &info) } } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::deleteElement(uint32 index) { NL_PS_FUNC(CPSSound_deleteElement) @@ -428,7 +428,7 @@ void CPSSound::deleteElement(uint32 index) _Sounds.remove(index); } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::resize(uint32 size) { NL_PS_FUNC(CPSSound_resize) @@ -450,7 +450,7 @@ void CPSSound::resize(uint32 size) _Sounds.resize(size); } -//*************************************************************************************************** +// *************************************************************************************************** void CPSSound::setUseOriginalPitchFlag(bool useOriginalPitch) { NL_PS_FUNC(CPSSound_setUseOriginalPitchFlag) diff --git a/code/nel/src/3d/register_3d.cpp b/code/nel/src/3d/register_3d.cpp index 4858ea1a3..6f09aa8e1 100644 --- a/code/nel/src/3d/register_3d.cpp +++ b/code/nel/src/3d/register_3d.cpp @@ -50,7 +50,7 @@ namespace NL3D { -//**************************************************************************** +// **************************************************************************** void registerSerial3d() { static bool bInitialized=false; diff --git a/code/nel/src/3d/texture_blend.cpp b/code/nel/src/3d/texture_blend.cpp index b0130be5e..d3ae19e96 100644 --- a/code/nel/src/3d/texture_blend.cpp +++ b/code/nel/src/3d/texture_blend.cpp @@ -28,14 +28,14 @@ CTextureBlend::CTextureBlend() : _BlendFactor(0), _SharingEnabled(true) } -//************************************************************************ +// ************************************************************************ bool CTextureBlend::supportSharing() const { return _BlendTex[0] && _BlendTex[0]->supportSharing() && _BlendTex[1] && _BlendTex[1]->supportSharing(); } -//************************************************************************ +// ************************************************************************ std::string CTextureBlend::getShareName() const { nlassert(supportSharing()); @@ -48,14 +48,14 @@ std::string CTextureBlend::getShareName() const } -//************************************************************************ +// ************************************************************************ void CTextureBlend::enableSharing(bool enabled /*= false*/) { _SharingEnabled = enabled; } -//************************************************************************ +// ************************************************************************ void CTextureBlend::release() { if (_BlendTex[0] && _BlendTex[0]->getReleasable()) _BlendTex[0]->release(); @@ -63,7 +63,7 @@ void CTextureBlend::release() ITexture::release(); } -//************************************************************************ +// ************************************************************************ bool CTextureBlend::setBlendFactor(uint16 factor) { nlassert(factor <= 256); @@ -77,7 +77,7 @@ bool CTextureBlend::setBlendFactor(uint16 factor) } -//************************************************************************ +// ************************************************************************ void CTextureBlend::setBlendTexture(uint index, ITexture *tex) { nlassert(index < 2); @@ -89,7 +89,7 @@ void CTextureBlend::setBlendTexture(uint index, ITexture *tex) } -//************************************************************************ +// ************************************************************************ void CTextureBlend::doGenerate(bool async) { if (!_BlendTex[0] || !_BlendTex[1]) @@ -107,7 +107,7 @@ void CTextureBlend::doGenerate(bool async) } -//************************************************************************ +// ************************************************************************ void CTextureBlend::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(0); diff --git a/code/nel/src/3d/texture_emboss.cpp b/code/nel/src/3d/texture_emboss.cpp index 3168bdce8..6068ff0d3 100644 --- a/code/nel/src/3d/texture_emboss.cpp +++ b/code/nel/src/3d/texture_emboss.cpp @@ -19,7 +19,7 @@ namespace NL3D { -//*********************************************************************************************************** +// *********************************************************************************************************** CTextureEmboss::CTextureEmboss() : _Ambient(CRGBA::Black), _Diffuse(CRGBA::White), _DisableSharing(false), @@ -30,7 +30,7 @@ CTextureEmboss::CTextureEmboss() : _Ambient(CRGBA::Black), } -//*********************************************************************************************************** +// *********************************************************************************************************** void CTextureEmboss::setHeightMap(ITexture *heightMap) { if (heightMap != _HeightMap) @@ -40,7 +40,7 @@ void CTextureEmboss::setHeightMap(ITexture *heightMap) } } -//*********************************************************************************************************** +// *********************************************************************************************************** void CTextureEmboss::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(0); @@ -63,20 +63,20 @@ void CTextureEmboss::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serial(_DisableSharing); } -//*********************************************************************************************************** +// *********************************************************************************************************** bool CTextureEmboss::supportSharing() const { return !_DisableSharing && _HeightMap && _HeightMap->supportSharing(); } -//*********************************************************************************************************** +// *********************************************************************************************************** std::string CTextureEmboss::getShareName() const { nlassert(supportSharing()); return "Emboss:" + _HeightMap->getShareName(); } -//*********************************************************************************************************** +// *********************************************************************************************************** void CTextureEmboss::release() { ITexture::release(); @@ -89,7 +89,7 @@ void CTextureEmboss::release() } } -//*********************************************************************************************************** +// *********************************************************************************************************** void CTextureEmboss::doGenerate(bool /* async */) { if (!_HeightMap) diff --git a/code/nel/src/3d/visual_collision_entity_user.cpp b/code/nel/src/3d/visual_collision_entity_user.cpp index 7d9f10f14..965ddc0e2 100644 --- a/code/nel/src/3d/visual_collision_entity_user.cpp +++ b/code/nel/src/3d/visual_collision_entity_user.cpp @@ -33,7 +33,7 @@ H_AUTO_DECL( NL3D_Misc_VisualCollisionEntity_GetLight ) #define NL3D_HAUTO_LIGHT_VCE H_AUTO_USE( NL3D_Misc_VisualCollisionEntity_GetLight ) -//**************************************************************************** +// **************************************************************************** bool CVisualCollisionEntityUser::snapToGround(CVector &pos) { NL3D_HAUTO_SNAP_VCE; diff --git a/code/nel/src/3d/water_env_map.cpp b/code/nel/src/3d/water_env_map.cpp index 364e3068f..59b5f6725 100644 --- a/code/nel/src/3d/water_env_map.cpp +++ b/code/nel/src/3d/water_env_map.cpp @@ -59,7 +59,7 @@ static uint32 inline getFVBVertex(uint section, uint side) const uint NUM_FACES_TO_RENDER = 5; -//******************************************************************************* +// ******************************************************************************* CWaterEnvMap::CWaterEnvMap() { _UpdateTime = 0; @@ -73,7 +73,7 @@ CWaterEnvMap::CWaterEnvMap() _Alpha = 255; } -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::init(uint cubeMapSize, uint projection2DSize, TGlobalAnimationTime updateTime, IDriver &driver) { // Allocate cube map @@ -154,7 +154,7 @@ void CWaterEnvMap::init(uint cubeMapSize, uint projection2DSize, TGlobalAnimatio _Env2DSize = projection2DSize; } -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::update(TGlobalAnimationTime time, IDriver &driver) { if (_LastRenderTime == time) return; @@ -206,7 +206,7 @@ void CWaterEnvMap::update(TGlobalAnimationTime time, IDriver &driver) driver.setRenderTarget(NULL); } -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::doInit() { if (!_FlattenVBInitialized) @@ -241,7 +241,7 @@ static CVertexProgram testMeshVP( -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::renderTestMesh(IDriver &driver) { doInit(); @@ -269,7 +269,7 @@ void CWaterEnvMap::renderTestMesh(IDriver &driver) driver.activeVertexProgram(NULL); } -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::initFlattenVB() { _FlattenVB.setPreferredMemory(CVertexBuffer::AGPPreferred, true); @@ -336,7 +336,7 @@ void CWaterEnvMap::initFlattenVB() } } -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::invalidate() { _LastRenderTime = -1; @@ -352,7 +352,7 @@ void CWaterEnvMap::invalidate() _NumRenderedFaces = 0; } -//******************************************************************************* +// ******************************************************************************* void CWaterEnvMap::initTestVB() { _TestVB.setPreferredMemory(CVertexBuffer::AGPPreferred, true); diff --git a/code/nel/src/3d/water_env_map_user.cpp b/code/nel/src/3d/water_env_map_user.cpp index 403ee10b0..84adf3bee 100644 --- a/code/nel/src/3d/water_env_map_user.cpp +++ b/code/nel/src/3d/water_env_map_user.cpp @@ -25,7 +25,7 @@ namespace NL3D // CWaterEnvMapUser // ////////////////////// -//*********************************************************************************** +// *********************************************************************************** void CWaterEnvMapUser::init(uint cubeMapSize, uint projection2DSize, TGlobalAnimationTime updateTime) { EnvMap.init(cubeMapSize, projection2DSize, updateTime, *(EnvMap.Driver->getDriver())); @@ -36,7 +36,7 @@ void CWaterEnvMapUser::init(uint cubeMapSize, uint projection2DSize, TGlobalAnim ////////////////////////////// -//*********************************************************************************** +// *********************************************************************************** void CWaterEnvMapRenderHelper::render(TFace face, TGlobalAnimationTime time, UDriver &drv) { CMatrix mat; @@ -61,7 +61,7 @@ void CWaterEnvMapRenderHelper::render(TFace face, TGlobalAnimationTime time, UDr // CWaterEnvMapRenderFromUScene // ////////////////////////////////// -//*********************************************************************************** +// *********************************************************************************** CWaterEnvMapRenderFromUScene::CWaterEnvMapRenderFromUScene() { _Scene = NULL; @@ -70,7 +70,7 @@ CWaterEnvMapRenderFromUScene::CWaterEnvMapRenderFromUScene() _RenderPart = UScene::RenderAll; } -//*********************************************************************************** +// *********************************************************************************** void CWaterEnvMapRenderFromUScene::setScene(UScene *scene, UCamera cam) { _Scene = scene; @@ -82,7 +82,7 @@ void CWaterEnvMapRenderFromUScene::setScene(UScene *scene, UCamera cam) } -//*********************************************************************************** +// *********************************************************************************** void CWaterEnvMapRenderFromUScene::doRender(const CMatrix &camMatrix, TGlobalAnimationTime time, UDriver &drv) { if (!_Scene) return; @@ -108,7 +108,7 @@ void CWaterEnvMapRenderFromUScene::doRender(const CMatrix &camMatrix, TGlobalAni postRender(time, drv); } -//*********************************************************************************** +// *********************************************************************************** void CWaterEnvMapUser::invalidate() { EnvMap.invalidate(); diff --git a/code/nel/src/3d/water_height_map.cpp b/code/nel/src/3d/water_height_map.cpp index caaf4ba76..f230ce57b 100644 --- a/code/nel/src/3d/water_height_map.cpp +++ b/code/nel/src/3d/water_height_map.cpp @@ -699,7 +699,7 @@ void CWaterHeightMap::serial(NLMISC::IStream &f) throw(NLMISC::EStream) -//*** perform a bilinear on 4 values +// *** perform a bilinear on 4 values // 0---1 // | | // 3---2 diff --git a/code/nel/src/3d/water_model.cpp b/code/nel/src/3d/water_model.cpp index f7dd19e55..95af19e7c 100644 --- a/code/nel/src/3d/water_model.cpp +++ b/code/nel/src/3d/water_model.cpp @@ -208,7 +208,7 @@ static void inline FillWaterVB(uint8 *&vbPointer, float x, float y, float z, flo } */ -//*************************************************************************************************************** +// *************************************************************************************************************** /* #ifdef NL_OS_WINDOWS __forceinline @@ -331,7 +331,7 @@ static void SetupWaterVertex( sint qLeft, */ -//***************************************************************************************************** +// ***************************************************************************************************** /* static void DrawPoly2D(CVertexBuffer &vb, IDriver *drv, const NLMISC::CMatrix &mat, const NLMISC::CPolygon &p) { @@ -366,7 +366,7 @@ static void DrawPoly2D(CVertexBuffer &vb, IDriver *drv, const NLMISC::CMatrix &m */ -//*************************************************************************************************************** +// *************************************************************************************************************** /* void CWaterModel::traverseRender() { @@ -740,9 +740,9 @@ void CWaterModel::traverseRender() } */ -//*********************** +// *********************** // Water MATERIAL SETUP // -//*********************** +// *********************** /* void CWaterModel::setupMaterialNVertexShader(IDriver *drv, CWaterShape *shape, const NLMISC::CVector &obsPos, bool above, float maxDist, float zHeight) { @@ -1169,7 +1169,7 @@ void CWaterModel::computeClippedPoly() _ClippedPoly.clip(tp); } -//*********************************************************************************************************** +// *********************************************************************************************************** void CWaterModel::unlink() { if (!_Prev) @@ -1186,7 +1186,7 @@ void CWaterModel::unlink() _Prev = NULL; } -//*********************************************************************************************************** +// *********************************************************************************************************** void CWaterModel::link() { nlassert(_Next == NULL); @@ -1204,7 +1204,7 @@ void CWaterModel::link() -//*********************************************************************************************************** +// *********************************************************************************************************** uint CWaterModel::getNumWantedVertices() { H_AUTO( NL3D_Water_Render ); @@ -1359,7 +1359,7 @@ uint CWaterModel::getNumWantedVertices() return totalNumVertices; } -//*********************************************************************************************************** +// *********************************************************************************************************** uint CWaterModel::fillVB(void *datas, uint startTri, IDriver &drv) { H_AUTO( NL3D_Water_Render ); @@ -1416,7 +1416,7 @@ void computeWaterVertexSoft(float px, float py, CVector &pos, CVector2f &envMapT } } -//*********************************************************************************************************** +// *********************************************************************************************************** uint CWaterModel::fillVBSoft(void *datas, uint startTri) { _StartTri = (uint32) startTri; @@ -1531,7 +1531,7 @@ void computeWaterVertexHard(float px, float py, CVector &pos, const CVector &cam pos.z = 0.f; } -//*********************************************************************************************************** +// *********************************************************************************************************** uint CWaterModel::fillVBHard(void *datas, uint startTri) { _StartTri = (uint32) startTri; @@ -1609,7 +1609,7 @@ uint CWaterModel::fillVBHard(void *datas, uint startTri) -//*************************************************************************************************************** +// *************************************************************************************************************** void CWaterModel::traverseRender() { H_AUTO( NL3D_Water_Render ); @@ -1677,7 +1677,7 @@ void CWaterModel::traverseRender() -//*********************************************************************************************************** +// *********************************************************************************************************** bool CWaterModel::clip() { H_AUTO( NL3D_Water_Render ); @@ -1707,7 +1707,7 @@ struct CSimpleVertexInfo }; */ -//*********************************************************************************************************** +// *********************************************************************************************************** /* void CWaterModel::doSimpleRender(IDriver *drv) { @@ -1915,7 +1915,7 @@ void CWaterModel::doSimpleRender(IDriver *drv) } */ -//*********************************************************************************************************** +// *********************************************************************************************************** void CWaterModel::updateDiffuseMapMatrix(bool force /* = false*/) { if (compareMatrixDate(_MatrixUpdateDate) ||force) diff --git a/code/nel/src/georges/CMakeLists.txt b/code/nel/src/georges/CMakeLists.txt index 7efb0d037..c3b4ee12c 100644 --- a/code/nel/src/georges/CMakeLists.txt +++ b/code/nel/src/georges/CMakeLists.txt @@ -6,6 +6,8 @@ SOURCE_GROUP(headers FILES ${PRIV_H} ${PUB_H}) IF(NOT WIN32) ADD_LIBRARY(nelgeorges SHARED ${SRC}) + CONFIGURE_FILE(nel-georges.pc.in nel-georges.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-georges.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nelgeorges STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/georges/nel-georges.pc.in b/code/nel/src/georges/nel-georges.pc.in new file mode 100644 index 000000000..4aa509aa0 --- /dev/null +++ b/code/nel/src/georges/nel-georges.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: nel-georges +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ +Reqiures: +Libs: -L${libdir} +Libs.private: @LIBS@ -lc +Cflags: -I${includedir} diff --git a/code/nel/src/ligo/CMakeLists.txt b/code/nel/src/ligo/CMakeLists.txt index 30402c9e0..43d5061b7 100644 --- a/code/nel/src/ligo/CMakeLists.txt +++ b/code/nel/src/ligo/CMakeLists.txt @@ -2,6 +2,8 @@ FILE(GLOB SRC *.cpp *.h) IF(NOT WIN32) ADD_LIBRARY(nelligo SHARED ${SRC}) + CONFIGURE_FILE(nel-ligo.pc.in nel-ligo.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-ligo.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nelligo STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/ligo/nel-ligo.pc.in b/code/nel/src/ligo/nel-ligo.pc.in new file mode 100644 index 000000000..d4a535bac --- /dev/null +++ b/code/nel/src/ligo/nel-ligo.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: nel-ligo +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ +Reqiures: +Libs: -L${libdir} +Libs.private: @LIBS@ -lc +Cflags: -I${includedir} diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index 45a619466..850b6a043 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -2,6 +2,8 @@ FILE(GLOB SRC *.cpp *.h config_file/*.cpp config_file/*.h) IF(NOT WIN32) ADD_LIBRARY(nelmisc SHARED ${SRC}) + CONFIGURE_FILE(nel-misc.pc.in nel-misc.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-misc.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nelmisc STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/misc/contiguous_block_allocator.cpp b/code/nel/src/misc/contiguous_block_allocator.cpp index 725d81de8..77986fa7b 100644 --- a/code/nel/src/misc/contiguous_block_allocator.cpp +++ b/code/nel/src/misc/contiguous_block_allocator.cpp @@ -20,7 +20,7 @@ namespace NLMISC { -//********************************************************************************************************* +// ********************************************************************************************************* CContiguousBlockAllocator::CContiguousBlockAllocator() { _BlockStart = NULL; @@ -33,13 +33,13 @@ CContiguousBlockAllocator::CContiguousBlockAllocator() #endif } -//********************************************************************************************************* +// ********************************************************************************************************* CContiguousBlockAllocator::~CContiguousBlockAllocator() { init(0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CContiguousBlockAllocator::init(uint numBytes /*=0*/) { if (_BlockStart) _DefaultAlloc.deallocate(_BlockStart, _BlockEnd - _BlockStart); @@ -60,7 +60,7 @@ void CContiguousBlockAllocator::init(uint numBytes /*=0*/) #endif } -//********************************************************************************************************* +// ********************************************************************************************************* void *CContiguousBlockAllocator::alloc(uint numBytes) { if (numBytes == 0) return NULL; @@ -84,7 +84,7 @@ void *CContiguousBlockAllocator::alloc(uint numBytes) return _DefaultAlloc.allocate(numBytes); } -//********************************************************************************************************* +// ********************************************************************************************************* void CContiguousBlockAllocator::free(void *block, uint numBytes) { if (!block) return; diff --git a/code/nel/src/misc/displayer.cpp b/code/nel/src/misc/displayer.cpp index 93cb5be2c..4f4e0866a 100644 --- a/code/nel/src/misc/displayer.cpp +++ b/code/nel/src/misc/displayer.cpp @@ -230,7 +230,7 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess printf ("%s", str.c_str()); if (!args.CallstackAndLog.empty()) - printf (args.CallstackAndLog.c_str()); + printf ("%s", args.CallstackAndLog.c_str()); fflush(stdout); } diff --git a/code/nel/src/misc/dummy_window.cpp b/code/nel/src/misc/dummy_window.cpp index 51e682dae..4c285de25 100644 --- a/code/nel/src/misc/dummy_window.cpp +++ b/code/nel/src/misc/dummy_window.cpp @@ -31,12 +31,12 @@ static LRESULT CALLBACK nlDefaultWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP } -//*************************************************************** +// *************************************************************** CDummyWindow::CDummyWindow() : _HWnd(NULL) { } -//*************************************************************** +// *************************************************************** bool CDummyWindow::init(HINSTANCE hInstance, WNDPROC winProc) { release(); @@ -72,7 +72,7 @@ bool CDummyWindow::init(HINSTANCE hInstance, WNDPROC winProc) return false; } -//*************************************************************** +// *************************************************************** void CDummyWindow::release() { if (_HWnd) @@ -82,7 +82,7 @@ void CDummyWindow::release() } } -//*************************************************************** +// *************************************************************** CDummyWindow::~CDummyWindow() { release(); diff --git a/code/nel/src/misc/fixed_size_allocator.cpp b/code/nel/src/misc/fixed_size_allocator.cpp index 387b9ba6c..c182f81ce 100644 --- a/code/nel/src/misc/fixed_size_allocator.cpp +++ b/code/nel/src/misc/fixed_size_allocator.cpp @@ -21,7 +21,7 @@ namespace NLMISC { -//***************************************************************************************************************** +// ***************************************************************************************************************** CFixedSizeAllocator::CFixedSizeAllocator(uint numBytesPerBlock, uint numBlockPerChunk) { _FreeSpace = NULL; @@ -32,7 +32,7 @@ CFixedSizeAllocator::CFixedSizeAllocator(uint numBytesPerBlock, uint numBlockPer _NumAlloc = 0; } -//***************************************************************************************************************** +// ***************************************************************************************************************** CFixedSizeAllocator::~CFixedSizeAllocator() { if (_NumAlloc != 0) @@ -50,7 +50,7 @@ CFixedSizeAllocator::~CFixedSizeAllocator() } } -//***************************************************************************************************************** +// ***************************************************************************************************************** void *CFixedSizeAllocator::alloc() { if (!_FreeSpace) @@ -62,7 +62,7 @@ void *CFixedSizeAllocator::alloc() return _FreeSpace->unlink(); } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CFixedSizeAllocator::free(void *block) { if (!block) return; @@ -76,20 +76,20 @@ void CFixedSizeAllocator::free(void *block) node->link(); } -//***************************************************************************************************************** +// ***************************************************************************************************************** uint CFixedSizeAllocator::CChunk::getBlockSizeWithOverhead() const { return std::max((uint)(sizeof(CNode) - offsetof(CNode, Next)),(uint)(Allocator->getNumBytesPerBlock())) + offsetof(CNode, Next); } -//***************************************************************************************************************** +// ***************************************************************************************************************** CFixedSizeAllocator::CChunk::CChunk() { NumFreeObjs = 0; Allocator = NULL; } -//***************************************************************************************************************** +// ***************************************************************************************************************** CFixedSizeAllocator::CChunk::~CChunk() { nlassert(Allocator != NULL); @@ -103,7 +103,7 @@ CFixedSizeAllocator::CChunk::~CChunk() delete Mem; } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CFixedSizeAllocator::CChunk::init(CFixedSizeAllocator *alloc) { nlassert(!Allocator); @@ -134,7 +134,7 @@ void CFixedSizeAllocator::CChunk::init(CFixedSizeAllocator *alloc) ++(alloc->_NumChunks); } -//***************************************************************************************************************** +// ***************************************************************************************************************** CFixedSizeAllocator::CNode &CFixedSizeAllocator::CChunk::getNode(uint index) { nlassert(Allocator != NULL); @@ -142,7 +142,7 @@ CFixedSizeAllocator::CNode &CFixedSizeAllocator::CChunk::getNode(uint index) return *(CNode *) ((uint8 *) Mem + index * getBlockSizeWithOverhead()); } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CFixedSizeAllocator::CChunk::add() { nlassert(Allocator); @@ -158,7 +158,7 @@ void CFixedSizeAllocator::CChunk::add() } } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CFixedSizeAllocator::CChunk::grab() { // a node of this chunk has been given back @@ -166,7 +166,7 @@ void CFixedSizeAllocator::CChunk::grab() -- NumFreeObjs; } -//***************************************************************************************************************** +// ***************************************************************************************************************** void *CFixedSizeAllocator::CNode::unlink() { nlassert(Prev != NULL); @@ -177,7 +177,7 @@ void *CFixedSizeAllocator::CNode::unlink() return (void *) &Next; } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CFixedSizeAllocator::CNode::link() { // destroy the obj to get back uninitialized memory diff --git a/code/nel/src/misc/grid_traversal.cpp b/code/nel/src/misc/grid_traversal.cpp index 0f23da364..e55ea9a58 100644 --- a/code/nel/src/misc/grid_traversal.cpp +++ b/code/nel/src/misc/grid_traversal.cpp @@ -22,14 +22,14 @@ namespace NLMISC { -//******************************************************************************************************************************** +// ******************************************************************************************************************************** void CGridTraversal::startTraverse(const NLMISC::CVector2f &start, sint &nextX, sint &nextY) { nextX = (sint) floorf(start.x); nextY = (sint) floorf(start.y); } -//******************************************************************************************************************************** +// ******************************************************************************************************************************** bool CGridTraversal::traverse(const NLMISC::CVector2f &start, const NLMISC::CVector2f &dir, sint &x, sint &y) { if (dir.x > 0.f) diff --git a/code/nel/src/misc/inter_window_msg_queue.cpp b/code/nel/src/misc/inter_window_msg_queue.cpp index fa63c9069..abdb84338 100644 --- a/code/nel/src/misc/inter_window_msg_queue.cpp +++ b/code/nel/src/misc/inter_window_msg_queue.cpp @@ -33,13 +33,13 @@ namespace NLMISC - //************************************************************************************************** + // ************************************************************************************************** //////////////////////////////////////// // CInterWindowMsgQueue::CProtagonist // //////////////////////////////////////// - //************************************************************************************************** + // ************************************************************************************************** CInterWindowMsgQueue::CProtagonist::CProtagonist() : _Id(0), _Wnd(0), _SharedMemMutex(0), @@ -48,13 +48,13 @@ namespace NLMISC } - //************************************************************************************************** + // ************************************************************************************************** CInterWindowMsgQueue::CProtagonist::~CProtagonist() { release(); } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::CProtagonist::release() { CloseHandle(_SharedMemMutex); @@ -69,7 +69,7 @@ namespace NLMISC // unhook window } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::CProtagonist::acquireSMMutex() { nlassert(_SharedMemMutex); @@ -77,14 +77,14 @@ namespace NLMISC nlassert(result != WAIT_FAILED); } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::CProtagonist::releaseSMMutex() { nlassert(_SharedMemMutex); ReleaseMutex(_SharedMemMutex); } - //************************************************************************************************** + // ************************************************************************************************** bool CInterWindowMsgQueue::CProtagonist::init(uint32 id) { nlassert(id != 0); @@ -98,7 +98,7 @@ namespace NLMISC return true; } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::CProtagonist::setWnd(HWND wnd) { nlassert(wnd != 0); @@ -114,7 +114,7 @@ namespace NLMISC _Wnd = wnd; } - //************************************************************************************************** + // ************************************************************************************************** HWND CInterWindowMsgQueue::CProtagonist::getWnd() { if (!_SharedMemMutex) @@ -145,20 +145,20 @@ namespace NLMISC } - //************************************************************************************************** + // ************************************************************************************************** ///////////////////////////////////// // CInterWindowMsgQueue::CSendTask // ///////////////////////////////////// - //************************************************************************************************** + // ************************************************************************************************** CInterWindowMsgQueue::CSendTask::CSendTask(CInterWindowMsgQueue *parent) : _StopAsked(false) { nlassert(parent); _Parent = parent; } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::CSendTask::run() { while(!_StopAsked) @@ -209,39 +209,39 @@ namespace NLMISC } } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::CSendTask::stop() { _StopAsked = true; } - //************************************************************************************************** + // ************************************************************************************************** ////////////////////////// // CInterWindowMsgQueue // ////////////////////////// - //************************************************************************************************** + // ************************************************************************************************** CInterWindowMsgQueue::CInterWindowMsgQueue() : _SendTask(NULL), _SendThread(NULL), _OutMessageQueue("CInterWindowMsgQueue::_OutMessageQueue") { } - //************************************************************************************************** + // ************************************************************************************************** bool CInterWindowMsgQueue::init(HWND ownerWindow, uint32 localId, uint32 foreignId) { return initInternal(NULL, ownerWindow, localId, foreignId); } - //************************************************************************************************** + // ************************************************************************************************** bool CInterWindowMsgQueue::init(HINSTANCE hInstance, uint32 localId, uint32 foreignId) { return initInternal(hInstance, NULL, localId, foreignId); } - //************************************************************************************************** + // ************************************************************************************************** bool CInterWindowMsgQueue::initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId) { if (!ownerWindow) @@ -307,7 +307,7 @@ namespace NLMISC return true; } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::release() { if (_LocalWindow.getWnd() != 0) @@ -458,13 +458,13 @@ namespace NLMISC return DefWindowProc(hwnd, uMsg, wParam, lParam); } - //************************************************************************************************** + // ************************************************************************************************** CInterWindowMsgQueue::~CInterWindowMsgQueue() { release(); } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::clearOutQueue() { CSynchronized::CAccessor outMessageQueue(&_OutMessageQueue); @@ -474,7 +474,7 @@ namespace NLMISC } } - //************************************************************************************************** + // ************************************************************************************************** void CInterWindowMsgQueue::sendMessage(CMemStream &msg) { if (!msg.isReading()) @@ -491,7 +491,7 @@ namespace NLMISC } - //************************************************************************************************** + // ************************************************************************************************** bool CInterWindowMsgQueue::pumpMessage(CMemStream &dest) { if (_InMessageQueue.empty()) return false; @@ -509,20 +509,20 @@ namespace NLMISC return true; } - //************************************************************************************************** + // ************************************************************************************************** bool CInterWindowMsgQueue::connected() const { return const_cast(_ForeignWindow).getWnd() != NULL; } - //************************************************************************************************** + // ************************************************************************************************** uint CInterWindowMsgQueue::getSendQueueSize() const { CSynchronized::CAccessor outMessageQueue(&const_cast &>(_OutMessageQueue)); return (uint)outMessageQueue.value().size(); } - //************************************************************************************************** + // ************************************************************************************************** uint CInterWindowMsgQueue::getReceiveQueueSize() const { return (uint)_InMessageQueue.size(); diff --git a/code/nel/src/misc/mouse_smoother.cpp b/code/nel/src/misc/mouse_smoother.cpp index cc6afb06d..43821149a 100644 --- a/code/nel/src/misc/mouse_smoother.cpp +++ b/code/nel/src/misc/mouse_smoother.cpp @@ -20,7 +20,7 @@ namespace NLMISC { -//******************************************************************************************* +// ******************************************************************************************* /// build some hermite spline value, with the given points and tangents static inline void BuildHermiteVector(const NLMISC::CVector2f &P0, const NLMISC::CVector2f &P1, @@ -41,7 +41,7 @@ static inline void BuildHermiteVector(const NLMISC::CVector2f &P0, h1 * P0.y + h2 * P1.y + h3 * T0.y + h4 * T1.y); } -//******************************************************************************************* +// ******************************************************************************************* CMouseSmoother::CMouseSmoother(double samplingPeriod /*=0.2f*/) { nlassert(samplingPeriod > 0); @@ -50,7 +50,7 @@ CMouseSmoother::CMouseSmoother(double samplingPeriod /*=0.2f*/) } -//******************************************************************************************* +// ******************************************************************************************* void CMouseSmoother::setSamplingPeriod(double period) { if (period == _SamplingPeriod) return; @@ -60,7 +60,7 @@ void CMouseSmoother::setSamplingPeriod(double period) } -//******************************************************************************************* +// ******************************************************************************************* NLMISC::CVector2f CMouseSmoother::samplePos(const CVector2f &wantedPos, double date) { if (!_Init) @@ -124,7 +124,7 @@ NLMISC::CVector2f CMouseSmoother::samplePos(const CVector2f &wantedPos, double d return result; } -//******************************************************************************************* +// ******************************************************************************************* void CMouseSmoother::reset() { _Init = false; diff --git a/code/nel/src/misc/nel-misc.pc.in b/code/nel/src/misc/nel-misc.pc.in index 9e10a2beb..c4d447c42 100644 --- a/code/nel/src/misc/nel-misc.pc.in +++ b/code/nel/src/misc/nel-misc.pc.in @@ -4,8 +4,8 @@ libdir=@libdir@ includedir=@includedir@ Name: nel-misc -Version: @VERSION@ -Description: NeL @VERSION@ +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ Reqiures: Libs: -L${libdir} Libs.private: @LIBS@ -lc -lpthread -lrt -ldl diff --git a/code/nel/src/misc/object_arena_allocator.cpp b/code/nel/src/misc/object_arena_allocator.cpp index 1876f6417..385e0dedb 100644 --- a/code/nel/src/misc/object_arena_allocator.cpp +++ b/code/nel/src/misc/object_arena_allocator.cpp @@ -25,7 +25,7 @@ namespace NLMISC CObjectArenaAllocator *CObjectArenaAllocator::_DefaultAllocator = NULL; -//***************************************************************************************************************** +// ***************************************************************************************************************** CObjectArenaAllocator::CObjectArenaAllocator(uint maxAllocSize, uint granularity /* = 4*/) { nlassert(granularity > 0); @@ -40,7 +40,7 @@ CObjectArenaAllocator::CObjectArenaAllocator(uint maxAllocSize, uint granularity #endif } -//***************************************************************************************************************** +// ***************************************************************************************************************** CObjectArenaAllocator::~CObjectArenaAllocator() { for(uint k = 0; k < _ObjectSizeToAllocator.size(); ++k) @@ -49,7 +49,7 @@ CObjectArenaAllocator::~CObjectArenaAllocator() } } -//***************************************************************************************************************** +// ***************************************************************************************************************** void *CObjectArenaAllocator::alloc(uint size) { #ifdef NL_DEBUG @@ -90,7 +90,7 @@ void *CObjectArenaAllocator::alloc(uint size) return (void *) ((uint8 *) block + sizeof(uint)); } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CObjectArenaAllocator::free(void *block) { if (!block) return; @@ -127,7 +127,7 @@ void CObjectArenaAllocator::free(void *block) #endif } -//***************************************************************************************************************** +// ***************************************************************************************************************** uint CObjectArenaAllocator::getNumAllocatedBlocks() const { uint numObjs = 0; @@ -138,7 +138,7 @@ uint CObjectArenaAllocator::getNumAllocatedBlocks() const return numObjs; } -//***************************************************************************************************************** +// ***************************************************************************************************************** CObjectArenaAllocator &CObjectArenaAllocator::getDefaultAllocator() { if (!_DefaultAllocator) @@ -151,7 +151,7 @@ CObjectArenaAllocator &CObjectArenaAllocator::getDefaultAllocator() #ifdef NL_DEBUG -//***************************************************************************************************************** +// ***************************************************************************************************************** void CObjectArenaAllocator::dumpUnreleasedBlocks() { for(std::map::iterator it = _MemBlockToAllocID.begin(); it != _MemBlockToAllocID.end(); ++it) @@ -160,7 +160,7 @@ void CObjectArenaAllocator::dumpUnreleasedBlocks() } } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CObjectArenaAllocator::setBreakForAllocID(bool enabled, uint id) { _WantBreakOnAlloc = enabled; diff --git a/code/nel/src/misc/win_event_emitter.cpp b/code/nel/src/misc/win_event_emitter.cpp index 0c9a6ad3c..57924c06c 100644 --- a/code/nel/src/misc/win_event_emitter.cpp +++ b/code/nel/src/misc/win_event_emitter.cpp @@ -52,6 +52,13 @@ void CWinEventEmitter::submitEvents(CEventServer & server, bool allWindows) _InternalServer.pump (allWindows); } +/*------------------------------------------------------------------*\ + emulateMouseRawMode() +\*------------------------------------------------------------------*/ +void CWinEventEmitter::emulateMouseRawMode(bool enable) +{ + nlerror("no raw mode emulation on windows, the CDIMouse has a real raw mode"); +} /*------------------------------------------------------------------*\ processMessage() diff --git a/code/nel/src/misc/win_thread.cpp b/code/nel/src/misc/win_thread.cpp index 2655d4ddc..4192e927b 100644 --- a/code/nel/src/misc/win_thread.cpp +++ b/code/nel/src/misc/win_thread.cpp @@ -301,7 +301,7 @@ bool CWinProcess::setCPUMask(uint64 mask) return SetProcessAffinityMask((HANDLE)_ProcessHandle, processAffinityMask)!=0; } -//**************************************************************************************************************** +// **************************************************************************************************************** /** * Simple wrapper around the PSAPI library * \author Nicolas Vizerie @@ -327,7 +327,7 @@ private: bool _LoadFailed; }; -//**************************************************************************************************************** +// **************************************************************************************************************** CPSAPILib::CPSAPILib() { _LoadFailed = false; @@ -337,7 +337,7 @@ CPSAPILib::CPSAPILib() EnumProcessModules = NULL; } -//**************************************************************************************************************** +// **************************************************************************************************************** CPSAPILib::~CPSAPILib() { if (_PSAPILibHandle) @@ -346,7 +346,7 @@ CPSAPILib::~CPSAPILib() } } -//**************************************************************************************************************** +// **************************************************************************************************************** bool CPSAPILib::init() { // @@ -381,7 +381,7 @@ static CPSAPILib PSAPILib; -//**************************************************************************************************************** +// **************************************************************************************************************** bool CWinProcess::enumProcessesId(std::vector &processesId) { if (!PSAPILib.init()) return false; @@ -407,7 +407,7 @@ bool CWinProcess::enumProcessesId(std::vector &processesId) return true; } -//**************************************************************************************************************** +// **************************************************************************************************************** bool CWinProcess::enumProcessModules(uint32 processId, std::vector &moduleNames) { if (!PSAPILib.init()) return false; @@ -445,7 +445,7 @@ bool CWinProcess::enumProcessModules(uint32 processId, std::vector return true; } -//**************************************************************************************************************** +// **************************************************************************************************************** uint32 CWinProcess::getProcessIdFromModuleFilename(const std::string &moduleFileName) { std::vector processesId; @@ -467,7 +467,7 @@ uint32 CWinProcess::getProcessIdFromModuleFilename(const std::string &moduleFile return 0; } -//**************************************************************************************************************** +// **************************************************************************************************************** bool CWinProcess::terminateProcess(uint32 processId, uint exitCode) { if (!processId) return false; @@ -478,7 +478,7 @@ bool CWinProcess::terminateProcess(uint32 processId, uint exitCode) return ok != FALSE; } -//**************************************************************************************************************** +// **************************************************************************************************************** bool CWinProcess::terminateProcessFromModuleName(const std::string &moduleName, uint exitCode) { return terminateProcess(getProcessIdFromModuleFilename(moduleName), exitCode); diff --git a/code/nel/src/net/CMakeLists.txt b/code/nel/src/net/CMakeLists.txt index 388933c44..7a74e3b43 100644 --- a/code/nel/src/net/CMakeLists.txt +++ b/code/nel/src/net/CMakeLists.txt @@ -9,6 +9,8 @@ SET(NLNET_LIB ${LIBNAME}) IF(NOT WIN32) ADD_LIBRARY(nelnet SHARED ${SRC}) + CONFIGURE_FILE(nel-net.pc.in nel-net.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-net.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nelnet STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/net/nel-net.pc.in b/code/nel/src/net/nel-net.pc.in new file mode 100644 index 000000000..0fb2a0462 --- /dev/null +++ b/code/nel/src/net/nel-net.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: nel-net +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ +Reqiures: +Libs: -L${libdir} +Libs.private: @LIBS@ -lc -lpthread -lrt -ldl +Cflags: -I${includedir} -lc -lpthread -lrt -ldl diff --git a/code/nel/src/pacs/CMakeLists.txt b/code/nel/src/pacs/CMakeLists.txt index 3cfdb7a85..aacf96673 100644 --- a/code/nel/src/pacs/CMakeLists.txt +++ b/code/nel/src/pacs/CMakeLists.txt @@ -2,6 +2,8 @@ FILE(GLOB SRC *.cpp *.h) IF(NOT WIN32) ADD_LIBRARY(nelpacs SHARED ${SRC}) + CONFIGURE_FILE(nel-pacs.pc.in nel-pacs.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-pacs.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nelpacs STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/pacs/nel-pacs.pc.in b/code/nel/src/pacs/nel-pacs.pc.in new file mode 100644 index 000000000..133b51d53 --- /dev/null +++ b/code/nel/src/pacs/nel-pacs.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: nel-pacs +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ +Reqiures: +Libs: -L${libdir} +Libs.private: @LIBS@ -lc -lpthread -lrt -ldl +Cflags: -I${includedir} -lc -lpthread -lrt -ldl diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 63f21b127..268ca9dc4 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -8,6 +8,8 @@ ENDIF(APPLE) IF(NOT WIN32) ADD_LIBRARY(nelsound SHARED ${SRC}) + CONFIGURE_FILE(nel-sound.pc.in nel-sound.pc) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-sound.pc" DESTINATION lib/pkgconfig) ELSE(NOT WIN32) ADD_LIBRARY(nelsound STATIC ${SRC}) ENDIF(NOT WIN32) diff --git a/code/nel/src/sound/driver/openal/CMakeLists.txt b/code/nel/src/sound/driver/openal/CMakeLists.txt index edc428acc..7dbacd820 100644 --- a/code/nel/src/sound/driver/openal/CMakeLists.txt +++ b/code/nel/src/sound/driver/openal/CMakeLists.txt @@ -8,6 +8,11 @@ SET_TARGET_PROPERTIES(nel_drv_openal PROPERTIES VERSION ${NL_VERSION}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WIN32) + # Find and include EFX-Util on Windows. + FIND_PACKAGE(EFXUtil) + INCLUDE_DIRECTORIES(${EFXUTIL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(nel_drv_openal ${EFXUTIL_LIBRARY}) + SET_TARGET_PROPERTIES(nel_drv_openal PROPERTIES COMPILE_FLAGS "/Yustdopenal.h") SET_SOURCE_FILES_PROPERTIES(stdopenal.cpp PROPERTIES COMPILE_FLAGS "/Ycstdopenal.h") SET_TARGET_PROPERTIES(nel_drv_openal PROPERTIES diff --git a/code/nel/src/sound/nel-sound.pc.in b/code/nel/src/sound/nel-sound.pc.in new file mode 100644 index 000000000..9994e967e --- /dev/null +++ b/code/nel/src/sound/nel-sound.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: nel-sound +Version: @NL_VERSION@ +Description: NeL @NL_VERSION@ +Reqiures: +Libs: -L${libdir} +Libs.private: @LIBS@ -lc -lpthread -lrt -ldl +Cflags: -I${includedir} -lc -lpthread -lrt -ldl diff --git a/code/nel/tools/3d/panoply_maker/CMakeLists.txt b/code/nel/tools/3d/panoply_maker/CMakeLists.txt index 8bdc5fea8..62b644c86 100644 --- a/code/nel/tools/3d/panoply_maker/CMakeLists.txt +++ b/code/nel/tools/3d/panoply_maker/CMakeLists.txt @@ -2,8 +2,10 @@ FILE(GLOB SRC *.cpp *.h ../s3tc_compressor_lib/*.h ../s3tc_compressor_lib/*.cpp) ADD_EXECUTABLE(panoply_maker ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${S3TC_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(panoply_maker ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} ${S3TC_LIBRARY} nelmisc nel3d) +FIND_PACKAGE(Squish REQUIRED) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${SQUISH_INCLUDE_DIR}) +TARGET_LINK_LIBRARIES(panoply_maker ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} ${SQUISH_LIBRARY} nelmisc nel3d) IF(WIN32) SET_TARGET_PROPERTIES(panoply_maker PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libcmt /NODEFAULTLIB:libc" diff --git a/code/ryzom/CMakeModules/FindLibwww.cmake b/code/ryzom/CMakeModules/FindLibwww.cmake index 6c053e0e3..05c9733a8 100644 --- a/code/ryzom/CMakeModules/FindLibwww.cmake +++ b/code/ryzom/CMakeModules/FindLibwww.cmake @@ -38,7 +38,9 @@ FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR ) # combine both include directories into one variable -SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR}) +IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) + SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR}) +ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) # helper to find all the libwww sub libraries MACRO(FIND_WWW_LIBRARY MYLIBRARY) @@ -74,7 +76,6 @@ FIND_WWW_LIBRARY(LIBWWWINIT_LIBRARY wwwinit) FIND_WWW_LIBRARY(LIBWWWMIME_LIBRARY wwwmime) FIND_WWW_LIBRARY(LIBWWWMUX_LIBRARY wwwmux) FIND_WWW_LIBRARY(LIBWWWNEWS_LIBRARY wwwnews) -FIND_WWW_LIBRARY(LIBWWWSSL_LIBRARY wwwssl) FIND_WWW_LIBRARY(LIBWWWSTREAM_LIBRARY wwwstream) FIND_WWW_LIBRARY(LIBWWWTELNET_LIBRARY wwwtelnet) FIND_WWW_LIBRARY(LIBWWWTRANS_LIBRARY wwwtrans) @@ -88,7 +89,7 @@ SET(LIBWWW_LIBRARY ${LIBWWWCORE_LIBRARY} ${LIBWWWDIR_LIBRARY} ${LIBWWWFILE_LIBRARY} ${LIBWWWFTP_LIBRARY} ${LIBWWWGOPHER_LIBRARY} ${LIBWWWHTML_LIBRARY} ${LIBWWWHTTP_LIBRARY} ${LIBWWWINIT_LIBRARY} ${LIBWWWMIME_LIBRARY} - ${LIBWWWMUX_LIBRARY} ${LIBWWWNEWS_LIBRARY} ${LIBWWWSSL_LIBRARY} + ${LIBWWWMUX_LIBRARY} ${LIBWWWNEWS_LIBRARY} ${LIBWWWSTREAM_LIBRARY} ${LIBWWWTELNET_LIBRARY} ${LIBWWWTRANS_LIBRARY} ${LIBWWWUTILS_LIBRARY} ${LIBWWWXML_LIBRARY} ${LIBWWWZIP_LIBRARY} diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 763433c9a..0f0df597f 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -44,22 +44,22 @@ if(APPLE) SET(MACOSX_BUNDLE_BUNDLE_VERSION "1.0") SET(MACOSX_BUNDLE_COPYRIGHT "Winchgate and The Ryzom Core Community") - ADD_EXECUTABLE(client MACOSX_BUNDLE ${SRC}) + ADD_EXECUTABLE(ryzom_client MACOSX_BUNDLE ${SRC}) # TODO: in release mode, cmake could copy all the dylibs into the .app # bundle for redistribution... should some part of cpack handle that? - # ADD_CUSTOM_COMMAND(TARGET client POST_BUILD + # ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD # # make frameworks directory in app bundle # COMMAND ${CMAKE_COMMAND} -E make_directory - # ${CMAKE_CURRENT_BINARY_DIR}/client.app/Contents/Frameworks + # ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks # # copy framework into app bundle # COMMAND ${CMAKE_COMMAND} -E copy ${SOME_LIBRARY} - # ${CMAKE_CURRENT_BINARY_DIR}/client.app/Contents/Frameworks + # ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks # # ... # # install_name_tool the lib pathes ELSE(APPLE) - ADD_EXECUTABLE(client ${SRC}) + ADD_EXECUTABLE(ryzom_client ${SRC}) ENDIF(APPLE) INCLUDE_DIRECTORIES( @@ -70,10 +70,10 @@ INCLUDE_DIRECTORIES( ${CURL_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) -TARGET_LINK_LIBRARIES(client ${PLATFORM_LINKFLAGS} +TARGET_LINK_LIBRARIES(ryzom_client ${PLATFORM_LINKFLAGS} ${LIBXML2_LIBRARIES} ${NELMISC_LIBRARY} - game_share + ryzom_gameshare ${NELNET_LIBRARY} ${NELLIGO_LIBRARY} ${NELGEORGES_LIBRARY} @@ -82,18 +82,17 @@ TARGET_LINK_LIBRARIES(client ${PLATFORM_LINKFLAGS} ${CURL_LIBRARIES} ${NELSOUND_LIBRARY} ${NELSNDDRV_LIBRARY} - client_sheets + ryzom_clientsheets ${NELPACS_LIBRARY} ${LIBWWW_LIBRARY} - ${Boost_LIBRARIES} - seven_zip + ryzom_sevenzip luabind # TODO: find luabind and expat cleanly using a find script expat) IF(NOT WITH_COCOA) - TARGET_LINK_LIBRARIES(client ${X11_LIBRARIES}) + TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES}) ENDIF(NOT WITH_COCOA) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -INSTALL(TARGETS client RUNTIME DESTINATION bin COMPONENT client BUNDLE DESTINATION /Applications) +INSTALL(TARGETS ryzom_client RUNTIME DESTINATION bin COMPONENT client BUNDLE DESTINATION /Applications) diff --git a/code/ryzom/client/src/animation_fx.cpp b/code/ryzom/client/src/animation_fx.cpp index a869c366a..92bc34c16 100644 --- a/code/ryzom/client/src/animation_fx.cpp +++ b/code/ryzom/client/src/animation_fx.cpp @@ -124,9 +124,9 @@ NL3D::UParticleSystemInstance CAnimationFX::createMatchingInstance(const float * return fx; }// createMatchingInstance // -//******************************************************************************* +// ******************************************************************************* // CAnimationFXSet -//******************************************************************************* +// ******************************************************************************* //----------------------------------------------- // init diff --git a/code/ryzom/client/src/animation_fx_id_array.cpp b/code/ryzom/client/src/animation_fx_id_array.cpp index ac3e6ffed..c95f54495 100644 --- a/code/ryzom/client/src/animation_fx_id_array.cpp +++ b/code/ryzom/client/src/animation_fx_id_array.cpp @@ -25,13 +25,13 @@ extern NL3D::UScene *Scene; -//********************************************************************* +// ********************************************************************* CAnimationFXIDArray::CAnimationFXIDArray() { _AnimSet = NULL; } -//********************************************************************* +// ********************************************************************* void CAnimationFXIDArray::release() { _IDToFXArray.clear(); @@ -42,7 +42,7 @@ void CAnimationFXIDArray::release() _AnimSet = NULL; } -//********************************************************************* +// ********************************************************************* void CAnimationFXIDArray::init(const CIDToStringArraySheet &sheet, NL3D::UAnimationSet *animSet, bool mustDeleteAnimSet /* = false*/) { release(); @@ -66,7 +66,7 @@ void CAnimationFXIDArray::init(const CIDToStringArraySheet &sheet, NL3D::UAnimat } } -//********************************************************************* +// ********************************************************************* void CAnimationFXIDArray::init(const std::string &sheetName, NL3D::UAnimationSet *animSet, bool mustDeleteAnimSet /*= false*/) { CIDToStringArraySheet *array = dynamic_cast(SheetMngr.get(NLMISC::CSheetId(sheetName))); @@ -77,7 +77,7 @@ void CAnimationFXIDArray::init(const std::string &sheetName, NL3D::UAnimationSet } -//********************************************************************* +// ********************************************************************* const CAnimationFX *CAnimationFXIDArray::getFX(uint32 id) const { // after init, element are sorted by ids diff --git a/code/ryzom/client/src/attached_fx.cpp b/code/ryzom/client/src/attached_fx.cpp index a2715826d..e54476ac8 100644 --- a/code/ryzom/client/src/attached_fx.cpp +++ b/code/ryzom/client/src/attached_fx.cpp @@ -35,19 +35,19 @@ using namespace NL3D; extern CUserEntity *UserEntity; -//************************************************************************************* +// ************************************************************************************* CAttachedFX::CAttachedFX() { clear(); } -//************************************************************************************* +// ************************************************************************************* CAttachedFX::~CAttachedFX() { clear(); } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CAttachedFX::clear() { if (!FX.empty()) @@ -70,7 +70,7 @@ void CAttachedFX::clear() TargeterUserBoneID = 0xff; } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CAttachedFX::create(CCharacterCL &parent, const CBuildInfo &buildInfo, const CTargeterInfo &targeterInfo @@ -84,7 +84,7 @@ void CAttachedFX::create(CCharacterCL &parent, create(parent, instance, buildInfo, targeterInfo); } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CAttachedFX::create(CCharacterCL &parent, NL3D::UParticleSystemInstance instance, const CBuildInfo &buildInfo, @@ -216,7 +216,7 @@ void CAttachedFX::create(CCharacterCL &parent, } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CAttachedFX::evalTargeterStickPos(NLMISC::CVector &dest) const { CEntityCL *targeter = EntitiesMngr.entity(TargeterInfo.Slot); @@ -256,7 +256,7 @@ void CAttachedFX::evalTargeterStickPos(NLMISC::CVector &dest) const }; } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CAttachedFX::update(CCharacterCL &parent, const NLMISC::CMatrix &alignMatrix) { if (AniFX && !FX.empty()) diff --git a/code/ryzom/client/src/attack_list.cpp b/code/ryzom/client/src/attack_list.cpp index 829cb78ac..08c2f3581 100644 --- a/code/ryzom/client/src/attack_list.cpp +++ b/code/ryzom/client/src/attack_list.cpp @@ -66,13 +66,13 @@ static void buildAttackPart(const std::string &sheetName, CAnimationFXSet &fxSet } } -//*********************************************************************************************** +// *********************************************************************************************** CAttack::CAttack() { Sheet = NULL; } -//*********************************************************************************************** +// *********************************************************************************************** void CAttack::init(const CAttackSheet *sheet, NL3D::UAnimationSet *as) { nlassert(!Sheet); // init already done @@ -88,7 +88,7 @@ void CAttack::init(const CAttackSheet *sheet, NL3D::UAnimationSet *as) buildAttackPart(Sheet->ImpactFX, ImpactFX, as); } -//*********************************************************************************************** +// *********************************************************************************************** void CAttackList::init(const CAttackListSheet *attackList, NL3D::UAnimationSet *as) { nlassert(_Attacks.empty()); @@ -125,7 +125,7 @@ struct CAttackEntryComp2 } }; -//*********************************************************************************************** +// *********************************************************************************************** const CAttack *CAttackList::getAttackFromID(const CAttackIDSheet &id) const { H_AUTO_USE(RZ_AttackList); @@ -139,7 +139,7 @@ const CAttack *CAttackList::getAttackFromID(const CAttackIDSheet &id) const return &(it->Attack); } -//*********************************************************************************************** +// *********************************************************************************************** CAttackListManager &CAttackListManager::getInstance() { H_AUTO_USE(RZ_AttackList) @@ -148,7 +148,7 @@ CAttackListManager &CAttackListManager::getInstance() return *_Instance; } -//*********************************************************************************************** +// *********************************************************************************************** void CAttackListManager::releaseInstance() { if( _Instance ) @@ -156,7 +156,7 @@ void CAttackListManager::releaseInstance() _Instance = NULL; } -//*********************************************************************************************** +// *********************************************************************************************** void CAttackListManager::init() { if (_AnimationSet) return; // init already done @@ -185,7 +185,7 @@ void CAttackListManager::init() buildLinkFXs(); } -//*********************************************************************************************** +// *********************************************************************************************** void CAttackListManager::release() { if (!_AnimationSet) return; @@ -197,7 +197,7 @@ void CAttackListManager::release() _Instance = NULL; } -//*********************************************************************************************** +// *********************************************************************************************** const CAttackList *CAttackListManager::getAttackList(const std::string &name) const { H_AUTO_USE(RZ_AttackList) @@ -206,19 +206,19 @@ const CAttackList *CAttackListManager::getAttackList(const std::string &name) co return NULL; } -//*********************************************************************************************** +// *********************************************************************************************** CAttackListManager::CAttackListManager() { _AnimationSet = NULL; } -//******************************************************************************************* +// ******************************************************************************************* void CAttackListManager::buildAurasFXs() { _Auras.init("auras.id_to_string_array", _AnimationSet, false /* must not delete animset, owned by this object */); } -//******************************************************************************************* +// ******************************************************************************************* void CAttackListManager::buildLinkFXs() { _Links.init("links.id_to_string_array", _AnimationSet, false /* must not delete animset, owned by this object */); diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index a32db185f..c9e4c87da 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -2291,6 +2291,8 @@ void CCharacterCL::endAnimTransition() dir(front()); */ break; + default: + break; } // Change the current mode. if ( _ModeWanted != MBEHAV::UNKNOWN_MODE ) @@ -2658,6 +2660,8 @@ KeyChosen: else nlwarning("CH::setAnim:%d: automaton '%s': state '%s': OnMoveRight '%s' is not valid.", _Slot, _CurrentAutomaton.c_str(), CAnimationState::getAnimationStateName(curAnimState.MoveState).c_str(), CAnimationState::getAnimationStateName(curAnimState.OnMoveRight).c_str()); break; + default: + break; } // On Rotation/About Face @@ -2684,6 +2688,8 @@ KeyChosen: else nlwarning("CH::setAnim:%d: automaton '%s': state '%s': OnRightRotation '%s' is not valid.", _Slot, _CurrentAutomaton.c_str(), CAnimationState::getAnimationStateName(curAnimState.MoveState).c_str(), CAnimationState::getAnimationStateName(curAnimState.OnRightRotation).c_str()); break; + default: + break; } // Max Loop @@ -2729,6 +2735,8 @@ KeyChosen: else nlwarning("CH::setAnim:%d: automaton '%s': state '%s': OnBigBendRight '%s' is not valid.", _Slot, _CurrentAutomaton.c_str(), CAnimationState::getAnimationStateName(curAnimState.MoveState).c_str(), CAnimationState::getAnimationStateName(curAnimState.OnBigBendRight).c_str()); break; + default: + break; } // If the animation change according to a high speed and speed high enough or oo. @@ -3084,6 +3092,7 @@ KeyChosen: case MAGICFX::CastLoop: afs = &_CurrentAttack->AttackLoopFX; break; case MAGICFX::CastEnd: afs = &_CurrentAttack->AttackEndFX; break; case MAGICFX::CastFail: afs = &_CurrentAttack->AttackFailFX; break; + default: break; } playCastFX(afs, _CurrentAttackInfo.Intensity); } @@ -3444,6 +3453,8 @@ ADD_METHOD(void CCharacterCL::updateAnimationState()) case OnMoveRight: setAnim(_CurrentState->OnMoveRight); return; + default: + break; } // ON ROTATION @@ -3458,6 +3469,8 @@ ADD_METHOD(void CCharacterCL::updateAnimationState()) case OnRotRight: setAnim(CAnimationStateSheet::Idle); return; + default: + break; } // ON BAD HEADING @@ -3475,6 +3488,8 @@ ADD_METHOD(void CCharacterCL::updateAnimationState()) case OnBendRight: setAnim(_CurrentState->MoveState); return; + default: + break; } // \todo GUIGUI : changer de place cette partie je pense. @@ -3640,6 +3655,8 @@ void CCharacterCL::beginCast(const MBEHAV::CBehaviour &behaviour) case MBEHAV::CAST_STUN: setAnim(CAnimationStateSheet::StunCastInit); break; + default: + break; } }// beginCast // @@ -3746,6 +3763,8 @@ void CCharacterCL::endCast(const MBEHAV::CBehaviour &behaviour, const MBEHAV::CB case MBEHAV::CAST_MIX_LINK: setAnim(CAnimationStateSheet::MixedCastLink); break; + default: + break; } } break; @@ -3754,7 +3773,7 @@ void CCharacterCL::endCast(const MBEHAV::CBehaviour &behaviour, const MBEHAV::CB }// endCast // -//************************************************************************************************* +// ************************************************************************************************* void CCharacterCL::updateCurrentAttack() { // This is a behaviour for the magic. @@ -3842,7 +3861,7 @@ inline static void getResistAndDistance(uint8 packedInfo, bool isDirectAttack, b resist = (packedInfo & 128) != 0; } -//********************************************************************************************* +// ********************************************************************************************* void CCharacterCL::performCurrentAttackEnd(const CBehaviourContext &bc, bool directOffensifSpell, vector &targetHitDates, TAnimStateKey animForCombat) { if (!_CurrentAttack) return; @@ -4213,7 +4232,7 @@ void CCharacterCL::performCurrentAttackEnd(const CBehaviourContext &bc, bool dir */ } -//********************************************************************************************* +// ********************************************************************************************* void CCharacterCL::buildStaticObjectCastFX(const NLMISC::CVector &castWorldOrigin, NLMISC::CVector &castWorldPos, const CAttackSheet &/* sheet */, uint intensity) { if (intensity == 0) return; @@ -4250,7 +4269,7 @@ void CCharacterCL::buildStaticObjectCastFX(const NLMISC::CVector &castWorldOrigi } } -//********************************************************************************************* +// ********************************************************************************************* void CCharacterCL::computeTargetStickMode(const CAttackSheet &sheet, const CAttackInfo &attackInfo, CFXStickMode &dest, CEntityCL &target) { bool hasPhysicalImpact = false; @@ -4290,7 +4309,7 @@ void CCharacterCL::computeTargetStickMode(const CAttackSheet &sheet, const CAtta } -//********************************************************************************************* +// ********************************************************************************************* bool CCharacterCL::createCurrentAttackEndPart(CProjectileBuild &destPB, const CAttack *currentAttack, const CCharacterCL &target, @@ -4393,7 +4412,7 @@ bool CCharacterCL::createCurrentAttackEndPart(CProjectileBuild &destPB, } -//********************************************************************************************* +// ********************************************************************************************* void CCharacterCL::computeBestCastRay(CEntityCL &targetEntity, const CFXStickMode &targetStickMode, NLMISC::CVector &castWorldOrigin, @@ -4425,7 +4444,7 @@ void CCharacterCL::computeBestCastRay(CEntityCL &targetEntity, } } -//********************************************************************************************* +// ********************************************************************************************* bool CCharacterCL::isCurrentBehaviourAttackEnd() const { switch(_CurrentBehaviour.Behaviour) @@ -4443,8 +4462,9 @@ bool CCharacterCL::isCurrentBehaviourAttackEnd() const case MBEHAV::POWERFUL_ATTACK: case MBEHAV::AREA_ATTACK: return true; + default: + return false; } - return false; } @@ -4627,6 +4647,8 @@ void CCharacterCL::applyBehaviour(const CBehaviourContext &bc) // virtual case RANGE_ATTACK: combatAnimState= CAnimationStateSheet::Attack1; break; + default: + break; } } } @@ -8928,7 +8950,7 @@ void CCharacterCL::attachFX(const CAttachedFX::TSmartPtr fx) -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::setAuraFX(uint index, const CAnimationFX *sheet) { nlassert(index < MaxNumAura); @@ -8959,7 +8981,7 @@ void CCharacterCL::setAuraFX(uint index, const CAnimationFX *sheet) } } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::setLinkFX(const CAnimationFX *fx, const CAnimationFX *dispell) { // no-op if same link @@ -8989,7 +9011,7 @@ void CCharacterCL::setLinkFX(const CAnimationFX *fx, const CAnimationFX *dispell -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::startItemAttackFXs(bool activateTrails, uint intensity) { uint numItems = (uint)_Items.size(); @@ -9000,7 +9022,7 @@ void CCharacterCL::startItemAttackFXs(bool activateTrails, uint intensity) } } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::stopItemAttackFXs() { uint numItems = (uint)_Items.size(); @@ -9083,7 +9105,7 @@ void CCharacterCL::applyVisualFX(sint64 prop) setLinkFX(linkFX, dispellFX); } -//********************************************************************************************* +// ********************************************************************************************* const char *CCharacterCL::getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TSide side) const { if (!_Sheet) return CEntityCL::getBoneNameFromBodyPart(part, side); @@ -9091,14 +9113,14 @@ const char *CCharacterCL::getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TS } -//********************************************************************************************* +// ********************************************************************************************* const CItemSheet *CCharacterCL::getRightHandItemSheet() const { if (_RHandInstIdx == CEntityCL::BadIndex) return NULL; return _Items[_RHandInstIdx].Sheet; } -//********************************************************************************************* +// ********************************************************************************************* const CItemSheet *CCharacterCL::getLeftHandItemSheet() const { if (_LHandInstIdx == CEntityCL::BadIndex) return NULL; @@ -9120,7 +9142,7 @@ void CCharacterCL::resetAllSoundAnimId() ///////////////////////////// -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::CWornItem::startAttackFX(NL3D::USkeleton skeleton, uint intensity, SLOTTYPE::EVisualSlot visualSlot, bool activateTrail) { if (intensity < 1 || intensity > 5) return; @@ -9151,6 +9173,8 @@ void CCharacterCL::CWornItem::startAttackFX(NL3D::USkeleton skeleton, uint inten else stickPoint = "box_arme_gauche"; break; + default: + break; } } if (stickPoint) @@ -9203,13 +9227,13 @@ void CCharacterCL::CWornItem::startAttackFX(NL3D::USkeleton skeleton, uint inten } } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::CWornItem::stopAttackFX() { if (!Trail.empty()) Trail.stop(); } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::CWornItem::initFXs(SLOTTYPE::EVisualSlot /* visualSlot */, NL3D::UInstance parent) { releaseFXs(); @@ -9236,7 +9260,7 @@ void CCharacterCL::CWornItem::initFXs(SLOTTYPE::EVisualSlot /* visualSlot */, NL } } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::CWornItem::enableAdvantageFX(NL3D::UInstance parent) { if (!Sheet) return; @@ -9278,7 +9302,7 @@ void CCharacterCL::CWornItem::enableAdvantageFX(NL3D::UInstance parent) } } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::CWornItem::releaseFXs() { if (Scene) @@ -9290,7 +9314,7 @@ void CCharacterCL::CWornItem::releaseFXs() } } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::CWornItem::setTrailSize(uint size) { if (Trail.empty()) return; @@ -9308,14 +9332,14 @@ void CCharacterCL::CWornItem::setTrailSize(uint size) } -//*********************************************************************************************************************** +// *********************************************************************************************************************** const CAttack *CCharacterCL::getAttack(const CAttackIDSheet &id) const { if (!_Sheet) return NULL; return getAttack(id, _Sheet->AttackLists); } -//*********************************************************************************************************************** +// *********************************************************************************************************************** const CAttack *CCharacterCL::getAttack(const CAttackIDSheet &id, const std::vector &attackList) const { for(std::vector::const_reverse_iterator it = attackList.rbegin(); it != attackList.rend(); ++it) @@ -9331,7 +9355,7 @@ const CAttack *CCharacterCL::getAttack(const CAttackIDSheet &id, const std::vect } -//*********************************************************************************************************************** +// *********************************************************************************************************************** void CCharacterCL::initStaticFX() { _StaticFX = NULL; diff --git a/code/ryzom/client/src/client_sheets/CMakeLists.txt b/code/ryzom/client/src/client_sheets/CMakeLists.txt index 775a3fd1c..541fd6852 100644 --- a/code/ryzom/client/src/client_sheets/CMakeLists.txt +++ b/code/ryzom/client/src/client_sheets/CMakeLists.txt @@ -5,26 +5,23 @@ SOURCE_GROUP(headers FILES ${PRIV_H} ${PUB_H}) IF(NOT WIN32) - ADD_LIBRARY(client_sheets SHARED ${SRC}) + ADD_LIBRARY(ryzom_clientsheets SHARED ${SRC}) ELSE(NOT WIN32) - ADD_LIBRARY(client_sheets STATIC ${SRC}) + ADD_LIBRARY(ryzom_clientsheets STATIC ${SRC}) ENDIF(NOT WIN32) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(client_sheets game_share ${NELMISC_LIBRARY}) -SET_TARGET_PROPERTIES(client_sheets PROPERTIES VERSION ${NL_VERSION}) +INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIR}) +TARGET_LINK_LIBRARIES(ryzom_clientsheets ryzom_gameshare ${NELMISC_LIBRARY}) +SET_TARGET_PROPERTIES(ryzom_clientsheets PROPERTIES VERSION ${NL_VERSION}) IF(WIN32) - SET_TARGET_PROPERTIES(client_sheets PROPERTIES COMPILE_FLAGS "/Yustdpch.h") + SET_TARGET_PROPERTIES(ryzom_clientsheets PROPERTIES COMPILE_FLAGS "/Yustdpch.h") SET_SOURCE_FILES_PROPERTIES(stdpch.cpp PROPERTIES COMPILE_FLAGS "/Ycstdpch.h") - SET_TARGET_PROPERTIES(client_sheets + SET_TARGET_PROPERTIES(ryzom_clientsheets PROJECT_LABEL "Library: Client Sheets" DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:libc;libcmt;libcmtd;msvcrt" - LINK_FLAGS_RELEASE "/NODEFAULTLIB:libc;libcmt;libcmtd;msvcrtd") + LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt" ENDIF(WIN32) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) - -INSTALL(TARGETS client_sheets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +INSTALL(TARGETS ryzom_clientsheets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/ryzom/client/src/client_sheets/animation_fx_set_sheet.cpp b/code/ryzom/client/src/client_sheets/animation_fx_set_sheet.cpp index 199cd8266..11df8c4ca 100644 --- a/code/ryzom/client/src/client_sheets/animation_fx_set_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/animation_fx_set_sheet.cpp @@ -20,7 +20,7 @@ #include "animation_fx_set_sheet.h" #include "nel/georges/u_form_elm.h" -//**************************************************************************************************** +// **************************************************************************************************** CAnimationFXSetSheet::CAnimationFXSetSheet() { Type = ANIMATION_FX_SET; @@ -31,13 +31,13 @@ CAnimationFXSetSheet::CAnimationFXSetSheet() } } -//**************************************************************************************************** +// **************************************************************************************************** void CAnimationFXSetSheet::build(const NLGEORGES::UFormElm &item) { buildWithPrefix(item); } -//**************************************************************************************************** +// **************************************************************************************************** void CAnimationFXSetSheet::buildWithPrefix(const NLGEORGES::UFormElm &item, const std::string &prefix /*=""*/) { FX.clear(); @@ -55,7 +55,7 @@ void CAnimationFXSetSheet::buildWithPrefix(const NLGEORGES::UFormElm &item, cons } } -//**************************************************************************************************** +// **************************************************************************************************** void CAnimationFXSetSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialCont(FX); diff --git a/code/ryzom/client/src/client_sheets/attack_id_sheet.cpp b/code/ryzom/client/src/client_sheets/attack_id_sheet.cpp index 76a34a9e0..0780d76d2 100644 --- a/code/ryzom/client/src/client_sheets/attack_id_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/attack_id_sheet.cpp @@ -22,7 +22,7 @@ #include "nel/georges/u_form_elm.h" -//***************************************************************************************** +// ***************************************************************************************** void CAttackIDSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { uint32 attackType = 0; @@ -57,7 +57,7 @@ void CAttackIDSheet::build(const NLGEORGES::UFormElm &item, const std::string &p } } -//***************************************************************************************** +// ***************************************************************************************** void CAttackIDSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialEnum(Type); @@ -84,7 +84,7 @@ void CAttackIDSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) } } -//***************************************************************************************** +// ***************************************************************************************** void CAttackIDSheet::CSpellInfo::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { uint32 spellID = 0; @@ -95,14 +95,14 @@ void CAttackIDSheet::CSpellInfo::build(const NLGEORGES::UFormElm &item, const st Mode = (MAGICFX::TSpellMode) spellMode; } -//***************************************************************************************** +// ***************************************************************************************** void CAttackIDSheet::CSpellInfo::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialEnum(Mode); f.serialEnum(ID); } -//***************************************************************************************** +// ***************************************************************************************** bool operator == (const CAttackIDSheet &lhs, const CAttackIDSheet &rhs) { if (lhs.Type != rhs.Type) return false; @@ -117,7 +117,7 @@ bool operator == (const CAttackIDSheet &lhs, const CAttackIDSheet &rhs) } } -//***************************************************************************************** +// ***************************************************************************************** bool operator < (const CAttackIDSheet &lhs, const CAttackIDSheet &rhs) { if (lhs.Type != rhs.Type) return lhs.Type < rhs.Type; @@ -132,13 +132,13 @@ bool operator < (const CAttackIDSheet &lhs, const CAttackIDSheet &rhs) } } -//***************************************************************************************** +// ***************************************************************************************** bool operator == (const CAttackIDSheet::CSpellInfo &lhs, const CAttackIDSheet::CSpellInfo &rhs) { return lhs.Mode == rhs.Mode && lhs.ID == rhs.ID; } -//***************************************************************************************** +// ***************************************************************************************** bool operator < (const CAttackIDSheet::CSpellInfo &lhs, const CAttackIDSheet::CSpellInfo &rhs) { if (lhs.Mode != rhs.Mode) return lhs.Mode < rhs.Mode; diff --git a/code/ryzom/client/src/client_sheets/attack_list_sheet.cpp b/code/ryzom/client/src/client_sheets/attack_list_sheet.cpp index 02b281f36..4003e3c7b 100644 --- a/code/ryzom/client/src/client_sheets/attack_list_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/attack_list_sheet.cpp @@ -23,27 +23,27 @@ using namespace NLGEORGES; -//******************************************************************************************* +// ******************************************************************************************* CAttackListSheet::CAttackListSheet() { Type = ATTACK_LIST; } -//******************************************************************************************* +// ******************************************************************************************* void CAttackListSheetEntry::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { ID.build(item, prefix + "ID." ); Attack.build(item, prefix + "Attack."); } -//******************************************************************************************* +// ******************************************************************************************* void CAttackListSheetEntry::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(ID); f.serial(Attack); } -//******************************************************************************************* +// ******************************************************************************************* void CAttackListSheet::build(const NLGEORGES::UFormElm &item) { const UFormElm *attacks = NULL; @@ -64,7 +64,7 @@ void CAttackListSheet::build(const NLGEORGES::UFormElm &item) } } -//******************************************************************************************* +// ******************************************************************************************* void CAttackListSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialCont(Attacks); diff --git a/code/ryzom/client/src/client_sheets/attack_sheet.cpp b/code/ryzom/client/src/client_sheets/attack_sheet.cpp index c63d5ef4a..80732e759 100644 --- a/code/ryzom/client/src/client_sheets/attack_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/attack_sheet.cpp @@ -24,7 +24,7 @@ #include "nel/georges/u_form_loader.h" -//********************************************************************************************************* +// ********************************************************************************************************* CAttackSheet::CAttackSheet() { ProjectileDelay = 0.f; @@ -37,7 +37,7 @@ CAttackSheet::CAttackSheet() AdditionnalStartOffset.set(0.f, 0.f, 0.f); } -//********************************************************************************************************* +// ********************************************************************************************************* void CAttackSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { bool ok = true; @@ -71,7 +71,7 @@ void CAttackSheet::build(const NLGEORGES::UFormElm &item, const std::string &pre } } -//********************************************************************************************************* +// ********************************************************************************************************* void CAttackSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialEnum(ProjectileMode); diff --git a/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp b/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp index a841ec7b5..105378b26 100644 --- a/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp @@ -29,7 +29,7 @@ static void build(NLMISC::TSStringId &result, const NLGEORGES::UFormElm &item, c result = ClientSheetsStrings.add(str); } -//********************************************************************************************* +// ********************************************************************************************* CBodyToBoneSheet::CBodyToBoneSheet() { Head = 0; @@ -44,7 +44,7 @@ CBodyToBoneSheet::CBodyToBoneSheet() RightFoot = 0; } -//********************************************************************************************* +// ********************************************************************************************* void CBodyToBoneSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { ::build(Head, item, prefix, "Head"); @@ -59,7 +59,7 @@ void CBodyToBoneSheet::build(const NLGEORGES::UFormElm &item, const std::string ::build(RightFoot, item, prefix, "RightFoot"); } -//********************************************************************************************* +// ********************************************************************************************* void CBodyToBoneSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { ClientSheetsStrings.serial(f, Head); @@ -74,7 +74,7 @@ void CBodyToBoneSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) ClientSheetsStrings.serial(f, RightFoot); } -//********************************************************************************************* +// ********************************************************************************************* const char *CBodyToBoneSheet::getBoneName(BODY::TBodyPart part, BODY::TSide side) const { BODY::TBodyPart hominPart = BODY::getMatchingHominBodyPart(part); diff --git a/code/ryzom/client/src/client_sheets/flora_sheet.cpp b/code/ryzom/client/src/client_sheets/flora_sheet.cpp index a8bdf72f9..431017431 100644 --- a/code/ryzom/client/src/client_sheets/flora_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/flora_sheet.cpp @@ -23,14 +23,14 @@ using namespace NLGEORGES; -//*************************************************************************************************** +// *************************************************************************************************** CFloraSheet::CFloraSheet() { Type = FLORA; _TotalWeight = 0; } -//*************************************************************************************************** +// *************************************************************************************************** void CFloraSheet::build(const NLGEORGES::UFormElm &item) { const UFormElm *plantArray = NULL; @@ -55,7 +55,7 @@ void CFloraSheet::build(const NLGEORGES::UFormElm &item) item.getValueByName(MicroLifeThreshold, "MicroLifeThreshold"); } -//*************************************************************************************************** +// *************************************************************************************************** void CFloraSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialCont(_Plants); @@ -63,7 +63,7 @@ void CFloraSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) f.serial(_TotalWeight); } -//*************************************************************************************************** +// *************************************************************************************************** void CPlantInfo::build(const NLGEORGES::UFormElm &item) { item.getValueByName(SheetName, "File name"); @@ -74,14 +74,14 @@ void CPlantInfo::build(const NLGEORGES::UFormElm &item) } } -//*************************************************************************************************** +// *************************************************************************************************** void CPlantInfo::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(SheetName); f.serial(CumulatedWeight); } -//*************************************************************************************************** +// *************************************************************************************************** const CPlantInfo *CFloraSheet::getPlantInfoFromWeightedIndex(uint64 index) const { if (_TotalWeight == 0) return NULL; diff --git a/code/ryzom/client/src/client_sheets/id_to_string_array.cpp b/code/ryzom/client/src/client_sheets/id_to_string_array.cpp index 016d0ac3f..4ea38f7d1 100644 --- a/code/ryzom/client/src/client_sheets/id_to_string_array.cpp +++ b/code/ryzom/client/src/client_sheets/id_to_string_array.cpp @@ -22,13 +22,13 @@ using namespace NLGEORGES; -//**************************************************************************************** +// **************************************************************************************** CIDToStringArraySheet::CIDToStringArraySheet() { Type = ID_TO_STRING_ARRAY; } -//******************************************************************************************* +// ******************************************************************************************* void CIDToStringArraySheet::build(const NLGEORGES::UFormElm &item) { const UFormElm *stringArray = NULL; @@ -50,20 +50,20 @@ void CIDToStringArraySheet::build(const NLGEORGES::UFormElm &item) } } -//******************************************************************************************* +// ******************************************************************************************* void CIDToStringArraySheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialCont(Array); } -//******************************************************************************************* +// ******************************************************************************************* void CIDToString::build(const NLGEORGES::UFormElm &item) { item.getValueByName(String, "String"); item.getValueByName(ID, "ID"); } -//******************************************************************************************* +// ******************************************************************************************* void CIDToString::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(ID); diff --git a/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp b/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp index 26c1a145c..4e81fea65 100644 --- a/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp @@ -20,7 +20,7 @@ #include "item_fx_sheet.h" #include "nel/georges/u_form_elm.h" -//******************************************************************************************* +// ******************************************************************************************* CItemFXSheet::CItemFXSheet() { _Trail = 0; @@ -32,7 +32,7 @@ CItemFXSheet::CItemFXSheet() AttackFXRot.set(0.f, 0.f, 0.f); } -//******************************************************************************************* +// ******************************************************************************************* void CItemFXSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { std::string trail; @@ -72,7 +72,7 @@ void CItemFXSheet::build(const NLGEORGES::UFormElm &item, const std::string &pre } } -//******************************************************************************************* +// ******************************************************************************************* void CItemFXSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(TrailMinSliceTime); @@ -86,25 +86,25 @@ void CItemFXSheet::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serialCont(_StaticFXs); } -//******************************************************************************************* +// ******************************************************************************************* const char *CItemFXSheet::getTrail() const { return _Trail ? ClientSheetsStrings.get(_Trail) : ""; } -//******************************************************************************************* +// ******************************************************************************************* const char *CItemFXSheet::getAdvantageFX() const { return _AdvantageFX ? ClientSheetsStrings.get(_AdvantageFX) : ""; } -//******************************************************************************************* +// ******************************************************************************************* const char *CItemFXSheet::getAttackFX() const { return _AttackFX ? ClientSheetsStrings.get(_AttackFX) : ""; } -//******************************************************************************************* +// ******************************************************************************************* void CItemFXSheet::CStaticFX::build(const NLGEORGES::UFormElm &item) { std::string name; @@ -118,7 +118,7 @@ void CItemFXSheet::CStaticFX::build(const NLGEORGES::UFormElm &item) item.getValueByName(Offset.z, "OffsetZ"); } -//******************************************************************************************* +// ******************************************************************************************* void CItemFXSheet::CStaticFX::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { ClientSheetsStrings.serial(f, Name); @@ -126,21 +126,21 @@ void CItemFXSheet::CStaticFX::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serial(Offset); } -//******************************************************************************************* +// ******************************************************************************************* const char *CItemFXSheet::getStaticFXName(uint index) const { nlassert(index < _StaticFXs.size()); return _StaticFXs[index].Name ? ClientSheetsStrings.get(_StaticFXs[index].Name) : ""; } -//******************************************************************************************* +// ******************************************************************************************* const char *CItemFXSheet::getStaticFXBone(uint index) const { nlassert(index < _StaticFXs.size()); return _StaticFXs[index].Bone ? ClientSheetsStrings.get(_StaticFXs[index].Bone) : ""; } -//******************************************************************************************* +// ******************************************************************************************* const NLMISC::CVector &CItemFXSheet::getStaticFXOffset(uint index) const { nlassert(index < _StaticFXs.size()); diff --git a/code/ryzom/client/src/client_sheets/sky_object_sheet.cpp b/code/ryzom/client/src/client_sheets/sky_object_sheet.cpp index 47c385f88..06f967fb9 100644 --- a/code/ryzom/client/src/client_sheets/sky_object_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/sky_object_sheet.cpp @@ -21,7 +21,7 @@ // CSkyObjectSheet::CColorInfo // ///////////////////////////////// -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::CColorInfoSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { item.getValueByName(MapName, (prefix + "MapName").c_str()); @@ -30,7 +30,7 @@ void CSkyObjectSheet::CColorInfoSheet::build(const NLGEORGES::UFormElm &item, co Mode = (TSkyColorMode) mode; } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::CColorInfoSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(MapName); @@ -41,7 +41,7 @@ void CSkyObjectSheet::CColorInfoSheet::serial(class NLMISC::IStream &f) throw(NL // CSkyObjectSheet::CColorGradientInfo // ///////////////////////////////////////// -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::CColorGradientInfoSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { item.getValueByName(TargetTextureStage, (prefix + "TargetTextureStage").c_str()); @@ -59,7 +59,7 @@ void CSkyObjectSheet::CColorGradientInfoSheet::build(const NLGEORGES::UFormElm & } } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::CColorGradientInfoSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(TargetTextureStage); @@ -70,7 +70,7 @@ void CSkyObjectSheet::CColorGradientInfoSheet::serial(class NLMISC::IStream &f) // CSkyObjectSheet::CVersion // /////////////////////////////// -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::CVersionSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { item.getValueByName(ShapeName, (prefix + "ShapeName").c_str()); @@ -101,7 +101,7 @@ void CSkyObjectSheet::CVersionSheet::build(const NLGEORGES::UFormElm &item, cons } } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::CVersionSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(ShapeName); @@ -125,14 +125,14 @@ void CSkyObjectSheet::CVersionSheet::serial(class NLMISC::IStream &f) throw(NLMI // CSkyObjectSheet // ///////////////////// -//***************************************************************************************************** +// ***************************************************************************************************** CSkyObjectSheet::CSkyObjectSheet() { VisibleInMainScene = true; VisibleInEnvMap = true; } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { Std.build(item, prefix + "StdVersion."); @@ -142,7 +142,7 @@ void CSkyObjectSheet::build(const NLGEORGES::UFormElm &item, const std::string & item.getValueByName(VisibleInEnvMap, (prefix + "VisibleInEnvMap").c_str()); } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkyObjectSheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(Std); diff --git a/code/ryzom/client/src/client_sheets/sky_sheet.cpp b/code/ryzom/client/src/client_sheets/sky_sheet.cpp index cfd434687..f0f492038 100644 --- a/code/ryzom/client/src/client_sheets/sky_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/sky_sheet.cpp @@ -17,7 +17,7 @@ #include "stdpch.h" #include "sky_sheet.h" -//***************************************************************************************************** +// ***************************************************************************************************** CSkySheet::CSkySheet() { AnimLengthInSeconds = 3; // by default, anim last 3 secconds (over 90 frames) @@ -26,7 +26,7 @@ CSkySheet::CSkySheet() WaterEnvMapAlpha = 255; } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkySheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix) { item.getValueByName(InstanceGroupName, (prefix + "InstanceGroupName").c_str()); @@ -55,7 +55,7 @@ void CSkySheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix item.getValueByName(WaterEnvMapAlpha, (prefix + "WaterEnvMapAlpha").c_str()); } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkySheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) { f.serial(InstanceGroupName); @@ -69,7 +69,7 @@ void CSkySheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) f.serial(WaterEnvMapAlpha); } -//***************************************************************************************************** +// ***************************************************************************************************** void CSkySheet::build(const NLGEORGES::UFormElm &item) { build(item, ""); diff --git a/code/ryzom/client/src/continent_manager.cpp b/code/ryzom/client/src/continent_manager.cpp index fd59a5ffe..6e2f655f6 100644 --- a/code/ryzom/client/src/continent_manager.cpp +++ b/code/ryzom/client/src/continent_manager.cpp @@ -397,22 +397,24 @@ void CContinentManager::select(const CVectorD &pos, NLMISC::IProgressCallback &p CContinent *pCont = it->second; nlinfo("Looking into %s", pCont->SheetName.c_str()); if (pCont->Zone.VPoints.size() > 0) // Patch because some continent have not been done yet - if (pCont->Zone.contains(fPos)) { - // load the continent selected. - select (it->first, pos, progress); - return; - } - else - { - /* - nlwarning("**********************************************"); - nlwarning("Start position (%s) not found in continent %s", NLMISC::toString(pos.asVector()).c_str(), it->first.c_str()); - for(uint k = 0; k < pCont->Zone.VPoints.size(); ++k) + if (pCont->Zone.contains(fPos)) { - nlwarning("zone point %d = %s", (int)k, NLMISC::toString(pCont->Zone.VPoints[k]).c_str()); + // load the continent selected. + select (it->first, pos, progress); + return; + } + else + { + /* + nlwarning("**********************************************"); + nlwarning("Start position (%s) not found in continent %s", NLMISC::toString(pos.asVector()).c_str(), it->first.c_str()); + for(uint k = 0; k < pCont->Zone.VPoints.size(); ++k) + { + nlwarning("zone point %d = %s", (int)k, NLMISC::toString(pCont->Zone.VPoints[k]).c_str()); + } + */ } - */ } it++; } diff --git a/code/ryzom/client/src/custom_matrix.cpp b/code/ryzom/client/src/custom_matrix.cpp index 0e2b0aa47..b0d166cba 100644 --- a/code/ryzom/client/src/custom_matrix.cpp +++ b/code/ryzom/client/src/custom_matrix.cpp @@ -19,7 +19,7 @@ -//********************************************************* +// ********************************************************* bool CCustomMatrix::set(bool newOn, const NLMISC::CMatrix &newMat) { if (newOn) diff --git a/code/ryzom/client/src/decal.cpp b/code/ryzom/client/src/decal.cpp index a992eb9d9..6d7020bcb 100644 --- a/code/ryzom/client/src/decal.cpp +++ b/code/ryzom/client/src/decal.cpp @@ -89,7 +89,7 @@ static NL3D::CVertexProgram DecalAttenuationVertexProgram(DecalAttenuationVertex typedef CShadowPolyReceiver::CRGBAVertex CRGBAVertex; -//**************************************************************************** +// **************************************************************************** CDecal::CDecal() { _ShadowMap = new CShadowMap(&(((CSceneUser *) Scene)->getScene().getRenderTrav().getShadowMapManager())); @@ -134,7 +134,7 @@ CDecal::CDecal() _TopBlendZMax = 10100.f; } -//**************************************************************************** +// **************************************************************************** void CDecal::setCustomUVMatrix(bool on, const NLMISC::CMatrix &matrix) { if (_CustomUVMatrix.set(on, matrix)) @@ -143,7 +143,7 @@ void CDecal::setCustomUVMatrix(bool on, const NLMISC::CMatrix &matrix) } } -//**************************************************************************** +// **************************************************************************** const std::string &CDecal::getTextureFileName() const { CTextureFile *tf = dynamic_cast(_Material.getTexture(0)); @@ -152,39 +152,39 @@ const std::string &CDecal::getTextureFileName() const return emptyString; } -//**************************************************************************** +// **************************************************************************** void CDecal::setupMaterialColor() { _Material.texConstantColor(1, NLMISC::CRGBA(_Emissive.R, _Emissive.G, _Emissive.B, _Diffuse.A)); } -//**************************************************************************** +// **************************************************************************** void CDecal::setEmissive(NLMISC::CRGBA emissive) { _Emissive = emissive; setupMaterialColor(); } -//**************************************************************************** +// **************************************************************************** void CDecal::setDiffuse(NLMISC::CRGBA diffuse) { _Diffuse = diffuse; setupMaterialColor(); } -//**************************************************************************** +// **************************************************************************** CRGBA CDecal::getDiffuse() const { return _Diffuse; } -//**************************************************************************** +// **************************************************************************** CDecal::~CDecal() { delete _ShadowMap; } -//**************************************************************************** +// **************************************************************************** void CDecal::setTexture(const std::string &fileName, bool clampU, bool clampV, bool filtered) { if (getTextureFileName() != fileName) @@ -225,7 +225,7 @@ void CDecal::setTexture(const std::string &fileName, bool clampU, bool clamp } } -//**************************************************************************** +// **************************************************************************** void CDecal::setWorldMatrix(const NLMISC::CMatrix &matrix) { float newMat[16]; @@ -253,7 +253,7 @@ void CDecal::setWorldMatrix(const NLMISC::CMatrix &matrix) } } -//**************************************************************************** +// **************************************************************************** bool CDecal::clipFront(const NLMISC::CPlane &p) const { for(uint k = 0; k < 8; ++k) @@ -263,7 +263,7 @@ bool CDecal::clipFront(const NLMISC::CPlane &p) const return true; } -//**************************************************************************** +// **************************************************************************** void CDecal::setWorldMatrixForArrow(const NLMISC::CVector2f &start, const NLMISC::CVector2f &end, float halfWidth) { CMatrix matrix; @@ -274,7 +274,7 @@ void CDecal::setWorldMatrixForArrow(const NLMISC::CVector2f &start, const NLM setWorldMatrix(matrix); } -//**************************************************************************** +// **************************************************************************** void CDecal::setWorldMatrixForSpot(const NLMISC::CVector2f &pos, float radius, float angleInRadians) { CMatrix matrix; @@ -288,7 +288,7 @@ void CDecal::setWorldMatrixForSpot(const NLMISC::CVector2f &pos, float radius, NLMISC::CVector r2MaskOffset(1.f / 4.f, 1.f / 4.f, 0.f); -//**************************************************************************** +// **************************************************************************** void CDecal::renderTriCache(NL3D::IDriver &drv, NL3D::CShadowPolyReceiver &/* receiver */, bool useVertexProgram) { if (_TriCache.empty()) return; @@ -400,7 +400,7 @@ void CDecal::renderTriCache(NL3D::IDriver &drv, NL3D::CShadowPolyReceiver &/* } } -//**************************************************************************** +// **************************************************************************** void CDecal::render(NL3D::UDriver &/* drv */, NL3D::CShadowPolyReceiver &receiver, const std::vector &worldPyramid, @@ -534,7 +534,7 @@ void CDecal::render(NL3D::UDriver &/* drv */, renderTriCache(*drvInternal, receiver, useVertexProgram); } -//**************************************************************************** +// **************************************************************************** void CDecalRenderList::renderAllDecals() { if (_Empty) return; @@ -588,7 +588,7 @@ void CDecalRenderList::renderAllDecals() } } -//**************************************************************************** +// **************************************************************************** void CDecalRenderList::clearRenderList() { for(uint k = 0; k < DECAL_NUM_PRIORITIES; ++k) @@ -598,7 +598,7 @@ void CDecalRenderList::clearRenderList() _Empty = true; } -//**************************************************************************** +// **************************************************************************** void CDecal::addToRenderList(uint priority /*=0*/) { if( !Landscape) @@ -611,14 +611,14 @@ void CDecal::addToRenderList(uint priority /*=0*/) drl._Empty = false; } -//**************************************************************************** +// **************************************************************************** bool CDecal::contains(const NLMISC::CVector2f &pos) const { CVector posIn = _InvertedWorldMatrix * CVector(pos.x, pos.y, 0.f); return posIn.x >= 0.f && posIn.x <= 1.f && posIn.y >= 0.f && posIn.y <= 1.f; } -//**************************************************************************** +// **************************************************************************** void CDecal::setClipDownFacing(bool clipDownFacing) { if (clipDownFacing != _ClipDownFacing) @@ -628,7 +628,7 @@ void CDecal::setClipDownFacing(bool clipDownFacing) } } -//**************************************************************************** +// **************************************************************************** void CDecal::setBottomBlend(float zMin, float zMax) { if (zMin > zMax) std::swap(zMin, zMax); @@ -636,7 +636,7 @@ void CDecal::setBottomBlend(float zMin, float zMax) _BottomBlendZMax = zMax; } -//**************************************************************************** +// **************************************************************************** void CDecal::setTopBlend(float zMin, float zMax) { if (zMin > zMax) std::swap(zMin, zMax); diff --git a/code/ryzom/client/src/decal_anim.cpp b/code/ryzom/client/src/decal_anim.cpp index 8ee2601bd..3e3b43172 100644 --- a/code/ryzom/client/src/decal_anim.cpp +++ b/code/ryzom/client/src/decal_anim.cpp @@ -27,7 +27,7 @@ using namespace NLMISC; -//***************************************************************************** +// ***************************************************************************** CDecalAnim::CDecalAnim() { DurationInMs = 1000; @@ -39,7 +39,7 @@ CDecalAnim::CDecalAnim() EndEmissive = CRGBA::Black; } -//***************************************************************************** +// ***************************************************************************** void CDecalAnim::updateDecal(const NLMISC::CVector2f &pos, float animRatio, CDecal &dest, float refScale) const { dest.setTexture(Texture); @@ -51,7 +51,7 @@ void CDecalAnim::updateDecal(const NLMISC::CVector2f &pos, float animRatio, CDec -//***************************************************************************** +// ***************************************************************************** void CDecalAnim::buildFromLuaTable(CLuaObject &table) { // retrieve a value from a lua table or affect a default value if not found diff --git a/code/ryzom/client/src/entity_cl.cpp b/code/ryzom/client/src/entity_cl.cpp index 46a31e595..f215af2ff 100644 --- a/code/ryzom/client/src/entity_cl.cpp +++ b/code/ryzom/client/src/entity_cl.cpp @@ -1583,7 +1583,7 @@ void CEntityCL::setClusterSystem(UInstanceGroup *cluster) } }// setCluster // -//***************************************************************************************************** +// ***************************************************************************************************** NL3D::UInstanceGroup *CEntityCL::getClusterSystem() { if (!_Skeleton.empty()) return _Skeleton.getClusterSystem(); diff --git a/code/ryzom/client/src/entity_cl.h b/code/ryzom/client/src/entity_cl.h index 18e7a2afa..21402ee0d 100644 --- a/code/ryzom/client/src/entity_cl.h +++ b/code/ryzom/client/src/entity_cl.h @@ -233,7 +233,7 @@ public: void sheetId(const NLMISC::CSheetId &id) {_SheetId = id;} /// Return the persistent NPC alias of entity (0 if N/A). - const uint32 npcAlias() const {return _NPCAlias; } + uint32 npcAlias() const {return _NPCAlias; } /// Set the persistent NPC alias of the entity. void npcAlias(uint32 alias) {_NPCAlias = alias; } @@ -411,7 +411,7 @@ public: /// Return the entity current behaviour. - const MBEHAV::EBehaviour behaviour() const {return _CurrentBehaviour.Behaviour;} + MBEHAV::EBehaviour behaviour() const {return _CurrentBehaviour.Behaviour;} /** * Show or Hide the entity. diff --git a/code/ryzom/client/src/events_listener.cpp b/code/ryzom/client/src/events_listener.cpp index 91379c8ca..eb21e0f0e 100644 --- a/code/ryzom/client/src/events_listener.cpp +++ b/code/ryzom/client/src/events_listener.cpp @@ -145,16 +145,11 @@ void CEventsListener::operator()(const CEvent& event) // Event from the Mouse (ANGLE) if(event == EventGDMouseMove) { -#ifdef NL_OS_WINDOWS CGDMouseMove* mouseEvent=(CGDMouseMove*)&event; // Mouse acceleration sint dX = mouseEvent->X; sint dY = ClientCfg.FreeLookInverted ? -mouseEvent->Y : mouseEvent->Y; updateFreeLookPos((float) dX, (float) dY); -#else - // just to make sure that there is no game device implementation un unix - nlerror("not expecting EventGDMouseMove on unix"); -#endif } // Event from the Mouse (MOVE) else if(event == EventMouseMoveId) @@ -214,7 +209,7 @@ void CEventsListener::operator()(const CEvent& event) -//*********************************************************************** +// *********************************************************************** void CEventsListener::smoothMouseCoordinates(float &x, float &y, float smoothingPeriod) { if (smoothingPeriod > 0.001f) @@ -227,7 +222,7 @@ void CEventsListener::smoothMouseCoordinates(float &x, float &y, float smoothing } -//************************************************************* +// ************************************************************* void CEventsListener::updateMouseSmoothing() { if (_LastFreeLookUpdateDate != TimeInSec) @@ -245,7 +240,7 @@ void CEventsListener::updateMouseSmoothing() } } -//*************************************************************** +// *************************************************************** void CEventsListener::enableMouseSmoothing(bool on) { if (on == _MouseSmoothingOn) return; @@ -263,7 +258,7 @@ void CEventsListener::enableMouseSmoothing(bool on) } -//*************************************************************** +// *************************************************************** void CEventsListener::updateFreeLookPos(float x, float y) { @@ -329,7 +324,7 @@ void CEventsListener::updateFreeLookPos(float x, float y) } } -//*************************************************************** +// *************************************************************** void CEventsListener::updateCursorPos(float x, float y) { // Backup mouse diff --git a/code/ryzom/client/src/ground_fx_manager.cpp b/code/ryzom/client/src/ground_fx_manager.cpp index b96d80442..9b96aa356 100644 --- a/code/ryzom/client/src/ground_fx_manager.cpp +++ b/code/ryzom/client/src/ground_fx_manager.cpp @@ -59,7 +59,7 @@ static const float MAX_DIST_TO_REUSE_OLD_FX = 1.5f; using namespace NLMISC; -//***************************************************************************** +// ***************************************************************************** CGroundFXManager::CGroundFXManager() : _MinSpeed(1.5f), _MaxSpeed(6.f), @@ -77,7 +77,7 @@ CGroundFXManager::CGroundFXManager() : // Construct } -//***************************************************************************** +// ***************************************************************************** CGroundFXManager::~CGroundFXManager() { H_AUTO_USE(RZ_GroundFXManager) @@ -85,7 +85,7 @@ CGroundFXManager::~CGroundFXManager() CHECK_INTEGRITY } -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::reset() { H_AUTO_USE(RZ_GroundFXManager) @@ -124,7 +124,7 @@ void CGroundFXManager::reset() _Scene = NULL; } -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::init(NL3D::UScene *scene, float maxDist, uint maxNumFX, uint fxCacheSize) { H_AUTO_USE(RZ_GroundFXManager) @@ -135,7 +135,7 @@ void CGroundFXManager::init(NL3D::UScene *scene, float maxDist, uint maxNumFX, u _MaxNumCachedFX = fxCacheSize; } -//***************************************************************************** +// ***************************************************************************** CGroundFXManager::TEntityHandle CGroundFXManager::add(CEntityCL *entity) { H_AUTO_USE(RZ_GroundFXManager) @@ -162,7 +162,7 @@ CGroundFXManager::TEntityHandle CGroundFXManager::add(CEntityCL *entity) return _InstancesList.begin(); } -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::remove(TEntityHandle handle) { H_AUTO_USE(RZ_GroundFXManager) @@ -195,7 +195,7 @@ void CGroundFXManager::remove(TEntityHandle handle) // predicate to test a ground id -//***************************************************************************** +// ***************************************************************************** // Predicate for binary search in a vector of sorted ground fx sheets struct CCmpGroundIDPred { @@ -205,7 +205,7 @@ struct CCmpGroundIDPred } }; -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::CInstance::getFXNameFromGroundType(uint32 groundID, std::string &fxName) const { H_AUTO_USE(RZ_GroundFXManager) @@ -224,7 +224,7 @@ void CGroundFXManager::CInstance::getFXNameFromGroundType(uint32 groundID, std:: fxName= it->getFXName(); } -//***************************************************************************** +// ***************************************************************************** /** Predicate to sort instances by distances. */ struct CSortInstancePred @@ -235,7 +235,7 @@ struct CSortInstancePred } }; -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::invalidateFX(TEntityHandle instance) { H_AUTO_USE(RZ_GroundFXManager) @@ -272,7 +272,7 @@ void CGroundFXManager::invalidateFX(TEntityHandle instance) } -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::moveFXInCache(TGroundFXList &ownerList, TGroundFXHandle fx) { H_AUTO_USE(RZ_GroundFXManager) @@ -295,7 +295,7 @@ void CGroundFXManager::moveFXInCache(TGroundFXList &ownerList, TGroundFXHandle f } -//******************************************************************************************* +// ******************************************************************************************* void CGroundFXManager::checkIntegrity() { H_AUTO_USE(RZ_GroundFXManager) @@ -330,7 +330,7 @@ void CGroundFXManager::checkIntegrity() } -//***************************************************************************** +// ***************************************************************************** void CGroundFXManager::update(const NLMISC::CVectorD &camPos) { H_AUTO_USE(RZ_GroundFXManager) @@ -759,7 +759,7 @@ using NLMISC::toString; CTestGroundFX TestGroundFX; -//*********************************************************************************************** +// *********************************************************************************************** void CTestGroundFX::update() { H_AUTO_USE(RZ_GroundFXManager) @@ -796,7 +796,7 @@ void CTestGroundFX::update() -//*********************************************************************************************** +// *********************************************************************************************** void CTestGroundFX::displayFXBoxes() const { H_AUTO_USE(RZ_GroundFXManager) @@ -832,7 +832,7 @@ void CTestGroundFX::displayFXBoxes() const } -//******************************************************************************************* +// ******************************************************************************************* void CGroundFXManager::setMinSpeed(float minSpeed) { H_AUTO_USE(RZ_GroundFXManager) @@ -840,7 +840,7 @@ void CGroundFXManager::setMinSpeed(float minSpeed) _MinSpeed = minSpeed; } -//******************************************************************************************* +// ******************************************************************************************* void CGroundFXManager::setMaxSpeed(float maxSpeed) { H_AUTO_USE(RZ_GroundFXManager) @@ -848,7 +848,7 @@ void CGroundFXManager::setMaxSpeed(float maxSpeed) _MaxSpeed = maxSpeed; } -//******************************************************************************************* +// ******************************************************************************************* void CGroundFXManager::setSpeedWaterWalkFast(float speed) { H_AUTO_USE(RZ_GroundFXManager) @@ -856,7 +856,7 @@ void CGroundFXManager::setSpeedWaterWalkFast(float speed) _SpeedWaterWalkFast = speed; } -//******************************************************************************************* +// ******************************************************************************************* void CGroundFXManager::setSpeedWaterSwimFast(float speed) { H_AUTO_USE(RZ_GroundFXManager) @@ -866,7 +866,7 @@ void CGroundFXManager::setSpeedWaterSwimFast(float speed) -//******************************************************************************************* +// ******************************************************************************************* // temp, for debug // add an entity for test diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index c03bfcce5..a232b835f 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -152,7 +152,7 @@ extern CContinentManager ContinentMngr; ucstring TipsOfTheDay; uint TipsOfTheDayIndex; -// includes pour les register class qui suivent (grrrr !!!!) +// includes for following register classes #include "entities.h" #include "character_cl.h" #include "player_cl.h" @@ -578,7 +578,6 @@ void checkDriverDepth () } } - void addSearchPaths(IProgressCallback &progress) { // Add search path of UI addon. Allow only a subset of files. @@ -744,7 +743,6 @@ void prelogInit() CLoginProgressPostThread::getInstance().init(ClientCfg.ConfigFile); - // tmp for patcher debug extern void tmpFlagMainlandPatchCategories(NLMISC::CConfigFile &cf); extern void tmpFlagRemovedPatchCategories(NLMISC::CConfigFile &cf); @@ -790,7 +788,6 @@ void prelogInit() FPU_CHECKER_ONCE - switch (getCurrentColorDepth()) { case 16: CustomMouse.setColorDepth(CCustomMouse::ColorDepth16); break; @@ -801,7 +798,6 @@ void prelogInit() break; } - // Check driver version checkDriverVersion(); @@ -835,8 +831,6 @@ void prelogInit() } Driver = UDriver::createDriver ((uint)LoadIcon (HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)), direct3D); - - #else // NL_OS_WINDOWS Driver = UDriver::createDriver (); #endif // NL_OS_WINDOWS diff --git a/code/ryzom/client/src/input.cpp b/code/ryzom/client/src/input.cpp index 44488eb0f..368ffa98d 100644 --- a/code/ryzom/client/src/input.cpp +++ b/code/ryzom/client/src/input.cpp @@ -33,6 +33,7 @@ // Misc #include "nel/misc/mouse_device.h" #include "nel/misc/mouse_smoother.h" +#include "nel/misc/system_utils.h" // Game Share @@ -66,7 +67,7 @@ bool SetMousePosFirstTime = true; uint DownMouseButtons = 0; #ifdef NL_OS_UNIX -// on X11, store whether the mouse was captured or not +// on X11 and cocoa, store whether the mouse was captured or not bool MouseCapture = false; #endif @@ -74,13 +75,13 @@ bool MouseCapture = false; // FUNCTION // ////////////// -//********************************************************************************* +// ********************************************************************************* uint GetMouseButtonsState() { return DownMouseButtons; } -//********************************************************************************* +// ********************************************************************************* // Initialize the mouse bool InitMouseWithCursor (bool hardware) { @@ -181,14 +182,14 @@ bool InitMouseWithCursor (bool hardware) return true; } -//********************************************************************************* +// ********************************************************************************* // Is mouse cursor hardware ? bool IsMouseCursorHardware () { return MouseHardware; } -//********************************************************************************* +// ********************************************************************************* // Set the mouse mode. Call this method once per frame to update window size void UpdateMouse () { @@ -198,20 +199,24 @@ void UpdateMouse () // Raw mode if (MouseDevice) { - MouseDevice->setMessagesMode(IMouseDevice::RawMode); MouseDevice->setMouseAcceleration(ClientCfg.FreeLookAcceleration); } + else + { + // no mouse device implementation on X11 and Cocoa, emulate raw mode + Driver->emulateMouseRawMode(true); + } } else { - // Get the driver size - uint32 width, height; - Driver->getWindowSize(width, height); - // Set the mouse properties if (MouseDevice) { + // Get the driver size + uint32 width, height; + Driver->getWindowSize(width, height); + MouseDevice->setMessagesMode(IMouseDevice::NormalMode); MouseDevice->setMouseMode(IMouseDevice::XAxis, IMouseDevice::Clamped); MouseDevice->setMouseMode(IMouseDevice::YAxis, IMouseDevice::Clamped); @@ -221,6 +226,11 @@ void UpdateMouse () MouseDevice->setMouseSpeed(MouseCursorSpeed); MouseDevice->setMouseAcceleration(MouseCursorAcceleration); } + else + { + // no mouse device implementation on X11 and Cocoa, emulate raw mode + Driver->emulateMouseRawMode(false); + } } if (!IsSystemCursorCaptured()) { @@ -228,7 +238,7 @@ void UpdateMouse () } } -//********************************************************************************* +// ********************************************************************************* // Use this method to toggle the mouse (freelook <- cursor) void SetMouseFreeLook () { @@ -249,23 +259,16 @@ void SetMouseFreeLook () } UpdateMouse (); } - -#ifdef NL_OS_UNIX - // on X11 the mouse needs to get pulled into the middle each update, else - // the cursor would reach the border of the window / desktop - // and freelook would hang - Driver->setMousePos(0.5f, 0.5f); -#endif } -//********************************************************************************* +// ********************************************************************************* bool IsMouseFreeLook() { return MouseFreeLook; } -//********************************************************************************* +// ********************************************************************************* // Use this method to toggle the mouse (freelook -> cursor) void SetMouseCursor (bool updatePos) { @@ -348,7 +351,7 @@ void SetMouseCursor (bool updatePos) } } -//********************************************************************************* +// ********************************************************************************* // Use this method to set the cursor speed void SetMouseSpeed (float speed) { @@ -356,7 +359,7 @@ void SetMouseSpeed (float speed) UpdateMouse (); } -//********************************************************************************* +// ********************************************************************************* // Use this method to set the cursor acceleration void SetMouseAcceleration (uint accel) { @@ -364,7 +367,7 @@ void SetMouseAcceleration (uint accel) UpdateMouse (); } -//********************************************************************************* +// ********************************************************************************* void CaptureSystemCursor() { if (IsSystemCursorCaptured()) return; @@ -373,12 +376,12 @@ void CaptureSystemCursor() if (!drvWnd) return; SetCapture(drvWnd); #else - // on X11, set driver mouse capture on and store it locally as well + // on X11 and cocoa, set driver mouse capture on and store it locally as well Driver->setCapture(MouseCapture = true); #endif } -//********************************************************************************* +// ********************************************************************************* void ReleaseSystemCursor() { if (!IsSystemCursorCaptured()) return; @@ -392,23 +395,26 @@ void ReleaseSystemCursor() } ReleaseCapture(); #else - // on X11, set driver mouse capture off and store it locally as well + // on X11 and cocoa, set driver mouse capture off and store it locally as well Driver->setCapture(MouseCapture = false); #endif } -//********************************************************************************* +// ********************************************************************************* bool IsSystemCursorCaptured() { if (!Driver) return false; #ifdef NL_OS_WINDOWS return GetCapture() == Driver->getDisplay(); #else + /* + TODO there should be a way to ask the driver if capturing is on or off + */ return MouseCapture; #endif } -//********************************************************************************* +// ********************************************************************************* void HandleSystemCursorCapture(const CEvent &event) { if (event == EventMouseDownId) @@ -440,7 +446,7 @@ void HandleSystemCursorCapture(const CEvent &event) } -//********************************************************************************* +// ********************************************************************************* bool IsSystemCursorInClientArea() { if (!Driver) return false; diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index b3ada0105..6580b4f0d 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2785,7 +2785,7 @@ public: } // If no modes are available, display a message and exit - if (nFoundMode == -1) + if (!ClientCfg.Windowed && nFoundMode == -1) { Driver->systemMessageBox("No Video Modes available!\n" "Minimum Video mode to play Ryzom is 800x600.\n", diff --git a/code/ryzom/client/src/interface_v3/action_handler_item.cpp b/code/ryzom/client/src/interface_v3/action_handler_item.cpp index f2b1002cf..009829b9e 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -49,14 +49,14 @@ using namespace NLMISC; CInterfaceItemEdition *CInterfaceItemEdition::_Instance = NULL; -//******************************************************************************************** +// ******************************************************************************************** CInterfaceItemEdition *CInterfaceItemEdition::getInstance() { if (!_Instance) _Instance = new CInterfaceItemEdition; return _Instance; } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::releaseInstance() { if( _Instance ) @@ -66,7 +66,7 @@ void CInterfaceItemEdition::releaseInstance() } } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::setCurrWindow(CDBCtrlSheet* ctrlSheet, const std::string &windowName, const bool &isInEditionMode) { _CurrWindow.end(); @@ -84,19 +84,19 @@ void CInterfaceItemEdition::setCurrWindow(CDBCtrlSheet* ctrlSheet, const std::st } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::update() { _CurrWindow.update(); } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::validate() { _CurrWindow.validate(); setCurrWindow(NULL); } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::CItemEditionWindow::infoReceived() { if(_CurrItemSheet && !WindowName.empty()) @@ -164,15 +164,15 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::CItemEditionWindow::update() { - if(_CurrItemSheet && (ItemSheet != _CurrItemSheet->getSheetId())) + if(_CurrItemSheet && ((sint32)ItemSheet != _CurrItemSheet->getSheetId())) { end(); } } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::CItemEditionWindow::begin() { if(_CurrItemSheet && !WindowName.empty()) @@ -291,7 +291,7 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() } } } -//******************************************************************************************** +// ******************************************************************************************** void CInterfaceItemEdition::CItemEditionWindow::end() { diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 5c0a53c9b..9a4f5f232 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -502,7 +502,7 @@ struct CCameraBackup }; -//********************************************************* +// ********************************************************* CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uint top, uint bottom, uint screenShotWidth, uint screenShotHeight) { CCameraBackup cb; @@ -530,7 +530,7 @@ CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uin } -//********************************************************* +// ********************************************************* static void restoreCamera(UScene &scene, const CCameraBackup &backup) { scene.getCam().setFrustum (backup.Frustum); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp b/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp index cdde9994c..984e05700 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_manager.cpp @@ -34,7 +34,7 @@ using namespace NLNET; CBotChatManager *CBotChatManager::_Instance = NULL; -//******************************************************************************************** +// ******************************************************************************************** CBotChatManager::CBotChatManager() { _CurrPage = NULL; @@ -42,21 +42,21 @@ CBotChatManager::CBotChatManager() //_ChosenMissionFlags = 0; } -//******************************************************************************************** +// ******************************************************************************************** CBotChatManager::~CBotChatManager() { // Destruct nlassert(_CurrPage == NULL); // should have called setCurrPage(NULL) before quitting (and before releasing the interface) ! } -//******************************************************************************************** +// ******************************************************************************************** CBotChatManager *CBotChatManager::getInstance() { if (!_Instance) _Instance = new CBotChatManager; return _Instance; } -//******************************************************************************************** +// ******************************************************************************************** void CBotChatManager::releaseInstance() { if( _Instance ) @@ -66,7 +66,7 @@ void CBotChatManager::releaseInstance() } } -//******************************************************************************************** +// ******************************************************************************************** void CBotChatManager::setCurrPage(CBotChatPage *page) { if (_CurrPage) @@ -85,13 +85,13 @@ void CBotChatManager::setCurrPage(CBotChatPage *page) _CurrPage = page; } -//******************************************************************************************** +// ******************************************************************************************** void CBotChatManager::update() { if (_CurrPage) _CurrPage->update(); } -//******************************************************************************************** +// ******************************************************************************************** void CBotChatManager::endDialog() { NLMISC::CBitMemStream out; @@ -212,7 +212,7 @@ void CBotChatManager::debugLocalReceiveMissionInfo() } -//******************************************************************************************** +// ******************************************************************************************** /*void CBotChatManager::processMissionHelpInfos(uint8 index, CPrerequisitInfos &infos) { std::map::iterator it = _MissionHelpWindowsWaiting.find(index); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_manager.h b/code/ryzom/client/src/interface_v3/bot_chat_manager.h index dab99170e..e3dd73d79 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_manager.h +++ b/code/ryzom/client/src/interface_v3/bot_chat_manager.h @@ -76,7 +76,7 @@ public: void setChosenMissionFlags(uint flag) { _ChosenMissionFlags = flag; } */ - //*** + // *** // Add a Waiter on mission prereq info (MissionHelp opening). no-op if here, but reorder void addMissionInfoWaiter(IMissionPrereqInfosWaiter *waiter); // remove a Waiter on mission prereq info (MissionHelp closing). no-op if not here. NB: no delete @@ -95,7 +95,7 @@ private: static CBotChatManager *_Instance; //uint _ChosenMissionFlags; - //*** keep infos on opened mission help windows (for prerequisits) + // *** keep infos on opened mission help windows (for prerequisits) typedef std::list TMissionPrereqInfosWaiter; TMissionPrereqInfosWaiter _MissionInfoWaiters; diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page.cpp index 519a08bbe..5714afffa 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page.cpp @@ -23,7 +23,7 @@ #include "../user_entity.h" -//***************************************************************************** +// ***************************************************************************** void CBotChatPage::activateWindow(const char *windowName, bool active) { CInterfaceManager *im = CInterfaceManager::getInstance(); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_all.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_all.cpp index 38d021760..220737296 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_all.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_all.cpp @@ -37,7 +37,7 @@ CBotChatPageAll *BotChatPageAll = NULL; -//******************************************************************* +// ******************************************************************* CBotChatPageAll::CBotChatPageAll() { Trade = NULL; @@ -50,7 +50,7 @@ CBotChatPageAll::CBotChatPageAll() RingSessions = NULL; } -//******************************************************************* +// ******************************************************************* CBotChatPageAll::~CBotChatPageAll() { delete Trade; @@ -63,7 +63,7 @@ CBotChatPageAll::~CBotChatPageAll() delete RingSessions; } -//******************************************************************* +// ******************************************************************* void CBotChatPageAll::init() { Trade = new CBotChatPageTrade; diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp index 60c0097ed..4efa1067a 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp @@ -32,7 +32,7 @@ using namespace std; static const char *WIN_BOT_CHAT_PAGE_CREATE_GUILD = "ui:interface:bot_chat_create_guild"; -//*************************************************************************** +// *************************************************************************** void CBotChatPageCreateGuild::begin() { CBotChatPage::begin(); @@ -43,7 +43,7 @@ void CBotChatPageCreateGuild::begin() activateWindow(WIN_BOT_CHAT_PAGE_CREATE_GUILD, true); } -//*************************************************************************** +// *************************************************************************** void CBotChatPageCreateGuild::end() { activateWindow(WIN_BOT_CHAT_PAGE_CREATE_GUILD, false); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp index 5859b3fd2..af39d7d8d 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_dynamic_mission.cpp @@ -47,7 +47,7 @@ static const char *DM_VALID_DB_PATH = "UI:TEMP:DYNAMIC_MISSION_VALID"; using namespace STRING_MANAGER; using NLMISC::toString; -//************************************************************************************************* +// ************************************************************************************************* CBotChatPageDynamicMission::CBotChatPageDynamicMission() { std::fill(_ChoiceCB, _ChoiceCB + DYNAMIC_MISSION_NUM_CHOICES, (CDBGroupComboBox *) NULL); @@ -62,7 +62,7 @@ CBotChatPageDynamicMission::CBotChatPageDynamicMission() _MissionValid = false; } -//************************************************************************************************* +// ************************************************************************************************* void CBotChatPageDynamicMission::invalidateMission() { CInterfaceManager *im = CInterfaceManager::getInstance(); @@ -72,7 +72,7 @@ void CBotChatPageDynamicMission::invalidateMission() _MissionValid = false; } -//************************************************************************************************* +// ************************************************************************************************* void CBotChatPageDynamicMission::begin() { CBotChatPage::begin(); @@ -119,7 +119,7 @@ void CBotChatPageDynamicMission::begin() } } -//************************************************************************************************* +// ************************************************************************************************* void CBotChatPageDynamicMission::end() { // if a menu is currently poped, disable it @@ -128,13 +128,13 @@ void CBotChatPageDynamicMission::end() activateWindow(WIN_BOT_CHAT_PAGE_DYNAMIC_MISSION, false); } -//************************************************************************************************* +// ************************************************************************************************* void CBotChatPageDynamicMission::init() { } -//************************************************************************************************* +// ************************************************************************************************* void CBotChatPageDynamicMission::update() { CInterfaceManager *im = CInterfaceManager::getInstance(); @@ -223,7 +223,7 @@ void CBotChatPageDynamicMission::update() } } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageDynamicMission::sendChoices() { uint k; @@ -250,7 +250,7 @@ void CBotChatPageDynamicMission::sendChoices() } } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageDynamicMission::selectionChanged(uint choice) { if (choice > DYNAMIC_MISSION_NUM_CHOICES) @@ -268,7 +268,7 @@ void CBotChatPageDynamicMission::selectionChanged(uint choice) sendChoices(); } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageDynamicMission::regen() { if (!_MissionValid) return; @@ -282,7 +282,7 @@ void CBotChatPageDynamicMission::regen() // ACTION HANDLERS // ///////////////////// -//*************************************************************************************** +// *************************************************************************************** // the player has clicked on an item to buy it class CAHChangeDMOption : public IActionHandler { @@ -301,7 +301,7 @@ class CAHChangeDMOption : public IActionHandler }; REGISTER_ACTION_HANDLER(CAHChangeDMOption, "change_dm_option"); -//*************************************************************************************** +// *************************************************************************************** // regenerate current mission class CAHRegenDM : public IActionHandler { @@ -313,7 +313,7 @@ class CAHRegenDM : public IActionHandler REGISTER_ACTION_HANDLER(CAHRegenDM, "regen_dm"); -//*************************************************************************************** +// *************************************************************************************** // the player accepted the mission class CAHAcceptDM : public IActionHandler { diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp index 23328b569..66d98277d 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp @@ -39,14 +39,14 @@ static const char *WIN_BOT_CHAT_PAGE_MISSION = "ui:interface:bot_chat_missions"; static const char *WIN_BOT_CHAT_ACCEPT_MISSION = "ui:interface:bot_chat_accept_mission"; -//*************************************************************************************** +// *************************************************************************************** CBotChatPageMission::CBotChatPageMission() { _MissionPagesObs.setListType(CHugeListObs::Missions); _CurrSel = NULL; } -//******************************************************************************************* +// ******************************************************************************************* void CBotChatPageMission::init() { CInterfaceManager *im = CInterfaceManager::getInstance(); @@ -55,7 +55,7 @@ void CBotChatPageMission::init() } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageMission::begin() { CBotChatPage::begin(); @@ -83,14 +83,14 @@ void CBotChatPageMission::begin() } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageMission::end() { activateWindow(WIN_BOT_CHAT_PAGE_MISSION, false); activateWindow(WIN_BOT_CHAT_ACCEPT_MISSION, false); } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageMission::selectMission(CDBCtrlSheet *missionSheet) { if (!missionSheet) return; @@ -132,7 +132,7 @@ void CBotChatPageMission::selectMission(CDBCtrlSheet *missionSheet) _CurrSel = missionSheet; } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageMission::acceptMission() { if (!_CurrSel) return; diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_mission_end.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_mission_end.cpp index fdfab21a2..b6361a5ca 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_mission_end.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_mission_end.cpp @@ -31,7 +31,7 @@ static const char *WIN_BOT_CHAT_PAGE_MISSION_END = "ui:interface:bot_chat_missio // Context help extern void contextHelp (const std::string &help); -//*************************************************************************** +// *************************************************************************** void CBotChatPageMissionEnd::begin() { return; @@ -71,7 +71,7 @@ void CBotChatPageMissionEnd::begin() */ } -//*************************************************************************** +// *************************************************************************** void CBotChatPageMissionEnd::end() { activateWindow(WIN_BOT_CHAT_PAGE_MISSION_END, false); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_news.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_news.cpp index fce05163c..5ec5631b6 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_news.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_news.cpp @@ -23,7 +23,7 @@ static const char *WIN_BOT_CHAT_PAGE_NEWS = "ui:interface:bot_chat_news"; -//*************************************************************************** +// *************************************************************************** void CBotChatPageNews::begin() { CBotChatPage::begin(); @@ -34,7 +34,7 @@ void CBotChatPageNews::begin() activateWindow(WIN_BOT_CHAT_PAGE_NEWS, true); } -//*************************************************************************** +// *************************************************************************** void CBotChatPageNews::end() { activateWindow(WIN_BOT_CHAT_PAGE_NEWS, false); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_player_gift.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_player_gift.cpp index 66270baf5..1c16a68cc 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_player_gift.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_player_gift.cpp @@ -29,7 +29,7 @@ static const char *WIN_BOT_CHAT_PAGE_PLAYER_GIFT = "ui:interface:bot_chat_player_gift"; -//************************************************************************************* +// ************************************************************************************* void CBotChatPagePlayerGift::begin() { CBotChatPage::begin(); @@ -55,7 +55,7 @@ void CBotChatPagePlayerGift::begin() PlayerTrade.BotChatGiftContext= true; } -//************************************************************************************* +// ************************************************************************************* void CBotChatPagePlayerGift::end() { // If the player gift was not validated, restore all items. else must not! diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_ring_sessions.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_ring_sessions.cpp index 42a92da70..66a9add5e 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_ring_sessions.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_ring_sessions.cpp @@ -25,14 +25,14 @@ #define WIN_BOT_CHAT_PAGE_RING_SESSION "ui:interface:ring_sessions" -//************************************************* +// ************************************************* CBotChatPageRingSessions::CBotChatPageRingSessions() { RingAccessPointPos.set(0.f, 0.f, 0.f); } -//************************************************* +// ************************************************* void CBotChatPageRingSessions::begin() { CBotChatPage::begin(); @@ -43,7 +43,7 @@ void CBotChatPageRingSessions::begin() } } -//************************************************* +// ************************************************* void CBotChatPageRingSessions::end() { activateWindow(WIN_BOT_CHAT_PAGE_RING_SESSION, false); diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index cadb717eb..1073d89b0 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -503,7 +503,7 @@ uint32 CBotChatPageTrade::getUserFactionPoints(PVP_CLAN::TPVPClan clan) const return pLeaf->getValue32(); } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageTrade::notifyDownloadComplete(bool completed) { CInterfaceManager *im = CInterfaceManager::getInstance(); @@ -527,7 +527,7 @@ void CBotChatPageTrade::notifyDownloadComplete(bool completed) gc->visit(&visitor); } -//*************************************************************************************** +// *************************************************************************************** void CBotChatPageTrade::updateTradeModal() { // if loading is finished, then signal it to all sheet list, so they can display an help message if they diff --git a/code/ryzom/client/src/interface_v3/chat_filter.h b/code/ryzom/client/src/interface_v3/chat_filter.h index 31c4d1268..d288d9867 100644 --- a/code/ryzom/client/src/interface_v3/chat_filter.h +++ b/code/ryzom/client/src/interface_v3/chat_filter.h @@ -81,7 +81,7 @@ private: virtual void chatWindowRemoved(CChatWindow *cw); // // copy not supported - CChatInputFilter(const CChatInputFilter &/* other */) { nlassert(0); } + CChatInputFilter(const CChatInputFilter &/* other */):NLMISC::CRefCount() { nlassert(0); } CChatInputFilter &operator=(const CChatInputFilter &/* other */) { nlassert(0); return *this; } }; @@ -157,7 +157,7 @@ private: void chatWindowRemoved(CChatWindow *cw); void msgEntered(const ucstring &msg, CChatWindow *chatWindow); // copy not supported - CChatTargetFilter(const CChatTargetFilter &/* other */) { nlassert(0); } + CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); } CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; } }; diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index ae674a368..a842de29b 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -1225,7 +1225,7 @@ CChatWindow *CChatWindowManager::getChatWindowByIndex(uint index) ///////////////////// -//*************************************************************************************** +// *************************************************************************************** class CHandlerChatBoxEntry : public IActionHandler { public: @@ -1298,7 +1298,7 @@ static ucstring getFreeTellerName(CInterfaceElement *pCaller) return cgw->getFreeTellerName(freeTeller->getId()); } -//*************************************************************************************** +// *************************************************************************************** class CHandlerAddTellerToFriendList : public IActionHandler { public: @@ -1323,7 +1323,7 @@ public: REGISTER_ACTION_HANDLER(CHandlerAddTellerToFriendList, "add_teller_to_friend_list"); -//*************************************************************************************** +// *************************************************************************************** class CHandlerAddTellerToIgnoreList : public IActionHandler { public: @@ -1358,7 +1358,7 @@ public: }; REGISTER_ACTION_HANDLER(CHandlerAddTellerToIgnoreList, "add_teller_to_ignore_list"); -//*************************************************************************************** +// *************************************************************************************** class CHandlerInviteToRingSession : public IActionHandler { public: diff --git a/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp b/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp index b46c2014f..459851037 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp @@ -24,7 +24,7 @@ using namespace NLMISC; -//********************************************************************************* +// ********************************************************************************* CCtrlPolygon::CCtrlPolygon() : CCtrlBase(TCtorParam()) { // Construct @@ -33,7 +33,7 @@ CCtrlPolygon::CCtrlPolygon() : CCtrlBase(TCtorParam()) _Valid = true; } -//********************************************************************************* +// ********************************************************************************* void CCtrlPolygon::updateBoudingRect() { H_AUTO(Rz_CCtrlPolygon_updateBoudingRect) @@ -68,7 +68,7 @@ void CCtrlPolygon::updateBoudingRect() setH(ymax - ymin); } -//********************************************************************************* +// ********************************************************************************* bool CCtrlPolygon::contains(const CVector2f &pos) const { H_AUTO(Rz_CCtrlPolygon_contains) @@ -76,7 +76,7 @@ bool CCtrlPolygon::contains(const CVector2f &pos) const return _XFormPoly.contains(pos, false); } -//********************************************************************************* +// ********************************************************************************* void CCtrlPolygon::setVertices(const std::vector &vertices) { H_AUTO(Rz_CCtrlPolygon_setVertices) @@ -132,7 +132,7 @@ static inline bool totallyOutside(const CVector &minCorner, const CVector &maxCo } -//********************************************************************************* +// ********************************************************************************* /*void CCtrlPolygon::setMatrix(const NLMISC::CMatrix &mat) { const float *lhs = mat.get(); @@ -144,7 +144,7 @@ static inline bool totallyOutside(const CVector &minCorner, const CVector &maxCo }*/ -//********************************************************************************* +// ********************************************************************************* void CCtrlPolygon::draw() { H_AUTO(Rz_CCtrlPolygon_draw) @@ -262,7 +262,7 @@ void CCtrlPolygon::draw() vr.drawUnclippedTriangles(_RenderLayer, _RealTris, col); } -//********************************************************************************* +// ********************************************************************************* void CCtrlPolygon::updateCoords() { H_AUTO(Rz_CCtrlPolygon_updateCoords) @@ -272,21 +272,21 @@ void CCtrlPolygon::updateCoords() _Touched = true; } -//********************************************************************************* +// ********************************************************************************* void CCtrlPolygon::setAlpha(sint32 a) { H_AUTO(Rz_CCtrlPolygon_setAlpha) _Color.A = (uint8) a; } -//********************************************************************************* +// ********************************************************************************* bool CCtrlPolygon::handleEvent(const CEventDescriptor &/* event */) { H_AUTO(Rz_CCtrlPolygon_handleEvent) return false; } -//********************************************************************************* +// ********************************************************************************* // TMP TMP void CCtrlPolygon::computeScaledVertex(NLMISC::CVector2f &dest, const NLMISC::CVector2f &src) { @@ -294,7 +294,7 @@ void CCtrlPolygon::computeScaledVertex(NLMISC::CVector2f &dest, const NLMISC::CV dest.set(src.x, src.y); } -//********************************************************************************* +// ********************************************************************************* // TMP TMP void CCtrlPolygon::touch() { diff --git a/code/ryzom/client/src/interface_v3/ctrl_quad.cpp b/code/ryzom/client/src/interface_v3/ctrl_quad.cpp index b8b4455eb..5eb8f1597 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_quad.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_quad.cpp @@ -23,7 +23,7 @@ using namespace NLMISC; -//********************************************************************************* +// ********************************************************************************* CCtrlQuad::CCtrlQuad() : CCtrlBase(TCtorParam()), _Color(CRGBA::White), _Additif(false), _Filtered(true), @@ -39,14 +39,14 @@ CCtrlQuad::CCtrlQuad() : CCtrlBase(TCtorParam()), _Color(CRGBA::White), _RealQuad.Uv3.set(0.f, 1.f); } -//********************************************************************************* +// ********************************************************************************* bool CCtrlQuad::parse(xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */) { nlassert(0); // NOT IMPLEMENTED (only created dynamically at this time) return false; } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::updateCoords() { H_AUTO(Rz_CCtrlQuad_updateCoords) @@ -57,7 +57,7 @@ void CCtrlQuad::updateCoords() _RealQuad.set(_Quad.V0 + delta, _Quad.V1 + delta, _Quad.V2 + delta, _Quad.V3 + delta); } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::draw() { H_AUTO(Rz_CCtrlQuad_draw) @@ -287,14 +287,14 @@ void CCtrlQuad::draw() } } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setAlpha(sint32 a) { H_AUTO(Rz_CCtrlQuad_setAlpha) _Color.A = (uint8) a; } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setTexture(const std::string &texName) { H_AUTO(Rz_CCtrlQuad_setTexture) @@ -303,7 +303,7 @@ void CCtrlQuad::setTexture(const std::string &texName) _TextureId.setTexture(texName.c_str()); } -//********************************************************************************* +// ********************************************************************************* std::string CCtrlQuad::getTexture() const { H_AUTO(Rz_CCtrlQuad_getTexture) @@ -312,7 +312,7 @@ std::string CCtrlQuad::getTexture() const return rVR.getTextureNameFromId (_TextureId); } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setQuad(const CQuad &quad) { H_AUTO(Rz_CCtrlQuad_setQuad) @@ -328,7 +328,7 @@ void CCtrlQuad::setQuad(const CQuad &quad) _Quad = quad; } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setQuad(const NLMISC::CVector &start, const NLMISC::CVector &end, float thickness) { H_AUTO(Rz_CCtrlQuad_setQuad) @@ -338,7 +338,7 @@ void CCtrlQuad::setQuad(const NLMISC::CVector &start, const NLMISC::CVector &end setQuad(CQuad(start + up, end + up, end - up, start - up)); } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setQuad(const NLMISC::CVector &pos, float radius, float angle /*=0.f*/) { H_AUTO(Rz_CCtrlQuad_setQuad) @@ -353,7 +353,7 @@ void CCtrlQuad::setQuad(const NLMISC::CVector &pos, float radius, float angle /* } } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPos, float angle /*= 0.f*/, float offCenter /* = 0.f*/) { H_AUTO(Rz_CCtrlQuad_setQuad) @@ -379,21 +379,21 @@ void CCtrlQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPo } } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setAdditif(bool additif) { H_AUTO(Rz_CCtrlQuad_setAdditif) _Additif = additif; } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setFiltered(bool filtered) { H_AUTO(Rz_CCtrlQuad_setFiltered) _Filtered = filtered; } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setPattern(float umin, float umax, TWrapMode wrapMode) { H_AUTO(Rz_CCtrlQuad_setPattern) @@ -403,7 +403,7 @@ void CCtrlQuad::setPattern(float umin, float umax, TWrapMode wrapMode) _WrapMode = wrapMode; } -//********************************************************************************* +// ********************************************************************************* void CCtrlQuad::setCustomUVs(const CUV uvs[4]) { H_AUTO(Rz_CCtrlQuad_setCustomUVs) @@ -411,14 +411,14 @@ void CCtrlQuad::setCustomUVs(const CUV uvs[4]) _WrapMode = CustomUVs; } -//********************************************************************************* +// ********************************************************************************* bool CCtrlQuad::handleEvent(const CEventDescriptor &/* event */) { H_AUTO(Rz_CCtrlQuad_handleEvent) return false; } -//********************************************************************************* +// ********************************************************************************* bool CCtrlQuad::contains(const NLMISC::CVector2f &pos) const { H_AUTO(Rz_CCtrlQuad_contains) diff --git a/code/ryzom/client/src/interface_v3/custom_mouse.cpp b/code/ryzom/client/src/interface_v3/custom_mouse.cpp index 183c7e761..84db66c68 100644 --- a/code/ryzom/client/src/interface_v3/custom_mouse.cpp +++ b/code/ryzom/client/src/interface_v3/custom_mouse.cpp @@ -30,7 +30,7 @@ using namespace NL3D; #ifdef NL_OS_WINDOWS -//************************************************************************************* +// ************************************************************************************* CCustomMouse::CCursor::CCursor() : ColorDepth(CCustomMouse::ColorDepth32), OrigHeight(32), HotspotScale(1.f), @@ -44,7 +44,7 @@ CCustomMouse::CCursor::CCursor() : ColorDepth(CCustomMouse::ColorDepth32), { } -//************************************************************************************* +// ************************************************************************************* CCustomMouse::CCursor::~CCursor() { if (Icon) @@ -53,7 +53,7 @@ CCustomMouse::CCursor::~CCursor() } } -//************************************************************************************* +// ************************************************************************************* CCustomMouse::CCustomMouse() { _ColorDepth = CCustomMouse::ColorDepth32; @@ -68,7 +68,7 @@ CCustomMouse::CCustomMouse() -//************************************************************************************* +// ************************************************************************************* bool CCustomMouse::isAlphaBlendedCursorSupported() { if (!_AlphaBlendedCursorSupportRetrieved) @@ -96,7 +96,7 @@ namespace NLMISC extern bool TempMaxVerboseResample; } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::addCursor(const std::string &name, const NLMISC::CBitmap &cursorBitmap) { if (!isAlphaBlendedCursorSupported()) return; @@ -279,7 +279,7 @@ void CCustomMouse::addCursor(const std::string &name, const NLMISC::CBitmap &cur } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::release() { if (!isAlphaBlendedCursorSupported()) return; @@ -292,7 +292,7 @@ void CCustomMouse::release() _Cursors.clear(); } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::setColorDepth(TColorDepth colorDepth) { if (colorDepth == _ColorDepth) return; @@ -300,14 +300,14 @@ void CCustomMouse::setColorDepth(TColorDepth colorDepth) updateCursor(true); } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::updateCursor(bool forceRebuild) { if (!Driver) return; setCursor(_CurrName, _CurrCol, _CurrRot, _CurrHotSpotX, _CurrHotSpotY, forceRebuild); } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild) { if (!isAlphaBlendedCursorSupported()) return; @@ -363,7 +363,7 @@ void CCustomMouse::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 r } -//************************************************************************************* +// ************************************************************************************* HICON CCustomMouse::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY) { nlassert(isAlphaBlendedCursorSupported()); @@ -440,7 +440,7 @@ HICON CCustomMouse::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::setSystemArrow() { extern HINSTANCE HInstance; @@ -460,31 +460,31 @@ void CCustomMouse::setSystemArrow() // not implemented yet for other OS -//************************************************************************************* +// ************************************************************************************* CCustomMouse::CCustomMouse() { // NOT IMPLEMENTED } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild) { // NOT IMPLEMENTED } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::release() { // NOT IMPLEMENTED } -//************************************************************************************* +// ************************************************************************************* bool CCustomMouse::isAlphaBlendedCursorSupported() { return false; } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::setSystemArrow() { // @@ -495,13 +495,13 @@ void CCustomMouse::addCursor(const std::string &name, const NLMISC::CBitmap &cur // TODO for Linux } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::setColorDepth(TColorDepth colorDepth) { // TODO for Linux } -//************************************************************************************* +// ************************************************************************************* void CCustomMouse::updateCursor(bool forceRebuild) { // TODO for Linux diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp index f0c6d3263..fb8db2b74 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.cpp @@ -29,7 +29,7 @@ using namespace NLMISC; NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListSheetMission, std::string, "list_sheet_mission"); -//********************************************************************************** +// ********************************************************************************** void CDBGroupListSheetMission::CSheetChildMission::init(CDBGroupListSheetText *pFather, uint index) { // init my parent @@ -46,7 +46,7 @@ void CDBGroupListSheetMission::CSheetChildMission::init(CDBGroupListSheetText *p } -//********************************************************************************** +// ********************************************************************************** CViewText *CDBGroupListSheetMission::CSheetChildMission::createViewText() const { // create a view text id because mission text is send by the server @@ -57,7 +57,7 @@ CViewText *CDBGroupListSheetMission::CSheetChildMission::createViewText() const return vti; } -//********************************************************************************** +// ********************************************************************************** bool CDBGroupListSheetMission::CSheetChildMission::isInvalidated(CDBGroupListSheetText * /* pFather */) { uint8 newPreReqState = (uint8)CurrentPreReqState.getSInt32(); @@ -78,7 +78,7 @@ void CDBGroupListSheetMission::CSheetChildMission::update(CDBGroupListSheetText CSheetChild::update(pFather); } -//********************************************************************************** +// ********************************************************************************** void CDBGroupListSheetMission::CSheetChildMission::updateViewText(CDBGroupListSheetText *pFather) { CSheetChild::updateViewText(pFather); @@ -130,7 +130,7 @@ void CDBGroupListSheetMission::CSheetChildMission::updateViewText(CDBGroupListSh } -//********************************************************************************** +// ********************************************************************************** bool CDBGroupListSheetMission::CSheetChildMission::isSheetValid(CDBGroupListSheetText * /* pFather */) { if (!Ctrl) return false; diff --git a/code/ryzom/client/src/interface_v3/group_compas.cpp b/code/ryzom/client/src/interface_v3/group_compas.cpp index e642fa456..098e33b6a 100644 --- a/code/ryzom/client/src/interface_v3/group_compas.cpp +++ b/code/ryzom/client/src/interface_v3/group_compas.cpp @@ -230,7 +230,7 @@ void CGroupCompas::draw() // const NLMISC::CVectorD &userPosD = UserEntity->pos(); NLMISC::CVector userPos((float) userPosD.x, (float) userPosD.y, (float) userPosD.z); - NLMISC::CVector2f targetPos; + NLMISC::CVector2f targetPos(0.f, 0.f); // if a position tracker is provided, use it CCompassTarget displayedTarget = _Target; @@ -807,7 +807,7 @@ void CGroupCompasMenu::setActive (bool state) uint nbUserLandMarks = std::min( uint(currCont->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks() ); for(k = 0; k < nbUserLandMarks; ++k) { - if (currCont->UserLandMarks[k].Type >= 0 && currCont->UserLandMarks[k].Type < CUserLandMark::UserLandMarkTypeCount) + if (currCont->UserLandMarks[k].Type < CUserLandMark::UserLandMarkTypeCount) { CCompassTarget ct; ct.setType(CCompassTarget::UserLandMark); diff --git a/code/ryzom/client/src/interface_v3/group_header.cpp b/code/ryzom/client/src/interface_v3/group_header.cpp index 52a1dceb6..7526fcd02 100644 --- a/code/ryzom/client/src/interface_v3/group_header.cpp +++ b/code/ryzom/client/src/interface_v3/group_header.cpp @@ -32,12 +32,12 @@ using namespace NLMISC; // CGroupHeader // ////////////////// -//***************************************************************************************************************** +// ***************************************************************************************************************** CGroupHeader::CGroupHeader(const TCtorParam ¶m) : CGroupList(param), _HeaderMaxSize(32767) { } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CGroupHeader::enlargeColumns(sint32 margin) { std::vector entries; @@ -115,7 +115,7 @@ void CGroupHeader::enlargeColumns(sint32 margin) invalidateCoords(); } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CGroupHeader::resizeColumnsAndContainer(sint32 margin) { std::vector entries; @@ -182,7 +182,7 @@ void CGroupHeader::resizeColumnsAndContainer(sint32 margin) invalidateCoords(); } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CGroupHeader::getEntries(std::vector &dest) { dest.clear(); @@ -197,7 +197,7 @@ void CGroupHeader::getEntries(std::vector &dest) } } -//***************************************************************************************************************** +// ***************************************************************************************************************** int CGroupHeader::luaEnlargeColumns(CLuaState &ls) { const char *funcName = "enlargeColumns"; @@ -207,7 +207,7 @@ int CGroupHeader::luaEnlargeColumns(CLuaState &ls) return 0; } -//***************************************************************************************************************** +// ***************************************************************************************************************** int CGroupHeader::luaResizeColumnsAndContainer(CLuaState &ls) { const char *funcName = "resizeColumnsAndContainer"; @@ -217,7 +217,7 @@ int CGroupHeader::luaResizeColumnsAndContainer(CLuaState &ls) return 0; } -//***************************************************************************************************************** +// ***************************************************************************************************************** bool CGroupHeader::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { if(!CGroupList::parse(cur, parentGroup)) return false; @@ -373,13 +373,13 @@ private: sint32 _WMin; }; -//***************************************************************************************************************** +// ***************************************************************************************************************** CGroupHeaderEntry::CGroupHeaderEntry(const TCtorParam ¶m) : CInterfaceGroup(param) { _MinSize = 4; } -//***************************************************************************************************************** +// ***************************************************************************************************************** bool CGroupHeaderEntry::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { if (!CInterfaceGroup::parse(cur, parentGroup)) return false; @@ -416,14 +416,14 @@ bool CGroupHeaderEntry::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) return true; } -//***************************************************************************************************************** +// ***************************************************************************************************************** CInterfaceGroup *CGroupHeaderEntry::getTargetColumn() const { CInterfaceManager *im = CInterfaceManager::getInstance(); return dynamic_cast(im->getElementFromId(_TargetColumnId)); } -//***************************************************************************************************************** +// ***************************************************************************************************************** void CGroupHeaderEntry::updateCoords() { CInterfaceGroup::updateCoords(); diff --git a/code/ryzom/client/src/interface_v3/group_header.h b/code/ryzom/client/src/interface_v3/group_header.h index dc3b409e2..248c9585a 100644 --- a/code/ryzom/client/src/interface_v3/group_header.h +++ b/code/ryzom/client/src/interface_v3/group_header.h @@ -23,7 +23,7 @@ class CGroupHeaderEntry; -//***************************************************************************************************************** +// ***************************************************************************************************************** /** Display a header with movable entries. * Usually used with a table to change the size of each column (much like the windows file explorer in 'details' mode) * @@ -54,7 +54,7 @@ private: int luaResizeColumnsAndContainer(CLuaState &ls); }; -//***************************************************************************************************************** +// ***************************************************************************************************************** // an entry in a header, includes a "mover control" to move it inside its parent header // NOTE : when not used inside a CGroupHeader, will work, but there will be no 'max_size' class CGroupHeaderEntry : public CInterfaceGroup diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index c1f1ccf3f..aa101c449 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -634,6 +634,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) case EGSPD::CPeople::Matis: loadLandmarkInfo(cur, "home_matis", _HomeLMOptions); break; case EGSPD::CPeople::Zorai: loadLandmarkInfo(cur, "home_zorai", _HomeLMOptions); break; case EGSPD::CPeople::Tryker: loadLandmarkInfo(cur, "home_tryker", _HomeLMOptions); break; + default: break; } loadLandmarkInfo(cur, "respawn", _RespawnLMOptions); // animal landmark diff --git a/code/ryzom/client/src/interface_v3/group_wheel.cpp b/code/ryzom/client/src/interface_v3/group_wheel.cpp index f732079d6..51a6390f9 100644 --- a/code/ryzom/client/src/interface_v3/group_wheel.cpp +++ b/code/ryzom/client/src/interface_v3/group_wheel.cpp @@ -26,14 +26,14 @@ NLMISC_REGISTER_OBJECT(CViewBase, CInterfaceGroupWheel, std::string, "group_wheel"); -//***************************************************************************************************************** +// ***************************************************************************************************************** CInterfaceGroupWheel::CInterfaceGroupWheel(const TCtorParam ¶m) : CInterfaceGroup(param) { _AHWheelUp = NULL; _AHWheelDown = NULL; } -//***************************************************************************************************************** +// ***************************************************************************************************************** bool CInterfaceGroupWheel::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { if (!CInterfaceGroup::parse(cur, parentGroup)) return false; @@ -42,7 +42,7 @@ bool CInterfaceGroupWheel::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) return true; } -//***************************************************************************************************************** +// ***************************************************************************************************************** bool CInterfaceGroupWheel::handleEvent(const CEventDescriptor &event) { if (CInterfaceGroup::handleEvent(event)) return true; diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index aff874857..a8bb9cc2f 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -606,7 +606,7 @@ void CGuildManager::initDBObservers() // CDBGroupListAscensor // *************************************************************************** -//********************************************************************************** +// ********************************************************************************** void CDBGroupListAscensor::CSheetChildAscensor::init(CDBGroupListSheetText *pFather, uint index) { // init my parent @@ -617,7 +617,7 @@ void CDBGroupListAscensor::CSheetChildAscensor::init(CDBGroupListSheetText *pFat SecondSheetIdCache = 0; } -//********************************************************************************** +// ********************************************************************************** bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetText * /* pFather */) { if (Ctrl->getSheetId() != SecondSheetIdCache) @@ -663,7 +663,7 @@ bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetT return false; } -//********************************************************************************** +// ********************************************************************************** bool CDBGroupListAscensor::CSheetChildAscensor::isSheetValid(CDBGroupListSheetText * /* pFather */) { if (!Ctrl) return false; diff --git a/code/ryzom/client/src/interface_v3/input_handler_manager.cpp b/code/ryzom/client/src/interface_v3/input_handler_manager.cpp index 3f55b11a6..6fae67260 100644 --- a/code/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/code/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -75,7 +75,7 @@ CInputHandlerManager::~CInputHandlerManager() { } -//******************************************************************************************** +// ******************************************************************************************** void CInputHandlerManager::releaseInstance() { if( _Instance ) diff --git a/code/ryzom/client/src/interface_v3/interface_expr_node.cpp b/code/ryzom/client/src/interface_v3/interface_expr_node.cpp index bb38767ef..319c3fc9f 100644 --- a/code/ryzom/client/src/interface_v3/interface_expr_node.cpp +++ b/code/ryzom/client/src/interface_v3/interface_expr_node.cpp @@ -21,7 +21,7 @@ #include "../cdb_leaf.h" #include "../cdb_branch.h" -//******************************************************************************************************* +// ******************************************************************************************************* void CInterfaceExprNodeValue::eval(CInterfaceExprValue &result) { result = Value; @@ -37,7 +37,7 @@ void CInterfaceExprNodeValue::getDepends(std::vector &/* nodes */) } -//******************************************************************************************************* +// ******************************************************************************************************* void CInterfaceExprNodeValueFnCall::eval(CInterfaceExprValue &result) { nlassert(Func); @@ -80,7 +80,7 @@ CInterfaceExprNodeValueFnCall::~CInterfaceExprNodeValueFnCall() } } -//******************************************************************************************************* +// ******************************************************************************************************* void CInterfaceExprNodeDBLeaf::eval(CInterfaceExprValue &result) { nlassert(Leaf); @@ -107,7 +107,7 @@ void CInterfaceExprNodeDBLeaf::getDepends(std::vector &nodes) } -//******************************************************************************************************* +// ******************************************************************************************************* void CInterfaceExprNodeDBBranch::eval(CInterfaceExprValue &result) { nlassert(Branch); @@ -134,7 +134,7 @@ void CInterfaceExprNodeDBBranch::getDepends(std::vector &nodes) } -//******************************************************************************************************* +// ******************************************************************************************************* void CInterfaceExprNodeDependantDBRead::eval(CInterfaceExprValue &result) { // no gain there, but barely used diff --git a/code/ryzom/client/src/interface_v3/interface_expr_node.h b/code/ryzom/client/src/interface_v3/interface_expr_node.h index 7b33e87f4..7327c4ada 100644 --- a/code/ryzom/client/src/interface_v3/interface_expr_node.h +++ b/code/ryzom/client/src/interface_v3/interface_expr_node.h @@ -39,7 +39,7 @@ public: }; -//******************************************************************************************************* +// ******************************************************************************************************* /** A constant value already parsed by interface (in a interface expr parse tree) */ class CInterfaceExprNodeValue : public CInterfaceExprNode @@ -52,7 +52,7 @@ public: virtual void getDepends(std::vector &nodes); }; -//******************************************************************************************************* +// ******************************************************************************************************* /** A fct call (in a interface expr parse tree) */ class CInterfaceExprNodeValueFnCall : public CInterfaceExprNode @@ -68,7 +68,7 @@ public: virtual ~CInterfaceExprNodeValueFnCall(); }; -//******************************************************************************************************* +// ******************************************************************************************************* /** A db leaf read (in a interface expr parse tree) */ class CInterfaceExprNodeDBLeaf : public CInterfaceExprNode @@ -81,7 +81,7 @@ public: virtual void getDepends(std::vector &nodes); }; -//******************************************************************************************************* +// ******************************************************************************************************* /** A db branch read (in a interface expr parse tree) */ class CInterfaceExprNodeDBBranch : public CInterfaceExprNode @@ -94,7 +94,7 @@ public: virtual void getDepends(std::vector &nodes); }; -//******************************************************************************************************* +// ******************************************************************************************************* /** A dependant db read (in a interface expr parse tree) * This is rarely used so no real optim there.. */ diff --git a/code/ryzom/client/src/interface_v3/lua_helper.h b/code/ryzom/client/src/interface_v3/lua_helper.h index bab37496b..c8192dcff 100644 --- a/code/ryzom/client/src/interface_v3/lua_helper.h +++ b/code/ryzom/client/src/interface_v3/lua_helper.h @@ -54,7 +54,7 @@ private: }; -//************************************************************************** +// ************************************************************************** /** Helper class to restore the lua stack to the desired size when this object goes out of scope */ class CLuaStackRestorer @@ -354,7 +354,7 @@ private: private: // this object isn't intended to be copied - CLuaState(const CLuaState &/* other */) { nlassert(0); } + CLuaState(const CLuaState &/* other */):NLMISC::CRefCount() { nlassert(0); } CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; } void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0); diff --git a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp index 4d16c523a..a6e4f15ba 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -611,16 +611,19 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std // Get ith param (params are nameOfParam=argumentOfAction strings separated by |) // except for the last real param (which can then contains | chars) if it is the last param - if ((curStr.find('|') == string::npos) || - ((noParam == nbRealParam-1) && (rP.Type != CBaseAction::CParameter::Hidden)) && (i == (pBA->Parameters.size()-1))) + string::size_type pos = curStr.find('|'); + + if ((pos == string::npos) || + (((noParam == nbRealParam-1) && (rP.Type != CBaseAction::CParameter::Hidden)) && (i == (pBA->Parameters.size()-1)))) { sTmp = curStr; curStr = ""; } else { - sTmp = curStr.substr(0,curStr.find('|')); - curStr = curStr.substr(curStr.find('|')+1,curStr.size()); + + sTmp = curStr.substr(0, pos); + curStr = curStr.substr(pos+1, curStr.size()); } // Remove 'name=' diff --git a/code/ryzom/client/src/interface_v3/obs_huge_list.cpp b/code/ryzom/client/src/interface_v3/obs_huge_list.cpp index bb9f35193..ae68aeb36 100644 --- a/code/ryzom/client/src/interface_v3/obs_huge_list.cpp +++ b/code/ryzom/client/src/interface_v3/obs_huge_list.cpp @@ -125,7 +125,7 @@ void CHugeListObs::setListType(ListType listType) } -//**************************************************************************** +// **************************************************************************** bool CHugeListObs::init() { nlassert((uint) _Category < ListTypeCount); // must call setListType @@ -233,7 +233,7 @@ bool CHugeListObs::init() return true; } -//**************************************************************************** +// **************************************************************************** void CHugeListObs::start() { nlassert((uint) _Category < ListTypeCount); // must call setListType @@ -301,7 +301,7 @@ void CHugeListObs::start() _PhraseClientFill= false; } -//**************************************************************************** +// **************************************************************************** void CHugeListObs::update(ICDBNode * /* node */) { nlassert((uint) _Category < ListTypeCount); // must call setListType @@ -493,7 +493,7 @@ void CHugeListObs::update(ICDBNode * /* node */) } -//**************************************************************************** +// **************************************************************************** void CHugeListObs::updateUIItemPage(uint index) { nlassert((uint) _Category < ListTypeCount); // must call setListType diff --git a/code/ryzom/client/src/interface_v3/obs_huge_list.h b/code/ryzom/client/src/interface_v3/obs_huge_list.h index d23ebc2a6..fe2fba4f2 100644 --- a/code/ryzom/client/src/interface_v3/obs_huge_list.h +++ b/code/ryzom/client/src/interface_v3/obs_huge_list.h @@ -35,7 +35,7 @@ #define DB_LOCAL_BRANCH_FOR_MISSIONS "LOCAL:CHOOSE_MISSIONS" -//**************************************************************************** +// **************************************************************************** /** Database observer to update incrementaly a list of items * Class synchronizing huge list of leaves from server to local * This is done through a small window in the server database of 8 (for the moment) elements diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 246df5d5f..17c6eadce 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -289,13 +289,17 @@ void CChatStdInput::registerListeningWindow(CChatWindow *cw) Universe.addListeningWindow(cw); } + //=========================================================================================================== -CPeopleInterraction::CPeopleInterraction() : SystemInfo(NULL), +CPeopleInterraction::CPeopleInterraction() : Region(NULL), + Universe(NULL), + TeamChat(NULL), GuildChat(NULL), - CurrPartyChatID(0), + SystemInfo(NULL), TellWindow(NULL), DebugInfo(NULL), - YuboChat(NULL) + YuboChat(NULL), + CurrPartyChatID(0) { for(uint i=0;i &vertices) { if (vertices.size() == _Poly.Vertices.size() && @@ -71,7 +71,7 @@ static inline bool totallyOutside(const CVector &minCorner, const CVector &maxCo (sint32) maxCorner.y < cy; } -//********************************************************************************* +// ********************************************************************************* void CViewPolygon::draw() { if (_Tris.empty()) return; @@ -178,14 +178,14 @@ void CViewPolygon::draw() vr.drawUnclippedTriangles(_RenderLayer, _RealTris, col); } -//********************************************************************************* +// ********************************************************************************* void CViewPolygon::updateCoords() { // assume that clipping will have to be done again, real update of triangle will be done at render time _Touched = true; } -//********************************************************************************* +// ********************************************************************************* void CViewPolygon::setAlpha(sint32 a) { _Color.A = (uint8) a; diff --git a/code/ryzom/client/src/interface_v3/view_quad.cpp b/code/ryzom/client/src/interface_v3/view_quad.cpp index 9abdbd316..a788fc226 100644 --- a/code/ryzom/client/src/interface_v3/view_quad.cpp +++ b/code/ryzom/client/src/interface_v3/view_quad.cpp @@ -21,7 +21,7 @@ using namespace NLMISC; -//********************************************************************************* +// ********************************************************************************* CViewQuad::CViewQuad() : CViewBase(TCtorParam()), _Color(CRGBA::White), _Additif(false), _UMin(0.f), @@ -36,14 +36,14 @@ CViewQuad::CViewQuad() : CViewBase(TCtorParam()), _Color(CRGBA::White), _RealQuad.Uv3.set(0.f, 1.f); } -//********************************************************************************* +// ********************************************************************************* bool CViewQuad::parse(xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */) { nlassert(0); // NOT IMPLEMENTED (only created dynamically at this time) return false; } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::updateCoords() { CViewBase::updateCoords(); @@ -53,7 +53,7 @@ void CViewQuad::updateCoords() _RealQuad.set(_Quad.V0 + delta, _Quad.V1 + delta, _Quad.V2 + delta, _Quad.V3 + delta); } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::draw() { nlassert(_Parent); @@ -270,13 +270,13 @@ void CViewQuad::draw() } } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setAlpha(sint32 a) { _Color.A = (uint8) a; } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setTexture(const std::string &texName) { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -284,7 +284,7 @@ void CViewQuad::setTexture(const std::string &texName) _TextureId.setTexture(texName.c_str()); } -//********************************************************************************* +// ********************************************************************************* std::string CViewQuad::getTexture() const { CInterfaceManager *pIM = CInterfaceManager::getInstance(); @@ -292,7 +292,7 @@ std::string CViewQuad::getTexture() const return rVR.getTextureNameFromId (_TextureId); } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setQuad(const CQuad &quad) { float qXMin = minof(quad.V0.x, quad.V1.x, quad.V2.x, quad.V3.x); @@ -307,7 +307,7 @@ void CViewQuad::setQuad(const CQuad &quad) _Quad = quad; } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setQuad(const NLMISC::CVector &start, const NLMISC::CVector &end, float thickness) { CVector right = end - start; @@ -316,7 +316,7 @@ void CViewQuad::setQuad(const NLMISC::CVector &start, const NLMISC::CVector &end setQuad(CQuad(start + up, end + up, end - up, start - up)); } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setQuad(const NLMISC::CVector &pos, float radius, float angle /*=0.f*/) { if (angle == 0.f) @@ -330,7 +330,7 @@ void CViewQuad::setQuad(const NLMISC::CVector &pos, float radius, float angle /* } } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPos, float angle /*= 0.f*/, float offCenter /* = 0.f*/) { NLMISC::CVector pos = srcPos; @@ -355,13 +355,13 @@ void CViewQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPo } } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setAdditif(bool additif) { _Additif = additif; } -//********************************************************************************* +// ********************************************************************************* void CViewQuad::setPattern(float umin, float umax, TWrapMode wrapMode) { nlassert((uint) wrapMode < WrapModeCount); diff --git a/code/ryzom/client/src/interface_v3/view_text_id_formated.cpp b/code/ryzom/client/src/interface_v3/view_text_id_formated.cpp index f04a32e25..29d360a4e 100644 --- a/code/ryzom/client/src/interface_v3/view_text_id_formated.cpp +++ b/code/ryzom/client/src/interface_v3/view_text_id_formated.cpp @@ -32,7 +32,7 @@ using namespace STRING_MANAGER; NLMISC_REGISTER_OBJECT(CViewBase, CViewTextIDFormated, std::string, "text_id_formated"); -//********************************************************************************* +// ********************************************************************************* bool CViewTextIDFormated::parse(xmlNodePtr cur,CInterfaceGroup * parentGroup) { if (!CViewTextID::parse(cur, parentGroup)) return false; @@ -44,7 +44,7 @@ bool CViewTextIDFormated::parse(xmlNodePtr cur,CInterfaceGroup * parentGroup) return true; } -//********************************************************************************* +// ********************************************************************************* void CViewTextIDFormated::checkCoords() { if (_IsDBLink) diff --git a/code/ryzom/client/src/login_progress_post_thread.cpp b/code/ryzom/client/src/login_progress_post_thread.cpp index 5525836ff..9b6e351da 100644 --- a/code/ryzom/client/src/login_progress_post_thread.cpp +++ b/code/ryzom/client/src/login_progress_post_thread.cpp @@ -192,7 +192,7 @@ public: } if (newStep) { - if (loginStep.Step == LoginStep_Stop) + if (loginStep.Step == (uint)LoginStep_Stop) { break; } diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 7c9084b95..cacf9c396 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -990,7 +990,7 @@ void endRenderSkyPart(TSkyMode skyMode) } -//*************************************************************************************************************************** +// *************************************************************************************************************************** // Render a part of the canopy static void renderCanopyPart(UScene::TRenderPart renderPart) { @@ -1012,7 +1012,7 @@ static void renderCanopyPart(UScene::TRenderPart renderPart) SceneRoot->renderPart(renderPart); } -//*************************************************************************************************************************** +// *************************************************************************************************************************** // Render a part of the main scene static void renderMainScenePart(UScene::TRenderPart renderPart) { @@ -1030,7 +1030,7 @@ static void renderMainScenePart(UScene::TRenderPart renderPart) } -//*************************************************************************************************************************** +// *************************************************************************************************************************** // Render a part of the sky static void renderSkyPart(UScene::TRenderPart renderPart, TSkyMode skyMode) { @@ -1057,7 +1057,7 @@ static void renderSkyPart(UScene::TRenderPart renderPart, TSkyMode skyMode) } -//*************************************************************************************************************************** +// *************************************************************************************************************************** // Render all scenes void renderAll(bool forceFullDetail) { diff --git a/code/ryzom/client/src/micro_life_manager.cpp b/code/ryzom/client/src/micro_life_manager.cpp index a980379aa..042b8dc1a 100644 --- a/code/ryzom/client/src/micro_life_manager.cpp +++ b/code/ryzom/client/src/micro_life_manager.cpp @@ -65,7 +65,7 @@ extern NL3D::UMaterial GenericMat; H_AUTO_DECL(RZ_MicroLifeManager) -//******************************************************************************************** +// ******************************************************************************************** CMicroLifeManager::CMicroLifeManager() { FPU_CHECKER @@ -77,7 +77,7 @@ CMicroLifeManager::CMicroLifeManager() _Noise.Rand = 1.f; } -//******************************************************************************************** +// ******************************************************************************************** CMicroLifeManager &CMicroLifeManager::getInstance() { FPU_CHECKER @@ -86,7 +86,7 @@ CMicroLifeManager &CMicroLifeManager::getInstance() return instance; } -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::init(const NLMISC::CVector2f &minCorner, const NLMISC::CVector2f &maxCorner, float cellSize /* = 30.f*/) { FPU_CHECKER @@ -132,7 +132,7 @@ void CMicroLifeManager::init(const NLMISC::CVector2f &minCorner, const NLMISC::C // - we search for redundant lists and store the result as index in the final grid. This is done in packBuildGrid -//********************************************************************************************************************************* +// ********************************************************************************************************************************* bool CMicroLifeManager::CGridOverlapPolyInfo::operator < (const CMicroLifeManager::CGridOverlapPolyInfo &other) const { FPU_CHECKER @@ -144,7 +144,7 @@ bool CMicroLifeManager::CGridOverlapPolyInfo::operator < (const CMicroLifeManage return Poly < other.Poly; } -//********************************************************************************************************************************* +// ********************************************************************************************************************************* bool CMicroLifeManager::CGridOverlapPolyInfo::operator == (const CMicroLifeManager::CGridOverlapPolyInfo &other) const { FPU_CHECKER @@ -156,7 +156,7 @@ bool CMicroLifeManager::CGridOverlapPolyInfo::operator == (const CMicroLifeManag Poly == other.Poly; } -//********************************************************************************************************************************* +// ********************************************************************************************************************************* bool CMicroLifeManager::CGridOverlapPolyInfoVector::operator < (const CMicroLifeManager::CGridOverlapPolyInfoVector &other) const { FPU_CHECKER @@ -169,7 +169,7 @@ bool CMicroLifeManager::CGridOverlapPolyInfoVector::operator < (const CMicroLife return false; } -//********************************************************************************************************************************* +// ********************************************************************************************************************************* bool CMicroLifeManager::CGridOverlapPolyInfoVector::operator == (const CMicroLifeManager::CGridOverlapPolyInfoVector &other) const { FPU_CHECKER @@ -179,7 +179,7 @@ bool CMicroLifeManager::CGridOverlapPolyInfoVector::operator == (const CMicroLif } -//*************************************************************************************************************************** +// *************************************************************************************************************************** void CMicroLifeManager::drawPolyInBuildGrid(const std::vector &primPoly, uint primitiveIndex, CMicroLifeManager::TBuildGrid &buildGrid, @@ -261,7 +261,7 @@ public: }; -//*************************************************************************************************************************** +// *************************************************************************************************************************** // pack the build grid so that each cell only contains index into a small set of poly list, instead of a full poly list // (a lot of cells share the same poly list) void CMicroLifeManager::packBuildGrid(TBuildGrid &buildGrid, @@ -313,7 +313,7 @@ void CMicroLifeManager::packBuildGrid(TBuildGrid &buildGrid, finalPossibleLists.swap(flatSet); } -//*************************************************************************************************************************** +// *************************************************************************************************************************** // read a .primitive file and add its content to a build grid void CMicroLifeManager::addPrimitiveToBuildGrid(const std::string &fileName, uint &primitiveIndex, CMicroLifeManager::TBuildGrid &buildGrid) { @@ -420,7 +420,7 @@ void CMicroLifeManager::addPrimitiveToBuildGrid(const std::string &fileName, uin } } -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::build(const std::vector &fileNames) { FPU_CHECKER @@ -437,7 +437,7 @@ void CMicroLifeManager::build(const std::vector &fileNames) } -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::release() { FPU_CHECKER @@ -463,7 +463,7 @@ void CMicroLifeManager::release() #endif } -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::tileAdded(const NL3D::CTileAddedInfo &infos) { FPU_CHECKER @@ -694,7 +694,7 @@ void CMicroLifeManager::tileAdded(const NL3D::CTileAddedInfo &infos) } } -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::tileRemoved(uint64 id) { FPU_CHECKER @@ -730,7 +730,7 @@ static const NLMISC::CRGBA DebugCols[] = }; static const uint NumDebugCols = sizeof(DebugCols) / sizeof(DebugCols[0]); -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::dumpMLGrid(const std::string &filename) { FPU_CHECKER @@ -767,7 +767,7 @@ void CMicroLifeManager::dumpMLGrid(const std::string &filename) f.close(); } -//******************************************************************************************** +// ******************************************************************************************** void CMicroLifeManager::renderMLZones(const NLMISC::CVector2f &camPos, float maxDist /*=1000.f*/) { FPU_CHECKER @@ -839,7 +839,7 @@ void CMicroLifeManager::renderMLZones(const NLMISC::CVector2f &camPos, float max } #ifdef NL_DEBUG - //******************************************************************************************** + // ******************************************************************************************** void CMicroLifeManager::renderActiveTiles() { FPU_CHECKER @@ -894,7 +894,7 @@ void CMicroLifeManager::renderMLZones(const NLMISC::CVector2f &camPos, float max #if !FINAL_VERSION #include "continent_manager.h" - //****************************************************************************************************************** + // ****************************************************************************************************************** // display micro-life zone on screen NLMISC_COMMAND(showMLZones,"display micro-life zones", "<0 = off, 1 = on>") { @@ -904,7 +904,7 @@ void CMicroLifeManager::renderMLZones(const NLMISC::CVector2f &camPos, float max } - //****************************************************************************************************************** + // ****************************************************************************************************************** // dump micro-life zone in a tga file NLMISC_COMMAND(dumpMLZones,"display micro-life zones", "") { @@ -914,7 +914,7 @@ void CMicroLifeManager::renderMLZones(const NLMISC::CVector2f &camPos, float max } - //****************************************************************************************************************** + // ****************************************************************************************************************** // reload micro-life zones NLMISC_COMMAND(reloadMLZones, "reload micro-life zones", "") { diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index 34a1e1205..976786a97 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -56,10 +56,6 @@ #include "nel/georges/u_form_elm.h" #include "nel/georges/u_form_loader.h" -#ifndef NL_OS_WINDOWS - #include -#endif - /////////// // USING // /////////// diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index 29f2948a2..e5a3a58be 100644 --- a/code/ryzom/client/src/motion/user_controls.cpp +++ b/code/ryzom/client/src/motion/user_controls.cpp @@ -427,73 +427,46 @@ void CUserControls::getMouseAngleMove(float &dx, float &dy) dx = 0.0f; dy = 0.0f; - // The mouse may still "StandardMove" ie through a CEventMouseMove - // This can happens cause DirectInputDisabled, or because of the "Rotation Anti-Lag system" - // which start to rotate before the mouse is hid and message mode passed to RawMode + // This can happens cause DirectInputDisabled, or because of the + // "Rotation Anti-Lag system" which start to rotate before the mouse is hid + // and message mode passed to RawMode // - // If we are not on Windows; on X11 there is always StandardMove/CEventMouseMove. - // Currently, there is only a direct input IMouseDevice, not available on X11. + // On X11 and Cocoa, there is no MouseDevice, do it without. -#ifdef NL_OS_WINDOWS extern IMouseDevice *MouseDevice; - if (MouseDevice) - { - if( EventsListener.getMousePosX() != _LastFrameMousePosX || - EventsListener.getMousePosY() != _LastFrameMousePosY ) - { - float dmpx= EventsListener.getMousePosX() - _LastFrameMousePosX; - float dmpy= EventsListener.getMousePosY() - _LastFrameMousePosY; - // simulate mickeys mode - MouseDevice->convertStdMouseMoveInMickeys(dmpx, dmpy); - if(ClientCfg.FreeLookInverted) dmpy = -dmpy; - // update free look - EventsListener.updateFreeLookPos(dmpx, dmpy); - } - } -#else - // On X11 and Mac, do the thing without IMouseDevice implementation + + // if the mouse position changed if( EventsListener.getMousePosX() != _LastFrameMousePosX || EventsListener.getMousePosY() != _LastFrameMousePosY ) { - float dmpx, dmpy; - -#ifndef NL_MAC_NATIVE - // On X11 in free look mode, the mouse is pulled back to (0.5, 0.5) - // every update to prevent reaching a border and get stuck. - if(IsMouseFreeLook()) - { - /* - TODO use setCapture to not fake it - */ - dmpx = EventsListener.getMousePosX() - 0.5; - dmpy = EventsListener.getMousePosY() - 0.5; - } - else -#endif - { - dmpx = EventsListener.getMousePosX() - _LastFrameMousePosX; - dmpy = EventsListener.getMousePosY() - _LastFrameMousePosY; - } - - // TODO: read desktop mouse speed value on X11 / implement X11MouseDevice - dmpx *= 450.0f; - dmpy *= 450.0f; + // get the mouse movement delta + float dmpx= EventsListener.getMousePosX() - _LastFrameMousePosX; + float dmpy= EventsListener.getMousePosY() - _LastFrameMousePosY; + // simulate mickeys mode if there is a mouse device + if (MouseDevice) + MouseDevice->convertStdMouseMoveInMickeys(dmpx, dmpy); + else + { + dmpx *= (float)Driver->getWindowWidth(); + dmpy *= (float)Driver->getWindowHeight(); + } + + // handle inverted mouse, if enabled if(ClientCfg.FreeLookInverted) dmpy = -dmpy; + // update free look EventsListener.updateFreeLookPos(dmpx, dmpy); } -#endif // If the mouse move on the axis X, with a CGDMouseMove if(EventsListener.isMouseAngleX()) dx = -EventsListener.getMouseAngleX (); + // If the mouse move on the axis Y, with a CGDMouseMove if(EventsListener.isMouseAngleY()) dy = EventsListener.getMouseAngleY (); - - } diff --git a/code/ryzom/client/src/permanent_ban.cpp b/code/ryzom/client/src/permanent_ban.cpp index fe380e307..8cb4d0fac 100644 --- a/code/ryzom/client/src/permanent_ban.cpp +++ b/code/ryzom/client/src/permanent_ban.cpp @@ -29,7 +29,7 @@ using namespace NLMISC; #define REGKEY_PERMANENT_BAN "PB" -//************************************************************ +// ************************************************************ static void setPermanentBanRegistryKey(bool on) { #ifndef NL_OS_WINDOWS @@ -52,7 +52,7 @@ static void setPermanentBanRegistryKey(bool on) #endif } -//************************************************************ +// ************************************************************ static bool getPermanentBanRegistryKey() { #ifndef NL_OS_WINDOWS @@ -74,7 +74,7 @@ static bool getPermanentBanRegistryKey() #endif } -//*********************************************************** +// *********************************************************** static void setPermanentBanFileMarker(const std::string &path, bool on) { if (on) @@ -98,7 +98,7 @@ static void setPermanentBanFileMarker(const std::string &path, bool on) } } -//*********************************************************** +// *********************************************************** static bool getPermanentBanFileMarker(const std::string &path) { return CFile::isExists(path); @@ -107,7 +107,7 @@ static bool getPermanentBanFileMarker(const std::string &path) #define PERMANENT_BAN_FILE0 "c:\\3289763c1ecd044e" #define PERMANENT_BAN_FILE1 "78d0732e50bf2bbd" -//************************************************************ +// ************************************************************ void setPermanentBanMarkers(bool on) { setPermanentBanRegistryKey(on); @@ -116,7 +116,7 @@ void setPermanentBanMarkers(bool on) } -//************************************************************ +// ************************************************************ bool testPermanentBanMarkers() { /*#ifndef NL_OS_WINDOWS @@ -234,7 +234,7 @@ static void markBNPFile(std::string &path) fclose (f); } -//************************************************************ +// ************************************************************ void applyPermanentBanPunishment() { // go in the data directory & touch all bnp files so that the client should repatch all its datas diff --git a/code/ryzom/client/src/player_cl.cpp b/code/ryzom/client/src/player_cl.cpp index 6872665de..90232d90d 100644 --- a/code/ryzom/client/src/player_cl.cpp +++ b/code/ryzom/client/src/player_cl.cpp @@ -1292,33 +1292,33 @@ void CPlayerCL::load() // virtual } }// load // -//********************************************************************************************* +// ********************************************************************************************* const char *CPlayerCL::getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TSide side) const { if (!_PlayerSheet) return CCharacterCL::getBoneNameFromBodyPart(part, side); return _PlayerSheet->BodyToBone.getBoneName(part, side); } -//********************************************************************************************* +// ********************************************************************************************* const CItemSheet *CPlayerCL::getRightHandItemSheet() const { return _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet; } -//********************************************************************************************* +// ********************************************************************************************* const CItemSheet *CPlayerCL::getLeftHandItemSheet() const { return _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet; } -//********************************************************************************************* +// ********************************************************************************************* const CAttack *CPlayerCL::getAttack(const CAttackIDSheet &id) const { if (!_PlayerSheet) return NULL; return CCharacterCL::getAttack(id, _PlayerSheet->AttackLists); } -//********************************************************************************************* +// ********************************************************************************************* float CPlayerCL::getScaleRef() const { float fyrosRefScale = GabaritSet.getRefHeightScale(0, EGSPD::CPeople::Fyros); @@ -1327,7 +1327,7 @@ float CPlayerCL::getScaleRef() const } -//********************************************************************************************* +// ********************************************************************************************* float CPlayerCL::getNamePosZ() const { if (!_PlayerSheet) diff --git a/code/ryzom/client/src/player_r2_cl.cpp b/code/ryzom/client/src/player_r2_cl.cpp index 2cbfb6869..b858f8f94 100644 --- a/code/ryzom/client/src/player_r2_cl.cpp +++ b/code/ryzom/client/src/player_r2_cl.cpp @@ -1038,7 +1038,7 @@ void CPlayerR2CL::load() // virtual } }// load // -//********************************************************************************************* +// ********************************************************************************************* /* const char *CPlayerR2CL::getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TSide side) const { @@ -1046,26 +1046,26 @@ const char *CPlayerR2CL::getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TSi return _PlayerSheet->BodyToBone.getBoneName(part, side); }*/ -//********************************************************************************************* +// ********************************************************************************************* const CItemSheet *CPlayerR2CL::getRightHandItemSheet() const { return _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet; } -//********************************************************************************************* +// ********************************************************************************************* const CItemSheet *CPlayerR2CL::getLeftHandItemSheet() const { return _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet; } -//********************************************************************************************* +// ********************************************************************************************* /*const CAttack *CPlayerR2CL::getAttack(const CAttackIDSheet &id) const { if (!_PlayerSheet) return NULL; return CCharacterCL::getAttack(id, _PlayerSheet->AttackLists); }*/ -//********************************************************************************************* +// ********************************************************************************************* float CPlayerR2CL::getScaleRef() const { float fyrosRefScale = GabaritSet.getRefHeightScale(0, EGSPD::CPeople::Fyros); @@ -1074,7 +1074,7 @@ float CPlayerR2CL::getScaleRef() const } -//********************************************************************************************* +// ********************************************************************************************* /* float CPlayerR2CL::getNamePosZ() const { diff --git a/code/ryzom/client/src/precipitation_clip_grid.cpp b/code/ryzom/client/src/precipitation_clip_grid.cpp index e441d3424..03cba6ec5 100644 --- a/code/ryzom/client/src/precipitation_clip_grid.cpp +++ b/code/ryzom/client/src/precipitation_clip_grid.cpp @@ -46,7 +46,7 @@ extern UVisualCollisionManager *CollisionManager; /* -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::tileAdded(const CTileAddedInfo &infos) { // insert in point grid @@ -62,7 +62,7 @@ void CHeightGrid::tileAdded(const CTileAddedInfo &infos) addTri(corners, infos.Center.z); } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::tileRemoved(uint64 id) { CHashMap::iterator it = _TileInfos.find(id); @@ -79,7 +79,7 @@ void CHeightGrid::tileRemoved(uint64 id) removeTri(corners, infos.Center.z); } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::addTri(const CVector2f corners[3], float z) { _Tri.Vertices.resize(3); @@ -109,7 +109,7 @@ void CHeightGrid::addTri(const CVector2f corners[3], float z) } } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::removeTri(const CVector2f corners[3], float z) { _Tri.Vertices.resize(3); @@ -133,7 +133,7 @@ void CHeightGrid::removeTri(const CVector2f corners[3], float z) } } -//*********************************************************************************** +// *********************************************************************************** CHeightGrid::CHeightGrid() { _CellSize = 0.f; @@ -148,7 +148,7 @@ CHeightGrid::CHeightGrid() -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::init(float cellSize, uint heightGridSize, uint wrappedHeightGridSize, float minZ) { nlassert(cellSize > 0.f); @@ -164,14 +164,14 @@ void CHeightGrid::init(float cellSize, uint heightGridSize, uint wrappedHeightGr updateBBox(); } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::updateBBox() { _BBox.setMinMax(CVector(_PosX * _CellSize, _PosY * _CellSize, _MinZ), CVector((_PosX + _GridSize) * _CellSize, (_PosY + _GridSize) * _CellSize, -_MinZ)); } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::update(const CVector &newPos) { if (_CellSize == 0.f) return; @@ -200,7 +200,7 @@ void CHeightGrid::update(const CVector &newPos) } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::addCollisionMesh(const UVisualCollisionManager::CMeshInstanceColInfo &colMesh) { const std::vector &vertices = colMesh.Mesh.getVertices(); @@ -236,7 +236,7 @@ void CHeightGrid::addCollisionMesh(const UVisualCollisionManager::CMeshInstanceC _Meshs[colMesh.ID] = colMesh; } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::removeCollisionMesh(uint id) { TColMeshMap::iterator it = _Meshs.find(id); @@ -274,7 +274,7 @@ void CHeightGrid::removeCollisionMesh(uint id) } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::updateRect(const NLMISC::CRect &rect) { // add incoming meshs into the quad grid @@ -299,7 +299,7 @@ void CHeightGrid::updateRect(const NLMISC::CRect &rect) } } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::discardRect(const CRect &rect) { // remove meshs that are totally out of the grid @@ -315,7 +315,7 @@ void CHeightGrid::discardRect(const CRect &rect) } } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::updateCell(sint px, sint py) { sint worldX = px + _PosX; @@ -334,7 +334,7 @@ void CHeightGrid::updateCell(sint px, sint py) } -//*********************************************************************************** +// *********************************************************************************** void CHeightGrid::display(NL3D::UDriver &drv) const { extern UCamera MainCam; @@ -387,7 +387,7 @@ void CHeightGrid::display(NL3D::UDriver &drv) const // CPointGrid // //////////////// -//********************************************************************************* +// ********************************************************************************* CHeightGridWrapped::CHeightGridWrapped() { _CellSize = 0.f; @@ -395,7 +395,7 @@ CHeightGridWrapped::CHeightGridWrapped() _InvCellSize = 1.f; } -//********************************************************************************* +// ********************************************************************************* uint CHeightGridWrapped::getListMaxLength() const { uint sizeMax = 0; @@ -406,7 +406,7 @@ uint CHeightGridWrapped::getListMaxLength() const return sizeMax; } -//********************************************************************************* +// ********************************************************************************* void CHeightGridWrapped::init(uint size, float cellSize) { nlassert(cellSize > 0.f) diff --git a/code/ryzom/client/src/precipitation_clip_grid.h b/code/ryzom/client/src/precipitation_clip_grid.h index 30df2a311..7292f3ece 100644 --- a/code/ryzom/client/src/precipitation_clip_grid.h +++ b/code/ryzom/client/src/precipitation_clip_grid.h @@ -26,7 +26,7 @@ /* -//********************************************************************************* +// ********************************************************************************* template class CArray2D { public: @@ -130,7 +130,7 @@ private: }; -//********************************************************************************* +// ********************************************************************************* template void CArray2D::getUpdateRects(sint moveOffsetX, sint moveOffsetY, std::vector &rectsToUpdate) { @@ -189,14 +189,14 @@ void CArray2D::getUpdateRects(sint moveOffsetX, sint moveOffsetY, std::vector } } -//********************************************************************************* +// ********************************************************************************* template void CArray2D::getDiscardRects(sint moveOffsetX, sint moveOffsetY,std::vector &discardedRects) { getUpdateRects(- moveOffsetX, - moveOffsetY, discardedRects); } -//********************************************************************************* +// ********************************************************************************* template void CArray2D::moveSubArray(sint dstX, sint dstY, sint srcX, sint srcY, sint width, sint height) { @@ -337,14 +337,14 @@ void CArray2D::moveSubArray(sint dstX, sint dstY, sint srcX, sint srcY, sint } -//********************************************************************************* +// ********************************************************************************* template void CArray2D::move(sint offsetX, sint offsetY) { moveSubArray(offsetX, offsetY, 0, 0, _Width, _Height); } -//********************************************************************************* +// ********************************************************************************* template void CArray2D::init(uint width, uint height) { @@ -353,7 +353,7 @@ void CArray2D::init(uint width, uint height) _Height = height; } -//********************************************************************************* +// ********************************************************************************* template void CArray2D::init(uint width,uint height, const T &defaultValue) { @@ -363,7 +363,7 @@ void CArray2D::init(uint width,uint height, const T &defaultValue) } -//********************************************************************************* +// ********************************************************************************* // A height grid with wrapping class CHeightGridWrapped @@ -404,13 +404,13 @@ private: -//********************************************************************************* +// ********************************************************************************* inline void CHeightGridWrapped::insert(const CGridElem &ge) { _Grid(ge.X & _SizeMask, ge.Y & _SizeMask).push_back(ge); } -//********************************************************************************* +// ********************************************************************************* inline void CHeightGridWrapped::remove(const CGridElem &ge) { TGridElemList &gel = _Grid(ge.X & _SizeMask, ge.Y & _SizeMask); @@ -486,13 +486,13 @@ private: void addCollisionMesh(const UVisualCollisionManager::CMeshInstanceColInfo &colMesh); }; -//*********************************************************************************** +// *********************************************************************************** inline void CHeightGrid::gridCoordToWorld(sint x, sint y, CVector &dest) const { dest.set(x * _CellSize, y * _CellSize, 0.f); } -//*********************************************************************************** +// *********************************************************************************** inline CVector CHeightGrid::gridCoordToWorld(sint x, sint y) const { CVector dest; diff --git a/code/ryzom/client/src/projectile_manager.cpp b/code/ryzom/client/src/projectile_manager.cpp index 1964fb943..1bc44c3f5 100644 --- a/code/ryzom/client/src/projectile_manager.cpp +++ b/code/ryzom/client/src/projectile_manager.cpp @@ -57,7 +57,7 @@ static const float ImpactUserParams[MAGICFX::NUM_SPELL_POWER][4] = -//***************************************************************************************** +// ***************************************************************************************** CProjectileManager &CProjectileManager::getInstance() { H_AUTO_USE(RZ_ProjectileManager) @@ -65,7 +65,7 @@ CProjectileManager &CProjectileManager::getInstance() return manager; } -//***************************************************************************************** +// ***************************************************************************************** const float *CProjectileManager::getProjectileFXUserParams(uint power) { if (power < 1 || power > MAGICFX::NUM_SPELL_POWER) return NULL; @@ -73,14 +73,14 @@ const float *CProjectileManager::getProjectileFXUserParams(uint power) } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::addProjectileToQueue(const CProjectileBuild &pb) { H_AUTO_USE(RZ_ProjectileManager) _ProjectileQueue.insert(pb); } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::addProjectile(const CProjectileBuild &pb) { H_AUTO_USE(RZ_ProjectileManager) @@ -156,7 +156,7 @@ void CProjectileManager::addProjectile(const CProjectileBuild &pb) proj.ParabolaHeight = dist * 0.01f * BOMB_MISSILE_PARABOLA_HEIGHT_FOR_100_METERS; } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::updateProjectileQueue() { H_AUTO_USE(RZ_ProjectileManager) @@ -170,7 +170,7 @@ void CProjectileManager::updateProjectileQueue() } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::update() { H_AUTO_USE(RZ_ProjectileManager) @@ -411,7 +411,7 @@ void CProjectileManager::update() } } -//***************************************************************************************** +// ***************************************************************************************** CProjectileManager::CProjectile::CProjectile() { H_AUTO_USE(RZ_ProjectileManager) @@ -423,7 +423,7 @@ CProjectileManager::CProjectile::CProjectile() LocalizedImpact = false; } -//***************************************************************************************** +// ***************************************************************************************** CProjectileManager::CProjectile::~CProjectile() { H_AUTO_USE(RZ_ProjectileManager) @@ -440,7 +440,7 @@ CProjectileManager::CProjectile::~CProjectile() } } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::evalFXPosition(const CFXStickMode *stickMode, CEntityCL &entity, NLMISC::CVector &result, const NLMISC::CVector &additionnalOffset /* = NLMISC::CVector::Null*/) { H_AUTO_USE(RZ_ProjectileManager) @@ -497,7 +497,7 @@ void CProjectileManager::evalFXPosition(const CFXStickMode *stickMode, CEntityCL } } -//***************************************************************************************** +// ***************************************************************************************** sint CProjectileManager::CProjectile::getImpactBoneID(CEntityCL &target) { H_AUTO_USE(RZ_ProjectileManager) @@ -507,7 +507,7 @@ sint CProjectileManager::CProjectile::getImpactBoneID(CEntityCL &target) return TargetBoneID; } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::CProjectile::updateTargetPos() { H_AUTO_USE(RZ_ProjectileManager) @@ -601,7 +601,7 @@ void CProjectileManager::CProjectile::updateTargetPos() // else use value already present in impactPos } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::CProjectile::setMatrix(const NLMISC::CMatrix &pos) { H_AUTO_USE(RZ_ProjectileManager) @@ -631,7 +631,7 @@ static void convertFreeFXToAttachedFX(NL3D::UParticleSystemInstance instance, holder.attachFX(af); } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::CProjectile::shutDown(CCharacterCL *target) { H_AUTO_USE(RZ_ProjectileManager) @@ -677,7 +677,7 @@ void CProjectileManager::CProjectile::shutDown(CCharacterCL *target) } } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::reset() { H_AUTO_USE(RZ_ProjectileManager) @@ -686,7 +686,7 @@ void CProjectileManager::reset() _ToShutDownProjectiles.clear(); } -//***************************************************************************************** +// ***************************************************************************************** void CProjectileManager::entityRemoved(uint slot) { // TODO nico : adding anchor objects (that can be "CRefPtr'ed" ...) to define rays / projectile paths would be a more elegant solution now (and a CAnchorRef object to dlte anchor automatically) @@ -729,7 +729,7 @@ void CProjectileManager::entityRemoved(uint slot) } } -//***************************************************************************************** +// ***************************************************************************************** const CAnimationFX *CProjectileManager::getResistFX(uint level) { H_AUTO_USE(RZ_ProjectileManager) diff --git a/code/ryzom/client/src/property_decoder.h b/code/ryzom/client/src/property_decoder.h index 076be0966..0dd3fa413 100644 --- a/code/ryzom/client/src/property_decoder.h +++ b/code/ryzom/client/src/property_decoder.h @@ -53,7 +53,7 @@ private: class CEntityEntry { public: - CEntityEntry() : EntryUsed(false), PosIsRelative(false), AssociationBits(0) {} + CEntityEntry() : AssociationBits(0), EntryUsed(false), PosIsRelative(false), PosIsInterior(false) {} CLFECOMMON::TSheetId Sheet; uint16 AssociationBits; bool EntryUsed; diff --git a/code/ryzom/client/src/r2/auto_group.cpp b/code/ryzom/client/src/r2/auto_group.cpp index 8bd71eb55..c792b8347 100644 --- a/code/ryzom/client/src/r2/auto_group.cpp +++ b/code/ryzom/client/src/r2/auto_group.cpp @@ -28,7 +28,7 @@ namespace R2 { -//*************************************************************** +// *************************************************************** CAutoGroup::CAutoGroup() { CPrimLook primGroup; @@ -37,13 +37,13 @@ CAutoGroup::CAutoGroup() _AutoGroupEnabled = false; } -//*************************************************************** +// *************************************************************** CAutoGroup::~CAutoGroup() { clear(); } -//*************************************************************** +// *************************************************************** void CAutoGroup::clear() { //H_AUTO(R2_CAutoGroup__clear) @@ -58,7 +58,7 @@ void CAutoGroup::clear() _AutoGroup.clear(); } -//*************************************************************** +// *************************************************************** void CAutoGroup::update(const CVector &testPos, const std::string &paletteEntry, bool valid) { //H_AUTO(R2_CAutoGroup_update) @@ -92,7 +92,7 @@ void CAutoGroup::update(const CVector &testPos, const std::string &paletteEntry, } } -//*************************************************************** +// *************************************************************** CInstance *CAutoGroup::getGroupingCandidate() { //H_AUTO(R2_CAutoGroup_getGroupingCandidate) @@ -229,7 +229,7 @@ CInstance *CAutoGroup::getGroupingCandidate() } -//*************************************************************** +// *************************************************************** void CAutoGroup::group(CObject *newEntityDesc, const NLMISC::CVectorD &createPosition) { //H_AUTO(R2_CAutoGroup_group) diff --git a/code/ryzom/client/src/r2/displayer_base.cpp b/code/ryzom/client/src/r2/displayer_base.cpp index 3598ec816..a149972de 100644 --- a/code/ryzom/client/src/r2/displayer_base.cpp +++ b/code/ryzom/client/src/r2/displayer_base.cpp @@ -28,7 +28,7 @@ namespace R2 uint CDisplayerBase::ObjCount = 0; -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerBase::CDisplayerBase() : _DisplayedInstance(NULL) { ++ ObjCount; @@ -42,14 +42,14 @@ CDisplayerBase::~CDisplayerBase() -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerBase::pushLuaAccess(CLuaState &ls) { //H_AUTO(R2_CDisplayerBase_pushLuaAccess) CLuaIHM::pushReflectableOnStack(ls, this); } -//********************************************************************************************************* +// ********************************************************************************************************* const CObjectTable &CDisplayerBase::getProps() const { //H_AUTO(R2_CDisplayerBase_getProps) @@ -64,7 +64,7 @@ const CObjectTable &CDisplayerBase::getProps() const return *props; } -//********************************************************************************************************* +// ********************************************************************************************************* CLuaObject &CDisplayerBase::getLuaProjection() { //H_AUTO(R2_CDisplayerBase_getLuaProjection) diff --git a/code/ryzom/client/src/r2/displayer_lua.cpp b/code/ryzom/client/src/r2/displayer_lua.cpp index d07d32e76..a2df79851 100644 --- a/code/ryzom/client/src/r2/displayer_lua.cpp +++ b/code/ryzom/client/src/r2/displayer_lua.cpp @@ -22,7 +22,7 @@ namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* bool CDisplayerLua::init(const CLuaObject ¶meters) { //H_AUTO(R2_CDisplayerLua_init) @@ -52,13 +52,13 @@ bool CDisplayerLua::init(const CLuaObject ¶meters) return CDisplayerBase::init(parameters); } -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerLua &CDisplayerLua::CToLua::getEnclosing() { return *(CDisplayerLua *) ((uint8 *) this - offsetof(CDisplayerLua, _ToLua)); // ugly, yes ... } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::CToLua::executeHandler(const CLuaString &eventName, int numArgs) { CLuaState &ls = *getLua(); @@ -87,7 +87,7 @@ void CDisplayerLua::CToLua::executeHandler(const CLuaString &eventName, int numA } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::CToLua::pushLuaAccess(CLuaState &ls) { if (_LuaTable.isValid()) @@ -102,14 +102,14 @@ void CDisplayerLua::CToLua::pushLuaAccess(CLuaState &ls) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::pushLuaAccess(CLuaState &ls) { //H_AUTO(R2_CDisplayerLua_pushLuaAccess) _ToLua.pushLuaAccess(ls); } -//********************************************************************************************************* +// ********************************************************************************************************* CLuaState *CDisplayerLua::CToLua::getLua() { if (!_LuaTable.isValid()) @@ -120,112 +120,112 @@ CLuaState *CDisplayerLua::CToLua::getLua() return _LuaTable.getLuaState(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onActChanged() { //H_AUTO(R2_CDisplayerLua_onActChanged) _ToLua.onActChanged(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onContinentChanged() { //H_AUTO(R2_CDisplayerLua_onContinentChanged) _ToLua.onContinentChanged(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onPostCreate() { //H_AUTO(R2_CDisplayerLua_onPostCreate) _ToLua.onPostCreate(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onCreate() { //H_AUTO(R2_CDisplayerLua_onCreate) _ToLua.onCreate(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onErase() { //H_AUTO(R2_CDisplayerLua_onErase) _ToLua.onErase(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onPreHrcMove() { //H_AUTO(R2_CDisplayerLua_onPreHrcMove) _ToLua.onPreHrcMove(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onPostHrcMove() { //H_AUTO(R2_CDisplayerLua_onPostHrcMove) _ToLua.onPostHrcMove(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onFocus(bool focused) { //H_AUTO(R2_CDisplayerLua_onFocus) _ToLua.onFocus(focused); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onSelect(bool selected) { //H_AUTO(R2_CDisplayerLua_onSelect) _ToLua.onSelect(selected); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onAttrModified(const std::string &attrName,sint32 index) { //H_AUTO(R2_CDisplayerLua_onAttrModified) _ToLua.onAttrModified(attrName, index); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onTargetInstanceCreated(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CDisplayerLua_onTargetInstanceCreated) _ToLua.onTargetInstanceCreated(refMakerAttr, refMakerAttrIndex); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onTargetInstanceErased(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CDisplayerLua_onTargetInstanceErased) _ToLua.onTargetInstanceErased(refMakerAttr, refMakerAttrIndex); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onTargetInstanceEraseRequested(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CDisplayerLua_onTargetInstanceEraseRequested) _ToLua.onTargetInstanceEraseRequested(refMakerAttr, refMakerAttrIndex); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onTargetInstanceAttrModified(const std::string &refMakerAttr,sint32 refMakerAttrIndex,const std::string &targetAttrName,sint32 targetAttrIndex) { //H_AUTO(R2_CDisplayerLua_onTargetInstanceAttrModified) _ToLua.onTargetInstanceAttrModified(refMakerAttr, refMakerAttrIndex, targetAttrName, targetAttrIndex); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onTargetInstancePreHrcMove(const std::string &refMakerAttr,sint32 refMakerAttrIndex) { //H_AUTO(R2_CDisplayerLua_onTargetInstancePreHrcMove) _ToLua.onTargetInstancePreHrcMove(refMakerAttr, refMakerAttrIndex); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerLua::onTargetInstancePostHrcMove(const std::string &refMakerAttr,sint32 refMakerAttrIndex) { //H_AUTO(R2_CDisplayerLua_onTargetInstancePostHrcMove) diff --git a/code/ryzom/client/src/r2/displayer_visual.h b/code/ryzom/client/src/r2/displayer_visual.h index d459ba630..905960abe 100644 --- a/code/ryzom/client/src/r2/displayer_visual.h +++ b/code/ryzom/client/src/r2/displayer_visual.h @@ -32,7 +32,7 @@ class CGroupInScene; namespace R2 { -//*********************************************************************************************************************** +// *********************************************************************************************************************** // Interface for object selection in the scene struct ISelectableObject { @@ -51,7 +51,7 @@ struct ISelectableObject virtual CInstance *getInstanceInEditor() const = 0; }; -//*********************************************************************************************************************** +// *********************************************************************************************************************** // Decoration in a CGroupMap that expose this interface (through dynamic_cast) are representation of CInstance in the island map struct IDisplayerUIHandle { @@ -66,7 +66,7 @@ struct IDisplayerUIHandle }; -//*********************************************************************************************************************** +// *********************************************************************************************************************** // Displays an object of the editor in the 3D scene / in the worldmap class CDisplayerVisual : public CDisplayerBase, public ISelectableObject { diff --git a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp index 959ff13a8..fc69f487a 100644 --- a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp @@ -29,7 +29,7 @@ using namespace NLMISC; namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisualActivitySequence::CDisplayerVisualActivitySequence() { _Touched = true; @@ -38,14 +38,14 @@ CDisplayerVisualActivitySequence::CDisplayerVisualActivitySequence() _DecalColor = CRGBA(0, 0, 0, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisualActivitySequence::~CDisplayerVisualActivitySequence() { clear(); _WPCache.clear(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::clear(bool wantRemoveFromWorldMap) { //H_AUTO(R2_CDisplayerVisualActivitySequence_clear) @@ -64,7 +64,7 @@ void CDisplayerVisualActivitySequence::clear(bool wantRemoveFromWorldMap) _TraversedPrimInfos.clear(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::onAttrModified(const std::string &attrName,sint32 /* attrIndex */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onAttrModified) @@ -74,14 +74,14 @@ void CDisplayerVisualActivitySequence::onAttrModified(const std::string &attrNam } } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::touch() { //H_AUTO(R2_CDisplayerVisualActivitySequence_touch) _Touched = true; } -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisual *CDisplayerVisualActivitySequence::getParentDV() const { //H_AUTO(R2_CDisplayerVisualActivitySequence_getParentDV) @@ -96,7 +96,7 @@ CDisplayerVisual *CDisplayerVisualActivitySequence::getParentDV() const return prevDV; } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::update() { //H_AUTO(R2_CDisplayerVisualActivitySequence_update) @@ -242,7 +242,7 @@ void CDisplayerVisualActivitySequence::update() } } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::addFootSteps(const NLMISC::CLine &line) { //H_AUTO(R2_CDisplayerVisualActivitySequence_addFootSteps) @@ -262,7 +262,7 @@ void CDisplayerVisualActivitySequence::addFootSteps(const NLMISC::CLine &line) _FootSteps.push_back(line); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::addWanderSteps(const CVector &pos) { //H_AUTO(R2_CDisplayerVisualActivitySequence_addWanderSteps) @@ -280,7 +280,7 @@ static void updateState(TSequenceState &state, CDisplayerVisual *dv) } -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisual *CDisplayerVisualActivitySequence::getPossibleGroupDV(CDisplayerVisual *entityDV) { //H_AUTO(R2_CDisplayerVisualActivitySequence_getPossibleGroupDV) @@ -298,7 +298,7 @@ CDisplayerVisual *CDisplayerVisualActivitySequence::getPossibleGroupDV(CDisplaye return entityDV; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CDisplayerVisualActivitySequence::isVisible(CDisplayerVisual *groupDV, CDisplayerVisual *entityDV) { //H_AUTO(R2_CDisplayerVisualActivitySequence_isVisible) @@ -321,7 +321,7 @@ bool CDisplayerVisualActivitySequence::isVisible(CDisplayerVisual *groupDV, CDis return true; } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::removeFromWorldMap() { //H_AUTO(R2_CDisplayerVisualActivitySequence_removeFromWorldMap) @@ -335,7 +335,7 @@ void CDisplayerVisualActivitySequence::removeFromWorldMap() } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::onPostRender() { //H_AUTO(R2_CDisplayerVisualActivitySequence_onPostRender) @@ -435,7 +435,7 @@ void CDisplayerVisualActivitySequence::onPostRender() } } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::onPreRender() { //H_AUTO(R2_CDisplayerVisualActivitySequence_onPreRender) @@ -475,7 +475,7 @@ void CDisplayerVisualActivitySequence::onPreRender() } } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::updateWorldPos() { //H_AUTO(R2_CDisplayerVisualActivitySequence_updateWorldPos) @@ -483,28 +483,28 @@ void CDisplayerVisualActivitySequence::updateWorldPos() } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::onInstanceCreated(CInstance &/* instance */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onInstanceCreated) touch(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::onInstanceErased(CInstance &/* instance */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onInstanceErased) touch(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::onAttrModified(CInstance &/* instance */,const std::string &/* attrName */,sint32 /* attrIndex */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onAttrModified) touch(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualActivitySequence::setActive(bool active) { //H_AUTO(R2_CDisplayerVisualActivitySequence_setActive) @@ -520,7 +520,7 @@ void CDisplayerVisualActivitySequence::setActive(bool active) _Active = active; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CDisplayerVisualActivitySequence::getActive() const { //H_AUTO(R2_CDisplayerVisualActivitySequence_getActive) @@ -528,7 +528,7 @@ bool CDisplayerVisualActivitySequence::getActive() const } -//********************************************************* +// ********************************************************* void CDisplayerVisualActivitySequence::setWorldMapNumEdges(uint count) { //H_AUTO(R2_CDisplayerVisualActivitySequence_setWorldMapNumEdges) @@ -564,7 +564,7 @@ void CDisplayerVisualActivitySequence::setWorldMapNumEdges(uint count) } } -//********************************************************* +// ********************************************************* void CDisplayerVisualActivitySequence::onAdd(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onAdd) @@ -574,7 +574,7 @@ void CDisplayerVisualActivitySequence::onAdd(CGroupMap &/* owner */) setWorldMapNumEdges((uint)_FootSteps.size()); } -//********************************************************* +// ********************************************************* void CDisplayerVisualActivitySequence::onRemove(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onRemove) @@ -583,14 +583,14 @@ void CDisplayerVisualActivitySequence::onRemove(CGroupMap &/* owner */) _AddedToWorldMap = false; } -//********************************************************* +// ********************************************************* void CDisplayerVisualActivitySequence::onPreRender(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onPreRender) } -//********************************************************* +// ********************************************************* void CDisplayerVisualActivitySequence::onUpdate(CGroupMap &owner) { //H_AUTO(R2_CDisplayerVisualActivitySequence_onUpdate) @@ -615,7 +615,7 @@ void CDisplayerVisualActivitySequence::onUpdate(CGroupMap &owner) } } -//********************************************************* +// ********************************************************* void CDisplayerVisualActivitySequence::setWorldMapColor(CRGBA color) { //H_AUTO(R2_CDisplayerVisualActivitySequence_setWorldMapColor) diff --git a/code/ryzom/client/src/r2/displayer_visual_road.cpp b/code/ryzom/client/src/r2/displayer_visual_road.cpp index 8661e67fd..2e580416c 100644 --- a/code/ryzom/client/src/r2/displayer_visual_road.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_road.cpp @@ -30,7 +30,7 @@ namespace R2 { /* -//********************************************************************************************************* +// ********************************************************************************************************* CPrimRender2::CPrimRender2() { _VertexMeshs.setShapeName("road_flag.shape"); @@ -38,19 +38,19 @@ CPrimRender2::CPrimRender2() _VertexScale = 1.f; } -//********************************************************************************************************* +// ********************************************************************************************************* void CPrimRender2::setVertexShapeName(const std::string &name) { _VertexMeshs.setShapeName(name); } -//********************************************************************************************************* +// ********************************************************************************************************* void CPrimRender2::setEdgeShapeName(const std::string &name) { _EdgeMeshs.setShapeName(name); } -//********************************************************************************************************* +// ********************************************************************************************************* void CPrimRender2::setPoints(const std::vector &wp, bool lastIsValid, bool closed) { uint iclosed = closed ? 1 : 0; @@ -94,7 +94,7 @@ void CPrimRender2::setPoints(const std::vector &wp, bool lastIs } } -//********************************************************************************************************* +// ********************************************************************************************************* void CPrimRender2::setEmissive(NLMISC::CRGBA color) { _VertexMeshs.setEmissive(color); @@ -104,13 +104,13 @@ void CPrimRender2::setEmissive(NLMISC::CRGBA color) /* -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisualRoad::~CDisplayerVisualRoad() { } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualRoad::onCreate() { rebuild(); @@ -118,7 +118,7 @@ void CDisplayerVisualRoad::onCreate() } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualRoad::rebuild() { const CObject *points = getObject(&getProps(), "Points"); diff --git a/code/ryzom/client/src/r2/displayer_visual_shape.cpp b/code/ryzom/client/src/r2/displayer_visual_shape.cpp index b867d44b3..5902ea103 100644 --- a/code/ryzom/client/src/r2/displayer_visual_shape.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_shape.cpp @@ -41,7 +41,7 @@ extern uint SkipFrame; namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisualShape::CDisplayerVisualShape(const std::string &shapeName, float scale, bool worldMapDisplay) { _ShapeName = shapeName; @@ -54,14 +54,14 @@ CDisplayerVisualShape::CDisplayerVisualShape(const std::string &shapeName, float _WorldMapDisplay = worldMapDisplay; } -//********************************************************************************************************* +// ********************************************************************************************************* CDisplayerVisualShape::~CDisplayerVisualShape() { deleteShape(); deleteVisualCollisionEntity(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::deleteVisualCollisionEntity() { //H_AUTO(R2_CDisplayerVisualShape_deleteVisualCollisionEntity) @@ -75,7 +75,7 @@ void CDisplayerVisualShape::deleteVisualCollisionEntity() } } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::deleteShape() { //H_AUTO(R2_CDisplayerVisualShape_deleteShape) @@ -93,7 +93,7 @@ void CDisplayerVisualShape::deleteShape() } } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onPreRender() { //H_AUTO(R2_CDisplayerVisualShape_onPreRender) @@ -191,7 +191,7 @@ void CDisplayerVisualShape::onPreRender() _Touched = false; } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::drawBBox(NLMISC::CRGBA color) const { //H_AUTO(R2_CDisplayerVisualShape_drawBBox) @@ -202,7 +202,7 @@ void CDisplayerVisualShape::drawBBox(NLMISC::CRGBA color) const ::drawBox(bbox.getMin(), bbox.getMax(), color); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onPostRender() { //H_AUTO(R2_CDisplayerVisualShape_onPostRender) @@ -232,7 +232,7 @@ void CDisplayerVisualShape::onPostRender() CDisplayerVisual::onPostRender(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onAttrModified(const std::string &name, sint32 index) { //H_AUTO(R2_CDisplayerVisualShape_onAttrModified) @@ -248,7 +248,7 @@ void CDisplayerVisualShape::onAttrModified(const std::string &name, sint32 in }*/ } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::setDisplayMode(sint32 mode) { //H_AUTO(R2_CDisplayerVisualShape_setDisplayMode) @@ -257,14 +257,14 @@ void CDisplayerVisualShape::setDisplayMode(sint32 mode) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onParentDisplayModeChanged() { //H_AUTO(R2_CDisplayerVisualShape_onParentDisplayModeChanged) updateMapDeco(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onFocus(bool focused) { //H_AUTO(R2_CDisplayerVisualShape_onFocus) @@ -272,7 +272,7 @@ void CDisplayerVisualShape::onFocus(bool focused) updateMapDeco(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onSelect(bool selected) { //H_AUTO(R2_CDisplayerVisualShape_onSelect) @@ -281,7 +281,7 @@ void CDisplayerVisualShape::onSelect(bool selected) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::setActive(bool active) { //H_AUTO(R2_CDisplayerVisualShape_setActive) @@ -307,7 +307,7 @@ void CDisplayerVisualShape::setActive(bool active) _Active = active; } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::updateMapDeco() { //H_AUTO(R2_CDisplayerVisualShape_updateMapDeco) @@ -322,14 +322,14 @@ void CDisplayerVisualShape::updateMapDeco() } } -//********************************************************************************************************* +// ********************************************************************************************************* bool CDisplayerVisualShape::getActive() const { //H_AUTO(R2_CDisplayerVisualShape_getActive) return _Active; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CDisplayerVisualShape::init(const CLuaObject ¶meters) { //H_AUTO(R2_CDisplayerVisualSh_initSape) @@ -346,7 +346,7 @@ bool CDisplayerVisualShape::init(const CLuaObject ¶meters) return CDisplayerVisual::init(parameters); } -//********************************************************************************************************* +// ********************************************************************************************************* bool CDisplayerVisualShape::getLastClip() const { //H_AUTO(R2_CDisplayerVisualShape_getLastClip) @@ -354,7 +354,7 @@ bool CDisplayerVisualShape::getLastClip() const return !_Instance.getLastClippedState(); } -//********************************************************************************************************* +// ********************************************************************************************************* NLMISC::CAABBox CDisplayerVisualShape::getSelectBox() const { //H_AUTO(R2_CDisplayerVisualShape_getSelectBox) @@ -366,7 +366,7 @@ NLMISC::CAABBox CDisplayerVisualShape::getSelectBox() const return bbox; } -//********************************************************************************************************* +// ********************************************************************************************************* float CDisplayerVisualShape::preciseIntersectionTest(const NLMISC::CVector &worldRayStart,const NLMISC::CVector &worldRayDir) const { //H_AUTO(R2_CDisplayerVisualShape_preciseIntersectionTest) @@ -385,7 +385,7 @@ float CDisplayerVisualShape::preciseIntersectionTest(const NLMISC::CVector &worl return FLT_MAX; } -//********************************************************************************************************* +// ********************************************************************************************************* const NLMISC::CMatrix &CDisplayerVisualShape::getInvertedMatrix() const { //H_AUTO(R2_CDisplayerVisualShape_getInvertedMatrix) @@ -394,7 +394,7 @@ const NLMISC::CMatrix &CDisplayerVisualShape::getInvertedMatrix() const return _InvertedMatrix; } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::updateWorldPos() { //H_AUTO(R2_CDisplayerVisualShape_updateWorldPos) @@ -407,7 +407,7 @@ void CDisplayerVisualShape::updateWorldPos() } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::snapToGround() { //H_AUTO(R2_CDisplayerVisualShape_snapToGround) @@ -432,7 +432,7 @@ void CDisplayerVisualShape::snapToGround() _Touched = true; } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::visualSnapToGround() { //H_AUTO(R2_CDisplayerVisualShape_visualSnapToGround) @@ -478,7 +478,7 @@ void CDisplayerVisualShape::visualSnapToGround() } } -//********************************************************************************************************* +// ********************************************************************************************************* NLMISC::CVector CDisplayerVisualShape::evalLinkPoint(bool /* leader */) { //H_AUTO(R2_CDisplayerVisualShape_evalLinkPoint) @@ -493,27 +493,27 @@ NLMISC::CVector CDisplayerVisualShape::evalLinkPoint(bool /* leader */) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onAdd(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualShape_onAdd) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onRemove(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualShape_onRemove) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onPreRender(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualShape_onPreRender) } -//********************************************************************************************************* +// ********************************************************************************************************* void CDisplayerVisualShape::onUpdate(CGroupMap &/* owner */) { //H_AUTO(R2_CDisplayerVisualShape_onUpdate) diff --git a/code/ryzom/client/src/r2/entity_custom_select_box.cpp b/code/ryzom/client/src/r2/entity_custom_select_box.cpp index 6e472a898..ea2bd21f8 100644 --- a/code/ryzom/client/src/r2/entity_custom_select_box.cpp +++ b/code/ryzom/client/src/r2/entity_custom_select_box.cpp @@ -26,7 +26,7 @@ using namespace NLMISC; namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* void CEntityCustomSelectBox::toTable(CLuaObject &table) { //H_AUTO(R2_CEntityCustomSelectBox_toTable) @@ -48,7 +48,7 @@ void CEntityCustomSelectBox::toTable(CLuaObject &table) } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntityCustomSelectBox::fromTable(CLuaObject &table) { //H_AUTO(R2_CEntityCustomSelectBox_fromTable) diff --git a/code/ryzom/client/src/r2/entity_sorter.cpp b/code/ryzom/client/src/r2/entity_sorter.cpp index e30387ce8..21d9937fe 100644 --- a/code/ryzom/client/src/r2/entity_sorter.cpp +++ b/code/ryzom/client/src/r2/entity_sorter.cpp @@ -30,12 +30,12 @@ namespace R2 #define CHECK_INTEGRITY #endif -//********************************************************************************************************* +// ********************************************************************************************************* CEntitySorter::CEntitySorter() { } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::registerEntityDisplayer(CDisplayerVisualEntity *dve) { nlassert(dve); @@ -49,7 +49,7 @@ void CEntitySorter::registerEntityDisplayer(CDisplayerVisualEntity *dve) CHECK_INTEGRITY } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::unregisterEntityDisplayer(CDisplayerVisualEntity *dve) { nlassert(dve); @@ -67,14 +67,14 @@ void CEntitySorter::unregisterEntityDisplayer(CDisplayerVisualEntity *dve) CHECK_INTEGRITY } -//********************************************************************************************************* +// ********************************************************************************************************* uint CEntitySorter::getMaxEntityCount() const { static volatile uint MAX_NUM_VISIBLE_ENTITIES = 253; return MAX_NUM_VISIBLE_ENTITIES; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CEntitySorter::isWithinDisplayRange(CDisplayerVisualEntity *displayer) const { if (!displayer) return false; @@ -82,7 +82,7 @@ bool CEntitySorter::isWithinDisplayRange(CDisplayerVisualEntity *displayer) cons return CSortedEntity(displayer, (UserEntity->pos() - displayer->getWorldPos()).sqrnorm()) < _FarthestEntity; } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::sortByEntitiesByDistance() { CHECK_INTEGRITY @@ -101,7 +101,7 @@ void CEntitySorter::sortByEntitiesByDistance() } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::updateFadeInOut() { CHECK_INTEGRITY @@ -148,7 +148,7 @@ void CEntitySorter::updateFadeInOut() CHECK_INTEGRITY } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::eraseVisibleListEntry(sint index) { if (index == -1) return; @@ -167,7 +167,7 @@ void CEntitySorter::eraseVisibleListEntry(sint index) _VisibleList.pop_back(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::updateVisibleList() { CHECK_INTEGRITY @@ -229,7 +229,7 @@ void CEntitySorter::updateVisibleList() CHECK_INTEGRITY } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::clipEntitiesByDist() { CHECK_INTEGRITY @@ -250,7 +250,7 @@ void CEntitySorter::clipEntitiesByDist() CHECK_INTEGRITY } -//********************************************************************************************************* +// ********************************************************************************************************* void CEntitySorter::checkIntegrity() { #ifdef NL_DEBUG diff --git a/code/ryzom/client/src/r2/instance.h b/code/ryzom/client/src/r2/instance.h index 6c37aca11..d10c37532 100644 --- a/code/ryzom/client/src/r2/instance.h +++ b/code/ryzom/client/src/r2/instance.h @@ -241,7 +241,7 @@ private: // For editor : Create this object from the CObjectTable it materialize in the editor CInstance(const CObjectTable *objectTable, CLuaState &ls); // copy not supported - CInstance(const CInstance &/* other */) { nlassert(0); } + CInstance(const CInstance &/* other */):NLMISC::CRefCount() { nlassert(0); } CInstance &operator = (const CInstance &/* other */) { nlassert(0); return *this; } // void executeHandler(const CLuaString &name, int numArgs); diff --git a/code/ryzom/client/src/r2/instance_map_deco.cpp b/code/ryzom/client/src/r2/instance_map_deco.cpp index ea9b426f8..aec958373 100644 --- a/code/ryzom/client/src/r2/instance_map_deco.cpp +++ b/code/ryzom/client/src/r2/instance_map_deco.cpp @@ -30,7 +30,7 @@ namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::CCtrlButtonEntity::getContextHelp(ucstring &help) const { //H_AUTO(R2_CCtrlButtonEntity_getContextHelp) @@ -38,14 +38,14 @@ void CInstanceMapDeco::CCtrlButtonEntity::getContextHelp(ucstring &help) const if (help == NLMISC::CI18N::get("uiR2EDNoName")) help.clear(); } -//********************************************************************************************************* +// ********************************************************************************************************* bool CInstanceMapDeco::CCtrlButtonEntity::handleEvent(const CEventDescriptor &/* event */) { //H_AUTO(R2_CCtrlButtonEntity_handleEvent) return false; // just a display with tooltip capability } -//********************************************************************************************************* +// ********************************************************************************************************* CInstanceMapDeco::CInstanceMapDeco() { //H_AUTO(R2_CInstanceMapDeco_CInstanceMapDeco) @@ -64,7 +64,7 @@ CInstanceMapDeco::CInstanceMapDeco() _InvalidPos = false; } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::setDisplayedInstance(CInstance *instance, bool orientable) { //H_AUTO(R2_CInstanceMapDeco_setDisplayedInstance) @@ -74,7 +74,7 @@ void CInstanceMapDeco::setDisplayedInstance(CInstance *instance, bool orientable _Orientable = orientable; } -//********************************************************************************************************* +// ********************************************************************************************************* CVector2f CInstanceMapDeco::getWorldPos() const { //H_AUTO(R2_CInstanceMapDeco_getWorldPos) @@ -84,7 +84,7 @@ CVector2f CInstanceMapDeco::getWorldPos() const return vd->getWorldPos2f(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::invalidateCoords() { //H_AUTO(R2_CInstanceMapDeco_invalidateCoords) @@ -103,7 +103,7 @@ void CInstanceMapDeco::invalidateCoords() if (_Orient) _Orient->invalidateCoords(); } -//********************************************************************************************************* +// ********************************************************************************************************* CCtrlQuad *CInstanceMapDeco::newQuad(CGroupMap &owner) { //H_AUTO(R2_CInstanceMapDeco_newQuad) @@ -117,7 +117,7 @@ CCtrlQuad *CInstanceMapDeco::newQuad(CGroupMap &owner) } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::onAdd(CGroupMap &owner) { //H_AUTO(R2_CInstanceMapDeco_onAdd) @@ -168,7 +168,7 @@ void CInstanceMapDeco::onAdd(CGroupMap &owner) _AddedToMap = true; } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::onRemove(CGroupMap &owner) { //H_AUTO(R2_CInstanceMapDeco_onRemove) @@ -199,7 +199,7 @@ void CInstanceMapDeco::onRemove(CGroupMap &owner) } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::onPreRender(CGroupMap &groupMap) { //H_AUTO(R2_CInstanceMapDeco_onPreRender) @@ -268,7 +268,7 @@ void CInstanceMapDeco::onPreRender(CGroupMap &groupMap) } } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::onUpdate(CGroupMap &groupMap) { //H_AUTO(R2_CInstanceMapDeco_onUpdate) @@ -444,7 +444,7 @@ void CInstanceMapDeco::onUpdate(CGroupMap &groupMap) } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::setTextureAndFit(const std::string &bitmapName) { //H_AUTO(R2_CInstanceMapDeco_setTextureAndFit) @@ -463,7 +463,7 @@ void CInstanceMapDeco::setTextureAndFit(const std::string &bitmapName) } } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::setActive(bool active) { //H_AUTO(R2_CInstanceMapDeco_setActive) @@ -476,7 +476,7 @@ void CInstanceMapDeco::setActive(bool active) _Active = active; } -//********************************************************************************************************* +// ********************************************************************************************************* void CInstanceMapDeco::setInvalidPosFlag(bool invalid) { //H_AUTO(R2_CInstanceMapDeco_setInvalidPosFlag) diff --git a/code/ryzom/client/src/r2/island_collision.cpp b/code/ryzom/client/src/r2/island_collision.cpp index 45a45f306..eecddb642 100644 --- a/code/ryzom/client/src/r2/island_collision.cpp +++ b/code/ryzom/client/src/r2/island_collision.cpp @@ -107,25 +107,25 @@ private: }; -//********************************************************************************************************* +// ********************************************************************************************************* CAccessibilityTexture::CAccessibilityTexture() : _IslandCol(NULL) { nlassert(0); } -//********************************************************************************************************* +// ********************************************************************************************************* CAccessibilityTexture::CAccessibilityTexture(CIslandCollision *islandCol) : _IslandCol(islandCol) { // nlwarning new accessiblity texture created } -//********************************************************************************************************* +// ********************************************************************************************************* CAccessibilityTexture::~CAccessibilityTexture() { nlwarning("Accessibility texture removed"); } -//********************************************************************************************************* +// ********************************************************************************************************* CIslandCollision::CIslandCollision() { _LastPackedIslandTestPos.set(0.f, 0.f); @@ -135,7 +135,7 @@ CIslandCollision::CIslandCollision() _AccessibilityTexture = NULL; } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::releaseAccessibilityTexture() { //H_AUTO(R2_CIslandCollision_releaseAccessibilityTexture) @@ -145,7 +145,7 @@ void CIslandCollision::releaseAccessibilityTexture() vr.setExternalTexture(_AccessibilityTextureId, NULL, 0, 0, 0, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::release() { //H_AUTO(R2_CIslandCollision_release) @@ -155,13 +155,13 @@ void CIslandCollision::release() } -//********************************************************************************************************* +// ********************************************************************************************************* CIslandCollision::~CIslandCollision() { release(); } -//********************************************************************************************************* +// ********************************************************************************************************* CRefCountedPackedWorld *CIslandCollision::getPackedIsland() { //H_AUTO(R2_CIslandCollision_getPackedIsland) @@ -179,7 +179,7 @@ inline sint clamped(sint value, sint size) clamp(value, 0, size - 1); return value; } -//********************************************************************************************************* +// ********************************************************************************************************* R2::CScenarioEntryPoints::CCompleteIsland *CIslandCollision::getCurrIslandDesc() { //H_AUTO(R2_CIslandCollision_getCurrIslandDesc) @@ -239,7 +239,7 @@ R2::CScenarioEntryPoints::CCompleteIsland *CIslandCollision::getCurrIslandDesc() return &_IslandDesc; } -//********************************************************************************************************* +// ********************************************************************************************************* const NLMISC::CArray2D &CIslandCollision::getHeightMap() { //H_AUTO(R2_CIslandCollision_getHeightMap) @@ -248,7 +248,7 @@ const NLMISC::CArray2D &CIslandCollision::getHeightMap() return _HeightMap; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CIslandCollision::findEmptyPlace(const CVector2f &startPos, NLMISC::CVector &dest) { //H_AUTO(R2_CIslandCollision_findEmptyPlace) @@ -373,7 +373,7 @@ bool CIslandCollision::findEmptyPlace(const CVector2f &startPos, NLMISC::CVector return false; } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::updateCurrPackedIsland() { //H_AUTO(R2_CIslandCollision_updateCurrPackedIsland) @@ -400,7 +400,7 @@ void CIslandCollision::updateCurrPackedIsland() } } -//********************************************************************************************************* +// ********************************************************************************************************* CPackedWorld *CIslandCollision::reloadPackedIsland(const CScenarioEntryPoints::CCompleteIsland &islandDesc) { //H_AUTO(R2_CIslandCollision_reloadPackedIsland) @@ -487,7 +487,7 @@ CPackedWorld *CIslandCollision::reloadPackedIsland(const CScenarioEntryPoints::C return _PackedIsland; } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::mergeWaterSurfaces() { //H_AUTO(R2_CIslandCollision_mergeWaterSurfaces) @@ -531,7 +531,7 @@ void CIslandCollision::mergeWaterSurfaces() } } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::addInaccessibleRegion(const NLMISC::CPolygon2D &poly) { //H_AUTO(R2_CIslandCollision_addInaccessibleRegion) @@ -559,7 +559,7 @@ void CIslandCollision::addInaccessibleRegion(const NLMISC::CPolygon2D &poly) } } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::loadEntryPoints() { //H_AUTO(R2_CIslandCollision_loadEntryPoints) @@ -580,7 +580,7 @@ void CIslandCollision::loadEntryPoints() } } -//********************************************************************************************************* +// ********************************************************************************************************* bool CIslandCollision::isValidPoly(const NLMISC::CPolygon2D &poly) { //H_AUTO(R2_CIslandCollision_isValidPoly) @@ -680,7 +680,7 @@ bool CIslandCollision::isValidPoly(const NLMISC::CPolygon2D &poly) return true; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CIslandCollision::isValidSegment(const NLMISC::CVector2f start, const NLMISC::CVector2f end) { //H_AUTO(R2_CIslandCollision_isValidSegment) @@ -704,7 +704,7 @@ bool CIslandCollision::isValidSegment(const NLMISC::CVector2f start, const NLMIS return isValidPoly(extrudedSegment); } -//********************************************************************************************************* +// ********************************************************************************************************* void CIslandCollision::waterSurfaceAdded(const NLMISC::CPolygon2D &shape, const NLMISC::CMatrix &worldMatrix) { //H_AUTO(R2_CIslandCollision_waterSurfaceAdded) @@ -732,7 +732,7 @@ void CIslandCollision::waterSurfaceAdded(const NLMISC::CPolygon2D &shape, const _WaterSurfs.push_back(ws); } -//********************************************************************************************************* +// ********************************************************************************************************* bool CIslandCollision::isValidPos(const NLMISC::CVector2f &pos) { //H_AUTO(R2_CIslandCollision_isValidPos) diff --git a/code/ryzom/client/src/r2/lua_event_forwarder.cpp b/code/ryzom/client/src/r2/lua_event_forwarder.cpp index f9b6e4b6e..004ea9430 100644 --- a/code/ryzom/client/src/r2/lua_event_forwarder.cpp +++ b/code/ryzom/client/src/r2/lua_event_forwarder.cpp @@ -43,7 +43,7 @@ static CLuaString LuaStr_onTargetInstancePreHrcMove("onTargetInstancePreHrcMove" -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onActChanged() { //H_AUTO(R2_CLuaEventForwarder_onActChanged) @@ -51,7 +51,7 @@ void CLuaEventForwarder::onActChanged() executeHandler(LuaStr_onActChanged, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onContinentChanged() { //H_AUTO(R2_CLuaEventForwarder_onContinentChanged) @@ -59,7 +59,7 @@ void CLuaEventForwarder::onContinentChanged() executeHandler(LuaStr_onContinentChanged, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onCreate() { //H_AUTO(R2_CLuaEventForwarder_onCreate) @@ -67,7 +67,7 @@ void CLuaEventForwarder::onCreate() executeHandler(LuaStr_onCreate, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onPostCreate() { //H_AUTO(R2_CLuaEventForwarder_onPostCreate) @@ -75,7 +75,7 @@ void CLuaEventForwarder::onPostCreate() executeHandler(LuaStr_onPostCreate, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onErase() { //H_AUTO(R2_CLuaEventForwarder_onErase) @@ -83,7 +83,7 @@ void CLuaEventForwarder::onErase() executeHandler(LuaStr_onErase, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onPreHrcMove() { //H_AUTO(R2_CLuaEventForwarder_onPreHrcMove) @@ -91,7 +91,7 @@ void CLuaEventForwarder::onPreHrcMove() executeHandler(LuaStr_onPreHrcMove, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onPostHrcMove() { //H_AUTO(R2_CLuaEventForwarder_onPostHrcMove) @@ -99,7 +99,7 @@ void CLuaEventForwarder::onPostHrcMove() executeHandler(LuaStr_onPostHrcMove, 0); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onFocus(bool focused) { //H_AUTO(R2_CLuaEventForwarder_onFocus) @@ -109,7 +109,7 @@ void CLuaEventForwarder::onFocus(bool focused) executeHandler(LuaStr_onFocus, 1); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onSelect(bool selected) { //H_AUTO(R2_CLuaEventForwarder_onSelect) @@ -119,7 +119,7 @@ void CLuaEventForwarder::onSelect(bool selected) executeHandler(LuaStr_onSelect, 1); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onAttrModified(const std::string &attrName, sint32 index) { //H_AUTO(R2_CLuaEventForwarder_onAttrModified) @@ -130,7 +130,7 @@ void CLuaEventForwarder::onAttrModified(const std::string &attrName, sint32 inde executeHandler(LuaStr_onAttrModified, 2); } -//********************************************************************************************************* +// ********************************************************************************************************* /*void CDisplayerLua::onTableModified(const std::string &tableName, const std::string &keyInTable, sint32 indexInTable) { //H_AUTO(R2_CDisplayerLua_onTableModified) @@ -142,7 +142,7 @@ void CLuaEventForwarder::onAttrModified(const std::string &attrName, sint32 inde executeHandler("onTableModified", 3); }*/ -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstanceCreated(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstanceCreated) @@ -153,7 +153,7 @@ void CLuaEventForwarder::onTargetInstanceCreated(const std::string &refMakerAttr executeHandler(LuaStr_onTargetInstanceCreated, 2); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstanceErased(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstanceErased) @@ -164,7 +164,7 @@ void CLuaEventForwarder::onTargetInstanceErased(const std::string &refMakerAttr, executeHandler(LuaStr_onTargetInstanceErased, 2); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstanceEraseRequested(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstanceEraseRequested) @@ -175,7 +175,7 @@ void CLuaEventForwarder::onTargetInstanceEraseRequested(const std::string &refMa executeHandler(LuaStr_onTargetInstanceEraseRequested, 2); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstanceAttrModified(const std::string &refMakerAttr, sint32 refMakerAttrIndex, const std::string &targetAttrName, sint32 targetAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstanceAttrModified) @@ -188,7 +188,7 @@ void CLuaEventForwarder::onTargetInstanceAttrModified(const std::string &refMake executeHandler(LuaStr_onTargetInstanceAttrModified, 4); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstancePreHrcMove(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstancePreHrcMove) @@ -199,7 +199,7 @@ void CLuaEventForwarder::onTargetInstancePreHrcMove(const std::string &refMakerA executeHandler(LuaStr_onTargetInstancePreHrcMove, 2); } -//********************************************************************************************************* +// ********************************************************************************************************* void CLuaEventForwarder::onTargetInstancePostHrcMove(const std::string &refMakerAttr, sint32 refMakerAttrIndex) { //H_AUTO(R2_CLuaEventForwarder_onTargetInstancePostHrcMove) diff --git a/code/ryzom/client/src/r2/mesh_array.cpp b/code/ryzom/client/src/r2/mesh_array.cpp index 26a308509..c5f120bc3 100644 --- a/code/ryzom/client/src/r2/mesh_array.cpp +++ b/code/ryzom/client/src/r2/mesh_array.cpp @@ -29,19 +29,19 @@ namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* CMeshArray::CMeshArray() { _Active = true; } -//********************************************************************************************************* +// ********************************************************************************************************* CMeshArray::~CMeshArray() { clear(); } -//********************************************************************************************************* +// ********************************************************************************************************* void CMeshArray::setShapeName(const std::string &shapeName) { //H_AUTO(R2_CMeshArray_setShapeName) @@ -49,7 +49,7 @@ void CMeshArray::setShapeName(const std::string &shapeName) _ShapeName = shapeName; } -//********************************************************************************************************* +// ********************************************************************************************************* void CMeshArray::resize(uint newSize) { //H_AUTO(R2_CMeshArray_resize) @@ -80,7 +80,7 @@ void CMeshArray::resize(uint newSize) } } -//********************************************************************************************************* +// ********************************************************************************************************* UInstance &CMeshArray::getInstance(uint index) { //H_AUTO(R2_CMeshArray_getInstance) @@ -88,7 +88,7 @@ UInstance &CMeshArray::getInstance(uint index) return _MeshInstances[index]; } -//********************************************************************************************************* +// ********************************************************************************************************* const UInstance &CMeshArray::getInstance(uint index) const { //H_AUTO(R2_CMeshArray_getInstance) @@ -96,7 +96,7 @@ const UInstance &CMeshArray::getInstance(uint index) const return _MeshInstances[index]; } -//********************************************************************************************************* +// ********************************************************************************************************* void CMeshArray::setEmissive(NLMISC::CRGBA color) { //H_AUTO(R2_CMeshArray_setEmissive) @@ -106,7 +106,7 @@ void CMeshArray::setEmissive(NLMISC::CRGBA color) } } -//********************************************************************************************************* +// ********************************************************************************************************* void CMeshArray::setActive(bool active) { //H_AUTO(R2_CMeshArray_setActive) diff --git a/code/ryzom/client/src/r2/palette_node.cpp b/code/ryzom/client/src/r2/palette_node.cpp index 89f5c3001..8f0aa150a 100644 --- a/code/ryzom/client/src/r2/palette_node.cpp +++ b/code/ryzom/client/src/r2/palette_node.cpp @@ -23,7 +23,7 @@ namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* /* const CLuaObject CPaletteNode::getClass() const { diff --git a/code/ryzom/client/src/r2/prim_render.cpp b/code/ryzom/client/src/r2/prim_render.cpp index 4aecb95f5..ac05a1633 100644 --- a/code/ryzom/client/src/r2/prim_render.cpp +++ b/code/ryzom/client/src/r2/prim_render.cpp @@ -66,7 +66,7 @@ void readFromLua(const CLuaObject &table, const char *key, CRGBA &dest) #define READ_FROM_LUA(dest) readFromLua(params, #dest, dest); -//********************************************************* +// ********************************************************* void CVertexLook::init(const CLuaObject ¶ms) { //H_AUTO(R2_CVertexLook_init) @@ -79,7 +79,7 @@ void CVertexLook::init(const CLuaObject ¶ms) } -//********************************************************* +// ********************************************************* void CEdgeLook::init(const CLuaObject ¶ms) { //H_AUTO(R2_CEdgeLook_init) @@ -103,7 +103,7 @@ void CEdgeLook::init(const CLuaObject ¶ms) if (worldMapWrapMode < WrapModeCount) WorldMapWrapMode = (TWrapMode) worldMapWrapMode; } -//********************************************************* +// ********************************************************* bool operator ==(const CPrimLook &lhs, const CPrimLook &rhs) { return lhs.Shape == rhs.Shape && @@ -117,7 +117,7 @@ bool operator ==(const CPrimLook &lhs, const CPrimLook &rhs) } -//********************************************************* +// ********************************************************* void CPrimLook::init(const CLuaObject ¶ms) { //H_AUTO(R2_CPrimLook_init) @@ -148,7 +148,7 @@ void CPrimLook::init(const CLuaObject ¶ms) // } -//********************************************************* +// ********************************************************* void CPrimRender::setLook(const CPrimLook &look) { //H_AUTO(R2_CPrimRender_setLook) @@ -166,7 +166,7 @@ void CPrimRender::setLook(const CPrimLook &look) update(); } -//********************************************************* +// ********************************************************* CPrimRender::~CPrimRender() { if (_AddedToWorldMap) @@ -182,7 +182,7 @@ CPrimRender::~CPrimRender() } } -//********************************************************* +// ********************************************************* CCtrlPolygon *CPrimRender::newCtrlPolygon() const { //H_AUTO(R2_CPrimRender_newCtrlPolygon) @@ -200,14 +200,14 @@ CCtrlPolygon *CPrimRender::newCtrlPolygon() const return new CCtrlMapPolygon; } -//********************************************************* +// ********************************************************* CCtrlQuad *CPrimRender::newCtrlQuad(uint /* edgeIndex */) const { //H_AUTO(R2_CPrimRender_newCtrlQuad) return new CCtrlQuad; } -//********************************************************* +// ********************************************************* bool CPrimRender::contains(const NLMISC::CVector2f &pos) const { //H_AUTO(R2_CPrimRender_contains) @@ -222,7 +222,7 @@ bool CPrimRender::contains(const NLMISC::CVector2f &pos) const return false; } -//********************************************************* +// ********************************************************* sint CPrimRender::isOnEdge(const NLMISC::CVector2f &pos) const { //H_AUTO(R2_CPrimRender_isOnEdge) @@ -233,7 +233,7 @@ sint CPrimRender::isOnEdge(const NLMISC::CVector2f &pos) const return -1; } -//********************************************************* +// ********************************************************* CPrimRender::CPrimRender() { _Emissive = CRGBA::Black; @@ -244,14 +244,14 @@ CPrimRender::CPrimRender() _Active = true; } -//********************************************************* +// ********************************************************* void CPrimRender::clear() { //H_AUTO(R2_CPrimRender_clear) setVertices(std::vector()); } -//********************************************************* +// ********************************************************* void CPrimRender::setVertices(const std::vector &vertices) { //H_AUTO(R2_CPrimRender_setVertices) @@ -272,7 +272,7 @@ void CPrimRender::setVertices(const std::vector &vertices) update(); } -//********************************************************* +// ********************************************************* void CPrimRender::setVertices(const std::vector &vertices) { //H_AUTO(R2_CPrimRender_setVertices) @@ -284,7 +284,7 @@ void CPrimRender::setVertices(const std::vector &vertices) setVertices(vertices3D); } -//********************************************************* +// ********************************************************* void CPrimRender::setCustomWorldMapEdgeUVMatrix(bool on, const NLMISC::CMatrix &matrix) { //H_AUTO(R2_CPrimRender_setCustomWorldMapEdgeUVMatrix) @@ -294,7 +294,7 @@ void CPrimRender::setCustomWorldMapEdgeUVMatrix(bool on, const NLMISC::CMatrix & } } -//********************************************************* +// ********************************************************* void CPrimRender::setCustomDecalEdgeUVMatrix(bool on, const NLMISC::CMatrix &matrix) { //H_AUTO(R2_CPrimRender_setCustomDecalEdgeUVMatrix) @@ -304,7 +304,7 @@ void CPrimRender::setCustomDecalEdgeUVMatrix(bool on, const NLMISC::CMatrix &mat } } -//********************************************************* +// ********************************************************* void CPrimRender::setEmissive(NLMISC::CRGBA color) { //H_AUTO(R2_CPrimRender_setEmissive) @@ -312,7 +312,7 @@ void CPrimRender::setEmissive(NLMISC::CRGBA color) forceSetEmissive(color); } -//********************************************************* +// ********************************************************* void CPrimRender::forceSetEmissive(NLMISC::CRGBA emissive) { //H_AUTO(R2_CPrimRender_forceSetEmissive) @@ -329,7 +329,7 @@ void CPrimRender::forceSetEmissive(NLMISC::CRGBA emissive) } } -//********************************************************* +// ********************************************************* void CPrimRender::update() { //H_AUTO(R2_CPrimRender_update) @@ -428,7 +428,7 @@ void CPrimRender::update() } -//********************************************************* +// ********************************************************* void CPrimRender::updatePos() { //H_AUTO(R2_CPrimRender_updatePos) @@ -512,7 +512,7 @@ void CPrimRender::updatePos() } } -//********************************************************* +// ********************************************************* void CPrimRender::updateEdge(NL3D::UInstance edge,const NLMISC::CVector &start, const NLMISC::CVector &end) { //H_AUTO(R2_CPrimRender_updateEdge) @@ -529,7 +529,7 @@ void CPrimRender::updateEdge(NL3D::UInstance edge,const NLMISC::CVector &start, edge.show(); } -//********************************************************* +// ********************************************************* void CPrimRender::updateEdgeDecal(CDecal &edgeDecal, const NLMISC::CVector &start, const NLMISC::CVector &end, float distToStartVertex, float distToEndVertex) { //H_AUTO(R2_CPrimRender_updateEdgeDecal) @@ -567,7 +567,7 @@ void CPrimRender::updateEdgeDecal(CDecal &edgeDecal, const NLMISC::CVector &star edgeDecal.setTextureMatrix(uvMatrix); } -//********************************************************* +// ********************************************************* void CPrimRender::addDecalsToRenderList() { //H_AUTO(R2_CPrimRender_addDecalsToRenderList) @@ -582,7 +582,7 @@ void CPrimRender::addDecalsToRenderList() } } -//********************************************************* +// ********************************************************* void CPrimRender::setWorldMapNumVertices(uint count) { //H_AUTO(R2_CPrimRender_setWorldMapNumVertices) @@ -622,7 +622,7 @@ void CPrimRender::setWorldMapNumVertices(uint count) } } -//********************************************************* +// ********************************************************* void CPrimRender::setWorldMapNumEdges(uint count) { //H_AUTO(R2_CPrimRender_setWorldMapNumEdges) @@ -662,7 +662,7 @@ void CPrimRender::setWorldMapNumEdges(uint count) } } -//********************************************************* +// ********************************************************* void CPrimRender::updateWorldMapDisplay() { //H_AUTO(R2_CPrimRender_updateWorldMapDisplay) @@ -672,7 +672,7 @@ void CPrimRender::updateWorldMapDisplay() this->onUpdate(*gm); } -//********************************************************* +// ********************************************************* void CPrimRender::onAdd(CGroupMap &owner) { //H_AUTO(R2_CPrimRender_onAdd) @@ -689,7 +689,7 @@ void CPrimRender::onAdd(CGroupMap &owner) } } -//********************************************************* +// ********************************************************* void CPrimRender::onRemove(CGroupMap &owner) { //H_AUTO(R2_CPrimRender_onRemove) @@ -704,14 +704,14 @@ void CPrimRender::onRemove(CGroupMap &owner) _AddedToWorldMap = false; } -//********************************************************* +// ********************************************************* void CPrimRender::onPreRender(CGroupMap &/* owner */) { //H_AUTO(R2_CPrimRender_onPreRender) // no-op } -//********************************************************* +// ********************************************************* void CPrimRender::onUpdate(CGroupMap &worldMap) { //H_AUTO(R2_CPrimRender_onUpdate) @@ -828,7 +828,7 @@ void CPrimRender::onUpdate(CGroupMap &worldMap) } } -//********************************************************* +// ********************************************************* CViewBitmap *CPrimRender::getWorldMapVertexView(uint index) const { //H_AUTO(R2_CPrimRender_getWorldMapVertexView) @@ -836,14 +836,14 @@ CViewBitmap *CPrimRender::getWorldMapVertexView(uint index) const return _WorldMapVertices[index]; } -//********************************************************* +// ********************************************************* void CPrimRender::setWorldMapPolyColor(NLMISC::CRGBA color) { //H_AUTO(R2_CPrimRender_setWorldMapPolyColor) if (_WorldMapPoly) _WorldMapPoly->setColorRGBA(color); } -//********************************************************* +// ********************************************************* void CPrimRender::setActive(bool active) { //H_AUTO(R2_CPrimRender_setActive) diff --git a/code/ryzom/client/src/r2/prim_render.h b/code/ryzom/client/src/r2/prim_render.h index 2fbe2ca2a..025da5862 100644 --- a/code/ryzom/client/src/r2/prim_render.h +++ b/code/ryzom/client/src/r2/prim_render.h @@ -31,7 +31,7 @@ class CCtrlPolygon; namespace R2 { -//******************************************************************************* +// ******************************************************************************* class CVertexLook { public: @@ -65,7 +65,7 @@ inline bool operator == (const CVertexLook &lhs, const CVertexLook &rhs) inline bool operator != (const CVertexLook &lhs, const CVertexLook &rhs) { return !(lhs == rhs); } -//******************************************************************************* +// ******************************************************************************* class CEdgeLook { public: @@ -132,7 +132,7 @@ inline bool operator==(const CEdgeLook &lhs, const CEdgeLook &rhs) inline bool operator!=(const CEdgeLook &lhs, const CEdgeLook &rhs) { return !(lhs == rhs); } -//******************************************************************************* +// ******************************************************************************* // look of a primitive class CPrimLook { diff --git a/code/ryzom/client/src/r2/tool.cpp b/code/ryzom/client/src/r2/tool.cpp index a0e97539b..65887db73 100644 --- a/code/ryzom/client/src/r2/tool.cpp +++ b/code/ryzom/client/src/r2/tool.cpp @@ -68,7 +68,7 @@ static const CVector cardinals[] = CVector(1.f, -1.f, 0.f).normed() }; -//*************************************************************** +// *************************************************************** CTool::CTool() { _DoubleClickStartTime = -1; @@ -80,7 +80,7 @@ CTool::CTool() } -//*************************************************************** +// *************************************************************** void CTool::startDoubleClickCheck() { //H_AUTO(R2_CTool_startDoubleClickCheck) @@ -88,7 +88,7 @@ void CTool::startDoubleClickCheck() getMousePos(_DoubleClickX, _DoubleClickY); } -//*************************************************************** +// *************************************************************** bool CTool::checkDoubleClick() { //H_AUTO(R2_CTool_checkDoubleClick) @@ -101,7 +101,7 @@ bool CTool::checkDoubleClick() return abs(mx - _DoubleClickX) <= moveThrehsold && abs(my - _DoubleClickY) <= moveThrehsold; } -//*************************************************************** +// *************************************************************** bool CTool::isShiftDown() { //H_AUTO(R2_CTool_isShiftDown) @@ -110,7 +110,7 @@ bool CTool::isShiftDown() Driver->AsyncListener.isKeyDown(KeyRSHIFT); } -//*************************************************************** +// *************************************************************** bool CTool::isCtrlDown() { //H_AUTO(R2_CTool_isCtrlDown) @@ -119,21 +119,21 @@ bool CTool::isCtrlDown() Driver->AsyncListener.isKeyDown(KeyRCONTROL); } -//*************************************************************** +// *************************************************************** CInterfaceManager &CTool::getUI() { //H_AUTO(R2_CTool_getUI) return CEditor::getUI(); } -//*************************************************************** +// *************************************************************** void CTool::getScreenSize(uint32 &scrW, uint32 &scrH) { //H_AUTO(R2_CTool_getScreenSize) getUI().getViewRenderer().getScreenSize(scrW, scrH); } -//*************************************************************** +// *************************************************************** uint32 CTool::getScreenWidth() { //H_AUTO(R2_CTool_getScreenWidth) @@ -142,7 +142,7 @@ uint32 CTool::getScreenWidth() return scrW; } -//*************************************************************** +// *************************************************************** uint32 CTool::getScreenHeight() { //H_AUTO(R2_CTool_getScreenHeight) @@ -151,7 +151,7 @@ uint32 CTool::getScreenHeight() return scrH; } -//*************************************************************** +// *************************************************************** void CTool::getMousePos(sint32 &x, sint32 &y) { //H_AUTO(R2_CTool_getMousePos) @@ -164,7 +164,7 @@ void CTool::getMousePos(sint32 &x, sint32 &y) cursor->getPointerPos(x, y); } -//*************************************************************** +// *************************************************************** sint32 CTool::getMouseX() { //H_AUTO(R2_CTool_getMouseX) @@ -173,7 +173,7 @@ sint32 CTool::getMouseX() return x; } -//*************************************************************** +// *************************************************************** sint32 CTool::getMouseY() { //H_AUTO(R2_CTool_getMouseY) @@ -182,7 +182,7 @@ sint32 CTool::getMouseY() return y; } -//*************************************************************** +// *************************************************************** bool CTool::isMouseOnUI() { //H_AUTO(R2_CTool_isMouseOnUI) @@ -190,7 +190,7 @@ bool CTool::isMouseOnUI() } -//*************************************************************** +// *************************************************************** CGroupMap *CTool::getWorldMap() { //H_AUTO(R2_CTool_getWorldMap) @@ -203,7 +203,7 @@ CGroupMap *CTool::getWorldMap() return mapPtr; } -//*************************************************************** +// *************************************************************** CGroupMap *CTool::isMouseOnWorldMap() { //H_AUTO(R2_CTool_isMouseOnWorldMap) @@ -217,7 +217,7 @@ CGroupMap *CTool::isMouseOnWorldMap() return NULL; } -//*************************************************************** +// *************************************************************** CGroupContainer *CTool::isMouseOnContainer() { //H_AUTO(R2_CTool_isMouseOnContainer) @@ -231,7 +231,7 @@ CGroupContainer *CTool::isMouseOnContainer() return NULL; } -//*************************************************************** +// *************************************************************** void CTool::computeWorldViewRay(sint32 posX, sint32 posY, CWorldViewRay &dest) { //H_AUTO(R2_CTool_computeWorldViewRay) @@ -288,7 +288,7 @@ void CTool::computeWorldViewRay(sint32 posX, sint32 posY, CWorldViewRay &dest) dest.Origin += distBias * dest.Dir; } -//*************************************************************** +// *************************************************************** bool CTool::isInScreen(sint32 x, sint32 y) { //H_AUTO(R2_CTool_isInScreen) @@ -297,7 +297,7 @@ bool CTool::isInScreen(sint32 x, sint32 y) return x >= 0 && y >=0 && x < (sint32) scrW && y < (sint32) scrH; } -//*************************************************************** +// *************************************************************** CTool::TRayIntersectionType CTool::getPacsType(const NLMISC::CVector &pos, float threshold, NLPACS::UGlobalPosition &destPos) { //H_AUTO(R2_CTool_getPacsType) @@ -319,7 +319,7 @@ CTool::TRayIntersectionType CTool::getPacsType(const NLMISC::CVector &pos, float } } -//*************************************************************** +// *************************************************************** bool CTool::raytrace(const NLMISC::CVector &segmentStart, const NLMISC::CVector &dir, NLMISC::CVector &inter) { //H_AUTO(R2_CTool_raytrace) @@ -353,7 +353,7 @@ bool CTool::raytrace(const NLMISC::CVector &segmentStart, const NLMISC::CVector return false; } -//*************************************************************** +// *************************************************************** CTool::TRayIntersectionType CTool::computeWorldMapIntersection(float x, float y, NLMISC::CVector &inter) { //H_AUTO(R2_CTool_computeWorldMapIntersection) @@ -395,7 +395,7 @@ CTool::TRayIntersectionType CTool::computeWorldMapIntersection(float x, float y, return interType; } -//*************************************************************** +// *************************************************************** inline bool CTool::isIslandValidPos(const CArray2D &heightMap, const CScenarioEntryPoints::CCompleteIsland &islandDesc, float x, float y) { //H_AUTO(R2_CTool_isIslandValidPos) @@ -431,7 +431,7 @@ static bool areaRaytrace(CPackedWorld &pw, const CVector &start, const CVector & return false; } -//*************************************************************** +// *************************************************************** bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CVector &inter) { //H_AUTO(R2_CTool_computeNearestValidSurfaceFromHeightMap) @@ -488,14 +488,14 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV return true; } -//*************************************************************** +// *************************************************************** bool CTool::isValid2DPos(const NLMISC::CVector2f &pos) { //H_AUTO(R2_CTool_isValid2DPos) return getEditor().getIslandCollision().isValidPos(CVector2f(pos.x, pos.y)); } -//*************************************************************** +// *************************************************************** CTool::TRayIntersectionType CTool::computeLandscapeRayIntersection(const CWorldViewRay &worldViewRay, NLMISC::CVector &inter) { //H_AUTO(R2_CTool_computeLandscapeRayIntersection) @@ -545,7 +545,7 @@ CTool::TRayIntersectionType CTool::computeLandscapeRayIntersection(const CWorldV } } -//********************************************** +// ********************************************** void CTool::handleMouseOverPlayer(bool over) { //H_AUTO(R2_CTool_handleMouseOverPlayer) @@ -563,7 +563,7 @@ void CTool::handleMouseOverPlayer(bool over) UserEntity->makeTransparent(false); } -//*************************************************************** +// *************************************************************** CInstance *CTool::checkInstanceUnderMouse(IDisplayerUIHandle **miniMapHandle /*= NULL*/) { //H_AUTO(R2_CTool_checkInstanceUnderMouse) @@ -658,7 +658,7 @@ CInstance *CTool::checkInstanceUnderMouse(IDisplayerUIHandle **miniMapHandle /*= } -//*************************************************************** +// *************************************************************** void CTool::handleMouseOverInstance(const char *cursorDefault, const char *cursorOverUnselectedInstance, const char *cursorOverSelectedInstance) { //H_AUTO(R2_CTool_handleMouseOverInstance) @@ -682,7 +682,7 @@ void CTool::handleMouseOverInstance(const char *cursorDefault, const char *curso } } -//*************************************************************** +// *************************************************************** bool CTool::onMouseRightButtonClicked() { //H_AUTO(R2_CTool_onMouseRightButtonClicked) @@ -696,7 +696,7 @@ bool CTool::onMouseRightButtonClicked() return true; } -//*************************************************************** +// *************************************************************** bool CTool::defaultRightButtonDownHandling() { //H_AUTO(R2_CTool_defaultRightButtonDownHandling) @@ -712,7 +712,7 @@ bool CTool::defaultRightButtonDownHandling() return false; } -//*************************************************************** +// *************************************************************** void CTool::captureMouse() { //H_AUTO(R2_CTool_captureMouse) @@ -730,7 +730,7 @@ void CTool::captureMouse() _MouseCaptured = true; } -//*************************************************************** +// *************************************************************** void CTool::releaseMouse() { //H_AUTO(R2_CTool_releaseMouse) @@ -741,14 +741,14 @@ void CTool::releaseMouse() _MouseCaptured = false; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CTool::isMouseCaptured() { //H_AUTO(R2_CTool_isMouseCaptured) return _MouseCaptured; } -//********************************************************************************************************* +// ********************************************************************************************************* void CTool::setMouseCursor(const char *cursorTexture) { //H_AUTO(R2_CTool_setMouseCursor) @@ -759,7 +759,7 @@ void CTool::setMouseCursor(const char *cursorTexture) } } -//*************************************************************** +// *************************************************************** bool CTool::handleEvent(const CEventDescriptor &event) { //H_AUTO(R2_CTool_handleEvent) @@ -805,14 +805,14 @@ bool CTool::handleEvent(const CEventDescriptor &event) return handled; } -//*************************************************************** +// *************************************************************** CDynamicMapClient &CTool::getDMC() { //H_AUTO(R2_CTool_getDMC) return getEditor().getDMC(); } -//*************************************************************** +// *************************************************************** void CTool::handleWorldMapAutoPan(sint32 &outDx, sint32 &outDy) { //H_AUTO(R2_CTool_handleWorldMapAutoPan) @@ -866,7 +866,7 @@ void CTool::handleWorldMapAutoPan(sint32 &outDx, sint32 &outDy) return; } -//*************************************************************** +// *************************************************************** int CTool::luaIsPickTool(CLuaState &ls) { //H_AUTO(R2_CTool_luaIsPickTool) @@ -875,7 +875,7 @@ int CTool::luaIsPickTool(CLuaState &ls) return 1; } -//*************************************************************** +// *************************************************************** void CTool::setContextHelp(const ucstring &contextHelp) { //H_AUTO(R2_CTool_setContextHelp) @@ -886,7 +886,7 @@ void CTool::setContextHelp(const ucstring &contextHelp) getEditor().callEnvMethod("setToolContextHelp", 1, 0); } -//*************************************************************** +// *************************************************************** NLMISC::CRGBA CTool::getInvalidPosColor() { //H_AUTO(R2_CTool_getInvalidPosColor) diff --git a/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp b/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp index 467cb60f7..e7c3a60c1 100644 --- a/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp +++ b/code/ryzom/client/src/r2/tool_choose_pos_lua.cpp @@ -27,7 +27,7 @@ using namespace NLMISC; namespace R2 { -//*************************************************************** +// *************************************************************** CToolChoosePosLua::CToolChoosePosLua(uint ghostSlot, const CLuaObject &validFunc, const CLuaObject &cancelFunc, @@ -51,7 +51,7 @@ CToolChoosePosLua::CToolChoosePosLua(uint ghostSlot, _Commited = false; } -//*************************************************************** +// *************************************************************** void CToolChoosePosLua::commit(const NLMISC::CVector &createPosition, float /* createAngle */) { //H_AUTO(R2_CToolChoosePosLua_commit) @@ -67,7 +67,7 @@ void CToolChoosePosLua::commit(const NLMISC::CVector &createPosition, float /* c _Commited = true; } -//********************************************************************************************************* +// ********************************************************************************************************* void CToolChoosePosLua::cancel() { //H_AUTO(R2_CToolChoosePosLua_cancel) diff --git a/code/ryzom/client/src/r2/tool_create_entity.cpp b/code/ryzom/client/src/r2/tool_create_entity.cpp index d1a4b73cd..9633d242e 100644 --- a/code/ryzom/client/src/r2/tool_create_entity.cpp +++ b/code/ryzom/client/src/r2/tool_create_entity.cpp @@ -48,20 +48,20 @@ using namespace std; namespace R2 { -//*************************************************************** +// *************************************************************** CToolCreateEntity::~CToolCreateEntity() { clearArray(); } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::cancel() { CToolChoosePos::cancel(); clearArray(); } -//*************************************************************** +// *************************************************************** CToolCreateEntity::CToolCreateEntity(uint ghostSlot, const std::string &paletteId, bool arrayMode) : CToolChoosePos(ghostSlot) { _PaletteId = paletteId; @@ -88,7 +88,7 @@ CToolCreateEntity::CToolCreateEntity(uint ghostSlot, const std::string &paletteI _ArrayWantedAction = ArrayActionNone; } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::updateInvalidCursorOnUI() { //H_AUTO(R2_CToolCreateEntity_updateInvalidCursorOnUI) @@ -105,7 +105,7 @@ void CToolCreateEntity::updateInvalidCursorOnUI() setMouseCursor(DEFAULT_CURSOR); } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::commit(const NLMISC::CVector &createPosition, float createAngle) { //H_AUTO(R2_CToolCreateEntity_commit) @@ -145,7 +145,7 @@ void CToolCreateEntity::commit(const NLMISC::CVector &createPosition, float crea } } -//*************************************************************** +// *************************************************************** bool CToolCreateEntity::isBotObjectSheet(const NLMISC::CSheetId &sheetId) const { //H_AUTO(R2_CToolCreateEntity_isBotObjectSheet) @@ -159,7 +159,7 @@ bool CToolCreateEntity::isBotObjectSheet(const NLMISC::CSheetId &sheetId) const } -//*************************************************************** +// *************************************************************** std::string CToolCreateEntity::cloneEntityIntoScenario(CEntityCL *clonee, const NLMISC::CVector &createPosition, float createAngle, @@ -537,14 +537,14 @@ std::string CToolCreateEntity::cloneEntityIntoScenario(CEntityCL *clonee, return instanceId; } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::onActivate() { //H_AUTO(R2_CToolCreateEntity_onActivate) setContextHelp(CI18N::get("uiR2EDToolCreateEntity")); } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::updateBeforeRender() { //H_AUTO(R2_CToolCreateEntity_updateBeforeRender) @@ -599,7 +599,7 @@ void CToolCreateEntity::updateBeforeRender() setMouseCursor(_ValidArray ? _CursValid.c_str() : _CursInvalid.c_str()); } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::updateAfterRender() { //H_AUTO(R2_CToolCreateEntity_updateAfterRender) @@ -633,7 +633,7 @@ void CToolCreateEntity::updateAfterRender() } -//*************************************************************** +// *************************************************************** bool CToolCreateEntity::onMouseLeftButtonClicked() { //H_AUTO(R2_CToolCreateEntity_onMouseLeftButtonClicked) @@ -648,7 +648,7 @@ bool CToolCreateEntity::onMouseLeftButtonClicked() return true; } -//*************************************************************** +// *************************************************************** bool CToolCreateEntity::onMouseRightButtonClicked() { //H_AUTO(R2_CToolCreateEntity_onMouseRightButtonClicked) @@ -660,7 +660,7 @@ bool CToolCreateEntity::onMouseRightButtonClicked() return true; } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::clearArray() { //H_AUTO(R2_CToolCreateEntity_clearArray) @@ -673,7 +673,7 @@ void CToolCreateEntity::clearArray() } } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::updateArray(CEntityCL *clonee) { //H_AUTO(R2_CToolCreateEntity_updateArray) @@ -784,7 +784,7 @@ void CToolCreateEntity::updateArray(CEntityCL *clonee) } } -//*************************************************************** +// *************************************************************** void CToolCreateEntity::commitArray() { //H_AUTO(R2_CToolCreateEntity_commitArray) @@ -803,7 +803,7 @@ void CToolCreateEntity::commitArray() getEditor().getDMC().flushActions(); } -//*************************************************************** +// *************************************************************** bool CToolCreateEntity::stopAfterCommit() const { //H_AUTO(R2_CToolCreateEntity_stopAfterCommit) @@ -812,7 +812,7 @@ bool CToolCreateEntity::stopAfterCommit() const -//*************************************************************** +// *************************************************************** class CAHR2EDToggleDrawArray : public IActionHandler { virtual void execute(CCtrlBase *pCaller, const std::string &/* sParams */) diff --git a/code/ryzom/client/src/r2/tool_draw_prim.cpp b/code/ryzom/client/src/r2/tool_draw_prim.cpp index e2eac61ba..981d942af 100644 --- a/code/ryzom/client/src/r2/tool_draw_prim.cpp +++ b/code/ryzom/client/src/r2/tool_draw_prim.cpp @@ -41,7 +41,7 @@ namespace R2 { -//*************************************************************** +// *************************************************************** CToolDrawPrim::CToolDrawPrim(TPrimType primType, CInstance *extending /*= NULL*/) { _NumPoints = 0; @@ -60,14 +60,14 @@ CToolDrawPrim::CToolDrawPrim(TPrimType primType, CInstance *extending /*= NULL*/ } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::canTerminate() const { //H_AUTO(R2_CToolDrawPrim_canTerminate) return ((_PrimType == Road && _NumPoints >= 1) || _NumPoints >= 3) && _ValidPrim; } -//*************************************************************** +// *************************************************************** const char *CToolDrawPrim::getToolUIName() const { //H_AUTO(R2_CToolDrawPrim_getToolUIName) @@ -75,7 +75,7 @@ const char *CToolDrawPrim::getToolUIName() const } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::init(const CLuaObject ¶meters) { //H_AUTO(R2_CToolDrawPrim_init) @@ -163,13 +163,13 @@ bool CToolDrawPrim::init(const CLuaObject ¶meters) return true; } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::updateAfterRender() { //H_AUTO(R2_CToolDrawPrim_updateAfterRender) } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::removeFromWorldMap() { //H_AUTO(R2_CToolDrawPrim_removeFromWorldMap) @@ -187,7 +187,7 @@ void CToolDrawPrim::removeFromWorldMap() } } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::cancel() { //H_AUTO(R2_CToolDrawPrim_cancel) @@ -209,7 +209,7 @@ void CToolDrawPrim::cancel() } } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::setPrimLook(bool closed, bool lastEdgeIsValid, bool valid) { //H_AUTO(R2_CToolDrawPrim_setPrimLook) @@ -221,7 +221,7 @@ void CToolDrawPrim::setPrimLook(bool closed, bool lastEdgeIsValid, bool valid) _Prim.setLook(*look); } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::updateBeforeRender() { //H_AUTO(R2_CToolDrawPrim_updateBeforeRender) @@ -233,7 +233,7 @@ void CToolDrawPrim::updateBeforeRender() } } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::doUpdateBeforeRender() { //H_AUTO(R2_CToolDrawPrim_doUpdateBeforeRender) @@ -418,7 +418,7 @@ void CToolDrawPrim::doUpdateBeforeRender() } } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::updateInaccessiblePrimRenderLook(CPrimRender &dest) { //H_AUTO(R2_CToolDrawPrim_updateInaccessiblePrimRenderLook) @@ -435,7 +435,7 @@ void CToolDrawPrim::updateInaccessiblePrimRenderLook(CPrimRender &dest) dest.setCustomDecalEdgeUVMatrix(true, getEditor().getIslandCollision().getWorldToAccessibilityTexMat(true)); // cropped version for decal rendering } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::onMouseLeftButtonClicked() { //H_AUTO(R2_CToolDrawPrim_onMouseLeftButtonClicked) @@ -455,7 +455,7 @@ bool CToolDrawPrim::onMouseLeftButtonClicked() return true; } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::onMouseLeftButtonDown() { //H_AUTO(R2_CToolDrawPrim_onMouseLeftButtonDown) @@ -480,7 +480,7 @@ bool CToolDrawPrim::onMouseLeftButtonDown() } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::commit() { //H_AUTO(R2_CToolDrawPrim_commit) @@ -626,7 +626,7 @@ void CToolDrawPrim::commit() } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::onMouseRightButtonClicked() { //H_AUTO(R2_CToolDrawPrim_onMouseRightButtonClicked) @@ -653,7 +653,7 @@ bool CToolDrawPrim::onMouseRightButtonClicked() //return true; } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::onDeleteCmd() { //H_AUTO(R2_CToolDrawPrim_onDeleteCmd) @@ -679,7 +679,7 @@ bool CToolDrawPrim::onDeleteCmd() } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::isValidPolyShape(bool ignoreLast, std::list &splitPoly) const { //H_AUTO(R2_CToolDrawPrim_isValidPolyShape) @@ -711,7 +711,7 @@ bool CToolDrawPrim::isValidPolyShape(bool ignoreLast, std::list &split return validPrim; } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::testAccessibleEdges(bool ignoreLast) { //H_AUTO(R2_CToolDrawPrim_testAccessibleEdges) @@ -734,7 +734,7 @@ bool CToolDrawPrim::testAccessibleEdges(bool ignoreLast) return true; } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::updateValidityFlag(bool ignoreLast) { //H_AUTO(R2_CToolDrawPrim_updateValidityFlag) @@ -789,7 +789,7 @@ void CToolDrawPrim::updateValidityFlag(bool ignoreLast) } }*/ -//*************************************************************** +// *************************************************************** void CToolDrawPrim::onActivate() { //H_AUTO(R2_CToolDrawPrim_onActivate) @@ -819,14 +819,14 @@ void CToolDrawPrim::onActivate() } } -//*************************************************************** +// *************************************************************** bool CToolDrawPrim::checkRoomLeft() { //H_AUTO(R2_CToolDrawPrim_checkRoomLeft) return _NumPoints < PrimMaxNumPoints; } -//*************************************************************** +// *************************************************************** void CToolDrawPrim::displayNoMoreRoomLeftMsg() { //H_AUTO(R2_CToolDrawPrim_displayNoMoreRoomLeftMsg) diff --git a/code/ryzom/client/src/r2/tool_draw_road.cpp b/code/ryzom/client/src/r2/tool_draw_road.cpp index 63c8769ae..ff799a680 100644 --- a/code/ryzom/client/src/r2/tool_draw_road.cpp +++ b/code/ryzom/client/src/r2/tool_draw_road.cpp @@ -30,14 +30,14 @@ using namespace NLMISC; namespace R2 { -//*************************************************************** +// *************************************************************** CToolDrawRoad::CToolDrawRoad() { _NumWayPoints = 0; _ValidPos = false; } -//*************************************************************** +// *************************************************************** void CToolDrawRoad::updateAfterRender() { } @@ -48,7 +48,7 @@ void CToolDrawRoad::cancel() } -//*************************************************************** +// *************************************************************** void CToolDrawRoad::updateBeforeRender() { // Build vector for direction pointed by mouse in world @@ -107,7 +107,7 @@ void CToolDrawRoad::updateBeforeRender() } } -//*************************************************************** +// *************************************************************** bool CToolDrawRoad::onMouseLeftButtonClicked() { if (_ValidPos) @@ -118,7 +118,7 @@ bool CToolDrawRoad::onMouseLeftButtonClicked() return true; } -//*************************************************************** +// *************************************************************** bool CToolDrawRoad::onMouseLeftButtonDown() { if (!checkDoubleClick()) return false; @@ -168,7 +168,7 @@ bool CToolDrawRoad::onMouseLeftButtonDown() } -//*************************************************************** +// *************************************************************** bool CToolDrawRoad::onMouseRightButtonClicked() { // cancel the drawing diff --git a/code/ryzom/client/src/r2/tool_maintained_action.cpp b/code/ryzom/client/src/r2/tool_maintained_action.cpp index df28ea12d..4f8001d86 100644 --- a/code/ryzom/client/src/r2/tool_maintained_action.cpp +++ b/code/ryzom/client/src/r2/tool_maintained_action.cpp @@ -23,7 +23,7 @@ namespace R2 { -//*************************************************************** +// *************************************************************** CToolMaintainedAction::CToolMaintainedAction() { _State = Idle; @@ -33,13 +33,13 @@ CToolMaintainedAction::CToolMaintainedAction() _LostFocusRecover = false; } -//*************************************************************** +// *************************************************************** CToolMaintainedAction::~CToolMaintainedAction() { // getEditor().setFocusedInstance(NULL); } -//*************************************************************** +// *************************************************************** void CToolMaintainedAction::cancel() { //H_AUTO(R2_CToolMaintainedAction_cancel) @@ -55,7 +55,7 @@ void CToolMaintainedAction::cancel() } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::onMouseLeftButtonDown() { //H_AUTO(R2_CToolMaintainedAction_onMouseLeftButtonDown) @@ -86,7 +86,7 @@ bool CToolMaintainedAction::onMouseLeftButtonDown() return true; } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::onMouseLeftButtonUp() { //H_AUTO(R2_CToolMaintainedAction_onMouseLeftButtonUp) @@ -124,7 +124,7 @@ bool CToolMaintainedAction::onMouseLeftButtonUp() return true; } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::onMouseRightButtonDown() { //H_AUTO(R2_CToolMaintainedAction_onMouseRightButtonDown) @@ -149,7 +149,7 @@ bool CToolMaintainedAction::onMouseRightButtonDown() return true; } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::onMouseRightButtonUp() { //H_AUTO(R2_CToolMaintainedAction_onMouseRightButtonUp) @@ -166,7 +166,7 @@ bool CToolMaintainedAction::onMouseRightButtonUp() return false; } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::onMouseLeftButtonClicked() { //H_AUTO(R2_CToolMaintainedAction_onMouseLeftButtonClicked) @@ -190,21 +190,21 @@ bool CToolMaintainedAction::onMouseLeftButtonClicked() return true; } -//*************************************************************** +// *************************************************************** const char *CToolMaintainedAction::getDefaultCursor() const { //H_AUTO(R2_CToolMaintainedAction_getDefaultCursor) return DEFAULT_CURSOR; } -//*************************************************************** +// *************************************************************** const char *CToolMaintainedAction::getPickCursor() const { //H_AUTO(R2_CToolMaintainedAction_getPickCursor) return "curs_pick.tga"; } -//*************************************************************** +// *************************************************************** void CToolMaintainedAction::updateBeforeRender() { //H_AUTO(R2_CToolMaintainedAction_updateBeforeRender) @@ -212,7 +212,7 @@ void CToolMaintainedAction::updateBeforeRender() } -//*************************************************************** +// *************************************************************** void CToolMaintainedAction::onFocusGained() { if (_State == Idle) @@ -222,7 +222,7 @@ void CToolMaintainedAction::onFocusGained() } } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::onMouseMove() { if (_LostFocusRecover) @@ -240,7 +240,7 @@ bool CToolMaintainedAction::onMouseMove() return false; } -//*************************************************************** +// *************************************************************** void CToolMaintainedAction::updateFocusedInstance() { //handleMouseOverInstance(DEFAULT_CURSOR, , getCursorForPossibleAction()); @@ -280,7 +280,7 @@ void CToolMaintainedAction::updateFocusedInstance() } } -//*************************************************************** +// *************************************************************** void CToolMaintainedAction::updateAfterRender() { //H_AUTO(R2_CToolMaintainedAction_updateAfterRender) @@ -306,7 +306,7 @@ void CToolMaintainedAction::updateAfterRender() } } -//*************************************************************** +// *************************************************************** bool CToolMaintainedAction::getPreviousToolClickEndFlag(bool clear /*=true*/) { //H_AUTO(R2_CToolMaintainedAction_getPreviousToolClickEndFlag) diff --git a/code/ryzom/client/src/r2/tool_new_vertex.cpp b/code/ryzom/client/src/r2/tool_new_vertex.cpp index 2ba20a61e..68674b843 100644 --- a/code/ryzom/client/src/r2/tool_new_vertex.cpp +++ b/code/ryzom/client/src/r2/tool_new_vertex.cpp @@ -29,13 +29,13 @@ namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* CToolNewVertex::CToolNewVertex() : CToolChoosePos(-1, "curs_create.tga", "curs_create_vertex_invalid.tga"), _CurrEdge(-1), _CurrPos(CVector::Null) { lockMultiPos(); } -//********************************************************************************************************* +// ********************************************************************************************************* bool CToolNewVertex::isValidChoosePos(const CVector2f &pos) const { //H_AUTO(R2_CToolNewVertex_isValidChoosePos) @@ -65,7 +65,7 @@ bool CToolNewVertex::isValidChoosePos(const CVector2f &pos) const return _CurrEdge != -1; } -//********************************************************************************************************* +// ********************************************************************************************************* void CToolNewVertex::commit(const NLMISC::CVector &createPosition, float /* createAngle */) { //H_AUTO(R2_CToolNewVertex_commit) @@ -96,14 +96,14 @@ void CToolNewVertex::commit(const NLMISC::CVector &createPosition, float /* crea delete wp; } -//********************************************************************************************************* +// ********************************************************************************************************* const char *CToolNewVertex::getToolUIName() const { //H_AUTO(R2_CToolNewVertex_getToolUIName) return "new_vertex"; } -//********************************************************************************************************* +// ********************************************************************************************************* bool CToolNewVertex::onDeleteCmd() { //H_AUTO(R2_CToolNewVertex_onDeleteCmd) diff --git a/code/ryzom/client/src/r2/tool_pick.cpp b/code/ryzom/client/src/r2/tool_pick.cpp index 1030aeb08..3f81fc672 100644 --- a/code/ryzom/client/src/r2/tool_pick.cpp +++ b/code/ryzom/client/src/r2/tool_pick.cpp @@ -27,7 +27,7 @@ using namespace NLMISC; namespace R2 { -//********************************************** +// ********************************************** CToolPick::CToolPick(const std::string &cursCanPickInstance, const std::string &cursCannotPickInstance, const std::string &cursCanPickPos, @@ -43,7 +43,7 @@ CToolPick::CToolPick(const std::string &cursCanPickInstance, _WantMouseUp = wantMouseUp; } -//********************************************** +// ********************************************** void CToolPick::setIgnoreInstances(const std::string & ignoreInstances) { //H_AUTO(R2_CToolPick_setIgnoreInstances) @@ -81,7 +81,7 @@ void CToolPick::setIgnoreInstances(const std::string & ignoreInstances) } } -//********************************************** +// ********************************************** void CToolPick::updateAfterRender() { //H_AUTO(R2_CToolPick_updateAfterRender) @@ -138,7 +138,7 @@ void CToolPick::updateAfterRender() } } -//********************************************** +// ********************************************** bool CToolPick::onMouseRightButtonClicked() { //H_AUTO(R2_CToolPick_onMouseRightButtonClicked) @@ -147,7 +147,7 @@ bool CToolPick::onMouseRightButtonClicked() return true; } -//********************************************** +// ********************************************** bool CToolPick::validate() { //H_AUTO(R2_CToolPick_validate) @@ -166,7 +166,7 @@ bool CToolPick::validate() return true; } -//********************************************** +// ********************************************** bool CToolPick::onMouseLeftButtonDown() { //H_AUTO(R2_CToolPick_onMouseLeftButtonDown) @@ -174,7 +174,7 @@ bool CToolPick::onMouseLeftButtonDown() return validate(); } -//********************************************** +// ********************************************** bool CToolPick::onMouseLeftButtonClicked() { //H_AUTO(R2_CToolPick_onMouseLeftButtonClicked) @@ -182,7 +182,7 @@ bool CToolPick::onMouseLeftButtonClicked() return validate(); } -//********************************************** +// ********************************************** int CToolPick::luaPick(CLuaState &ls) { //H_AUTO(R2_CToolPick_luaPick) @@ -191,7 +191,7 @@ int CToolPick::luaPick(CLuaState &ls) return 0; } -//********************************************** +// ********************************************** int CToolPick::luaCanPick(CLuaState &ls) { //H_AUTO(R2_CToolPick_luaCanPick) diff --git a/code/ryzom/client/src/r2/tool_select_move.cpp b/code/ryzom/client/src/r2/tool_select_move.cpp index fbb8bcae7..1ad9fd797 100644 --- a/code/ryzom/client/src/r2/tool_select_move.cpp +++ b/code/ryzom/client/src/r2/tool_select_move.cpp @@ -38,7 +38,7 @@ using namespace NLMISC; namespace R2 { -//*************************************************************** +// *************************************************************** CToolSelectMove::CToolSelectMove() { _MouseX = -1; @@ -57,7 +57,7 @@ CToolSelectMove::CToolSelectMove() } -//*************************************************************** +// *************************************************************** bool CToolSelectMove::checkAdditionnalRoomLeftFor(CInstance &instance) { //H_AUTO(R2_CToolSelectMove_checkAdditionnalRoomLeftFor) @@ -86,7 +86,7 @@ bool CToolSelectMove::checkAdditionnalRoomLeftFor(CInstance &instance) } -//*************************************************************** +// *************************************************************** CInstance *CToolSelectMove::createGhost(CInstance &instance) { //H_AUTO(R2_CToolSelectMove_createGhost) @@ -139,7 +139,7 @@ CInstance *CToolSelectMove::createGhost(CInstance &instance) return NULL; } -//*************************************************************** +// *************************************************************** void CToolSelectMove::beginAction(CInstance &instance) { _DeltaAnchor.set(0, 0, 0); @@ -265,7 +265,7 @@ void CToolSelectMove::beginAction(CInstance &instance) dv->setMoveInProgress(true); } -//*************************************************************** +// *************************************************************** void CToolSelectMove::cancelAction(CInstance &instance) { //H_AUTO(R2_CToolSelectMove_cancelAction) @@ -291,7 +291,7 @@ void CToolSelectMove::cancelAction(CInstance &instance) _Duplicating = false; } -//*************************************************************** +// *************************************************************** void CToolSelectMove::commitAction(CInstance &instance) { //H_AUTO(R2_CToolSelectMove_commitAction) @@ -435,14 +435,14 @@ void CToolSelectMove::commitAction(CInstance &instance) } } -//*************************************************************** +// *************************************************************** const char *CToolSelectMove::getCursorForPossibleAction() const { //H_AUTO(R2_CToolSelectMove_getCursorForPossibleAction) return isShiftDown() ? "curs_can_pan_dup.tga" : "curs_can_pan.tga"; } -//*************************************************************** +// *************************************************************** const char *CToolSelectMove::getDefaultCursor() const { //H_AUTO(R2_CToolSelectMove_getDefaultCursor) @@ -450,7 +450,7 @@ const char *CToolSelectMove::getDefaultCursor() const return isShiftDown() ? "curs_dup.tga" : DEFAULT_CURSOR; } -//*************************************************************** +// *************************************************************** const char *CToolSelectMove::getPickCursor() const { //H_AUTO(R2_CToolSelectMove_getPickCursor) @@ -458,7 +458,7 @@ const char *CToolSelectMove::getPickCursor() const } -//*************************************************************** +// *************************************************************** void CToolSelectMove::updateAction(CInstance &instance) { //H_AUTO(R2_CToolSelectMove_updateAction) @@ -647,7 +647,7 @@ void CToolSelectMove::updateAction(CInstance &instance) */ } -//*************************************************************** +// *************************************************************** void CToolSelectMove::setInstancePos(const NLMISC::CVectorD &pos, CInstance &instance) { //H_AUTO(R2_CToolSelectMove_setInstancePos) @@ -658,7 +658,7 @@ void CToolSelectMove::setInstancePos(const NLMISC::CVectorD &pos, CInstance &ins delete newPos; } -//*************************************************************** +// *************************************************************** bool CToolSelectMove::isActionPossibleOn(const CInstance &instance) const { //H_AUTO(R2_CToolSelectMove_isActionPossibleOn) @@ -681,14 +681,14 @@ bool CToolSelectMove::isActionPossibleOn(const CInstance &instance) const return true; } -//*************************************************************** +// *************************************************************** void CToolSelectMove::onActivate() { //H_AUTO(R2_CToolSelectMove_onActivate) setContextHelp(CI18N::get("uiR2EDToolSelectMove")); } -//*************************************************************** +// *************************************************************** void CToolSelectMove::updateBeforeRender() { //H_AUTO(R2_CToolSelectMove_updateBeforeRender) diff --git a/code/ryzom/client/src/r2/tool_select_rotate.cpp b/code/ryzom/client/src/r2/tool_select_rotate.cpp index 17bb17390..2f728d728 100644 --- a/code/ryzom/client/src/r2/tool_select_rotate.cpp +++ b/code/ryzom/client/src/r2/tool_select_rotate.cpp @@ -34,7 +34,7 @@ using namespace NLMISC; namespace R2 { -//*************************************************************** +// *************************************************************** CToolSelectRotate::CToolSelectRotate() { _StartAngle = 0; @@ -43,7 +43,7 @@ CToolSelectRotate::CToolSelectRotate() } -//*************************************************************** +// *************************************************************** void CToolSelectRotate::updateAction(CInstance &instance) { //H_AUTO(R2_CToolSelectRotate_updateAction) @@ -56,7 +56,7 @@ void CToolSelectRotate::updateAction(CInstance &instance) } -//*************************************************************** +// *************************************************************** void CToolSelectRotate::setRotateInProgress(bool rotateInProgress, CInstance &instance) { //H_AUTO(R2_CToolSelectRotate_setRotateInProgress) @@ -64,7 +64,7 @@ void CToolSelectRotate::setRotateInProgress(bool rotateInProgress, CInstance &in if (dv) dv->setRotateInProgress(rotateInProgress); } -//*************************************************************** +// *************************************************************** void CToolSelectRotate::beginAction(CInstance &instance) { //H_AUTO(R2_CToolSelectRotate_beginAction) @@ -73,7 +73,7 @@ void CToolSelectRotate::beginAction(CInstance &instance) setRotateInProgress(true, instance); } -//*************************************************************** +// *************************************************************** void CToolSelectRotate::cancelAction(CInstance &instance) { //H_AUTO(R2_CToolSelectRotate_cancelAction) @@ -83,7 +83,7 @@ void CToolSelectRotate::cancelAction(CInstance &instance) setRotateInProgress(false, instance); } -//*************************************************************** +// *************************************************************** void CToolSelectRotate::commitAction(CInstance &instance) { //H_AUTO(R2_CToolSelectRotate_commitAction) @@ -93,7 +93,7 @@ void CToolSelectRotate::commitAction(CInstance &instance) setRotateInProgress(false, instance); } -//*************************************************************** +// *************************************************************** void CToolSelectRotate::setEntityAngle(CEntityCL &/* entity */, CInstance &instance, float angle) { //H_AUTO(R2_CToolSelectRotate_setEntityAngle) @@ -102,7 +102,7 @@ void CToolSelectRotate::setEntityAngle(CEntityCL &/* entity */, CInstance &insta delete angleObject; } -//*************************************************************** +// *************************************************************** bool CToolSelectRotate::isActionPossibleOn(const CInstance &instance) const { //H_AUTO(R2_CToolSelectRotate_isActionPossibleOn) @@ -119,7 +119,7 @@ bool CToolSelectRotate::isActionPossibleOn(const CInstance &instance) const return false; } -//*************************************************************** +// *************************************************************** bool CToolSelectRotate::onMouseLeftButtonDown() { //H_AUTO(R2_CToolSelectRotate_onMouseLeftButtonDown) diff --git a/code/ryzom/client/src/r2/verbose_clock.cpp b/code/ryzom/client/src/r2/verbose_clock.cpp index 2fc89560b..f994b0d02 100644 --- a/code/ryzom/client/src/r2/verbose_clock.cpp +++ b/code/ryzom/client/src/r2/verbose_clock.cpp @@ -25,7 +25,7 @@ using namespace NLMISC; namespace R2 { -//********************************************************************************************************* +// ********************************************************************************************************* CVerboseClock::CVerboseClock(const std::string &msg) { _Msg = msg; @@ -33,7 +33,7 @@ CVerboseClock::CVerboseClock(const std::string &msg) } -//********************************************************************************************************* +// ********************************************************************************************************* CVerboseClock::~CVerboseClock() { TTime endTime = CTime::getLocalTime(); @@ -43,7 +43,7 @@ CVerboseClock::~CVerboseClock() } } -//********************************************************************************************************* +// ********************************************************************************************************* CPreciseClock::CPreciseClock(const std::string &msg) { _Msg = msg; @@ -51,7 +51,7 @@ CPreciseClock::CPreciseClock(const std::string &msg) } -//********************************************************************************************************* +// ********************************************************************************************************* CPreciseClock::~CPreciseClock() { TTicks endTime = CTime::getPerformanceTime(); diff --git a/code/ryzom/client/src/rosace.cpp b/code/ryzom/client/src/rosace.cpp index 5e097a74f..5f6c038a7 100644 --- a/code/ryzom/client/src/rosace.cpp +++ b/code/ryzom/client/src/rosace.cpp @@ -245,6 +245,8 @@ void CRosacePage::update(float x, float y, TMode mode) case NbRosaceMode: nlwarning("Rosace Mode reached."); break; + default: + break; } }// update // diff --git a/code/ryzom/client/src/scalable_time.cpp b/code/ryzom/client/src/scalable_time.cpp index 269886612..1bc0e15a0 100644 --- a/code/ryzom/client/src/scalable_time.cpp +++ b/code/ryzom/client/src/scalable_time.cpp @@ -21,7 +21,7 @@ #include "time_client.h" #include "nel/misc/time_nl.h" -//************************************************************************************************* +// ************************************************************************************************* CScalableTime::CScalableTime() { _LastPerformanceTime = NLMISC::CTime::getPerformanceTime(); @@ -29,27 +29,27 @@ CScalableTime::CScalableTime() _TimeScale = 1.f; } -//************************************************************************************************* +// ************************************************************************************************* TTime CScalableTime::getScaledLocalTime() { update(); return (TTime) (NLMISC::CTime::ticksToSecond ((NLMISC::TTicks) _ScaledPerformanceTime) * 1000.0); } -//************************************************************************************************* +// ************************************************************************************************* NLMISC::TTicks CScalableTime::getScaledPerformanceTime() { update(); return (NLMISC::TTicks) _ScaledPerformanceTime; } -//************************************************************************************************* +// ************************************************************************************************* void CScalableTime::setTimeScale(float scale) { _TimeScale = std::max(0.f, scale); } -//************************************************************************************************* +// ************************************************************************************************* void CScalableTime::update() { NLMISC::TTicks dt = NLMISC::CTime::getPerformanceTime() - _LastPerformanceTime; diff --git a/code/ryzom/client/src/session_browser_impl.cpp b/code/ryzom/client/src/session_browser_impl.cpp index 6061d8e36..00ca1ab55 100644 --- a/code/ryzom/client/src/session_browser_impl.cpp +++ b/code/ryzom/client/src/session_browser_impl.cpp @@ -29,7 +29,7 @@ using namespace R2; CVariable SBSPortOffset("client", "SBSPortOffset", "Offset of the SBS port from the FS port", 1000, 0, true); -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::init(CLuaState *ls) { if (ls != NULL) @@ -66,7 +66,7 @@ void CSessionBrowserImpl::init(CLuaState *ls) } -//*************************************************************************** +// *************************************************************************** const NLNET::CLoginCookie &CSessionBrowserImpl::getCookie() { /*if (CInterfaceManager::getInstance()->isInGame()) @@ -77,7 +77,7 @@ const NLNET::CLoginCookie &CSessionBrowserImpl::getCookie() return FakeCookie; // TMP TMP : for Nico's test*/ } -//**************************************************************************** +// **************************************************************************** const std::string &CSessionBrowserImpl::getFrontEndAddress() { if (!NetMngr.getFrontendAddress().empty()) @@ -88,14 +88,14 @@ const std::string &CSessionBrowserImpl::getFrontEndAddress() return testAddress; // TMP TMP : for Nico's test } -//**************************************************************************** +// **************************************************************************** uint32 CSessionBrowserImpl::getCharId() { if (ClientCfg.Local) return 0; return (getCookie().getUserId() << 4) + (uint32) PlayerSelectedSlot; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaGetRingSessionList(CLuaState &ls) { nldebug("SB: luaGetRingSessionList"); @@ -105,7 +105,7 @@ int CSessionBrowserImpl::luaGetRingSessionList(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaGetRingCharList(CLuaState &ls) { nldebug("SB: luaGetRingCharList"); @@ -117,7 +117,7 @@ int CSessionBrowserImpl::luaGetRingCharList(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaGetRingStats(CLuaState &ls) { nldebug("SB: luaGetRingStats"); @@ -127,7 +127,7 @@ int CSessionBrowserImpl::luaGetRingStats(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaGetScenarioScores(CLuaState &ls) { nldebug("SB: luaGetScenarioScores"); @@ -139,7 +139,7 @@ int CSessionBrowserImpl::luaGetScenarioScores(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaGetSessionAverageScores(CLuaState &ls) { nldebug("SB: luaGetSessionAverageScores"); @@ -151,7 +151,7 @@ int CSessionBrowserImpl::luaGetSessionAverageScores(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaGetScenarioAverageScores(CLuaState &ls) { nldebug("SB: luaGetScenarioAverageScores"); @@ -164,7 +164,7 @@ int CSessionBrowserImpl::luaGetScenarioAverageScores(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaUpdateScenarioScores(CLuaState &ls) { nldebug("SB: luaUpdateScenarioScores"); @@ -185,7 +185,7 @@ int CSessionBrowserImpl::luaUpdateScenarioScores(CLuaState &ls) return 0; } -//**************************************************************************** +// **************************************************************************** int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls) { nldebug("SB: luaJoinRingSession"); @@ -213,7 +213,7 @@ int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls) return 0; } -//***************************************************************************** +// ***************************************************************************** int CSessionBrowserImpl::luaCheckRingAccess(CLuaState &ls) { lua_State* state = ls.getStatePointer(); @@ -221,7 +221,7 @@ int CSessionBrowserImpl::luaCheckRingAccess(CLuaState &ls) } -//***************************************************************************** +// ***************************************************************************** int CSessionBrowserImpl::luaGetFileHeader(CLuaState &ls) { lua_State* state = ls.getStatePointer(); @@ -229,28 +229,28 @@ int CSessionBrowserImpl::luaGetFileHeader(CLuaState &ls) } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_connectionFailed() { nldebug("SB: on_connectionFailed"); callRingAccessPointMethod("onConnectionFailed", 0, 0); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_CRingSessionManagerWebClient_Disconnection(NLNET::TSockId /* from */) { nldebug("SB: on_CRingSessionManagerWebClient_Disconnection"); callRingAccessPointMethod("onDisconnection", 0, 0); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_connectionClosed() { nldebug("SB: on_connectionClosed"); callRingAccessPointMethod("onConnectionClosed", 0, 0); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_invokeResult(NLNET::TSockId /* from */, uint32 /* userId */, uint32 resultCode, const std::string &resultString) { nldebug("SB: on_invokeResult : result = %u, msg='%s'", resultCode, resultString.c_str()); @@ -259,7 +259,7 @@ void CSessionBrowserImpl::on_invokeResult(NLNET::TSockId /* from */, uint32 /* u _LastInvokeResultMsg = resultString; } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_scheduleSessionResult(NLNET::TSockId /* from */, uint32 charId, TSessionId sessionId, uint8 result, const std::string &resultString) { nldebug("SB: on_scheduleSessionResult : result = %u, msg = '%s'", result, resultString.c_str()); @@ -282,7 +282,7 @@ void CSessionBrowserImpl::on_scheduleSessionResult(NLNET::TSockId /* from */, ui // } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_sessionInfoResult(NLNET::TSockId from, uint32 charId, TSessionId sessionId, const RSMGR::TRaceFilter &raceFilter, const RSMGR::TReligionFilter &religionFilter, const RSMGR::TGuildFilter &guildFilter, const RSMGR::TShardFilter &shardFilter, const RSMGR::TLevelFilter &levelFilter, bool subscriptionClosed, bool autoInvite, const std::string &language, const TSessionOrientation &/* orientation */, const std::string &description) @@ -298,7 +298,7 @@ void CSessionBrowserImpl::on_sessionInfoResult(NLNET::TSockId from, uint32 charI _LastDescription = description; } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_joinSessionResult(NLNET::TSockId /* from */, uint32 /* userId */, TSessionId sessionId, uint32 result, const std::string &shardAddr, const RSMGR::TSessionPartStatus &participantStatus) { nldebug("SB: on_joinSessionResult : result = %u; msg = '%s'", result, shardAddr.c_str()); @@ -315,7 +315,7 @@ void CSessionBrowserImpl::on_joinSessionResult(NLNET::TSockId /* from */, uint32 } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_joinSessionResultExt(NLNET::TSockId from, uint32 userId, TSessionId sessionId, uint32 result, const std::string &shardAddr, const RSMGR::TSessionPartStatus &participantStatus, const CSecurityCode& securityCode) { nldebug("SB: on_joinSessionResultExt : result = %u, msg = '%s'", result, shardAddr.c_str()); @@ -324,27 +324,27 @@ void CSessionBrowserImpl::on_joinSessionResultExt(NLNET::TSockId from, uint32 us on_joinSessionResult(from, userId, sessionId, result, shardAddr, participantStatus); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_getShardsResult(NLNET::TSockId /* from */, uint32 /* userId */, const std::string &/* result */) { nldebug("SB: on_getShardsResult"); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_CSessionBrowserServerWebClient_Disconnection(NLNET::TSockId /* from */) { nldebug("SB: on_CSessionBrowserServerWebClient_Disconnection"); callRingAccessPointMethod("onDisconnection", 0, 0); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_sessionList(NLNET::TSockId /* from */, uint32 /* charId */, const std::vector &sessions) { nldebug("SB: on_sessionList"); fill(sessions); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::fill(const std::vector &sessions) { // build datas & send to lua @@ -418,7 +418,7 @@ void CSessionBrowserImpl::fill(const std::vector &session } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::playerRatingFill(bool scenarioRated, uint32 rateFun, uint32 rateDifficulty, uint32 rateAccessibility, uint32 rateOriginality, uint32 rateDirection) { nlassert(_Lua); @@ -445,7 +445,7 @@ void CSessionBrowserImpl::playerRatingFill(bool scenarioRated, uint32 rateFun, u } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::averageScoresFill(bool scenarioRated, uint32 rateFun, uint32 rateDifficulty, uint32 rateAccessibility, uint32 rateOriginality, uint32 rateDirection, uint32 rrpTotal) { nlassert(_Lua); @@ -474,7 +474,7 @@ void CSessionBrowserImpl::averageScoresFill(bool scenarioRated, uint32 rateFun, } -//**************************************************************************** +// **************************************************************************** static RSMGR::TSessionDesc buildSession(uint32 id, const std::string &owner, const std::string &title, const std::string &description, uint32 level, uint32 playerCount, const std::string &/* language */, uint32 launchTime, bool dm, bool invited) { RSMGR::TSessionDesc result; @@ -490,7 +490,7 @@ static RSMGR::TSessionDesc buildSession(uint32 id, const std::string &owner, con return result; } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::testFill() { std::vector sessions; @@ -514,27 +514,27 @@ void CSessionBrowserImpl::testFill() fill(sessions); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_charList(NLNET::TSockId /* from */, uint32 /* charId */, TSessionId /* sessionId */, const std::vector &chars) { nldebug("SB: on_charList"); charsFill(chars); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_playerRatings(NLNET::TSockId /* from */, uint32 /* charId */, bool scenarioRated, uint32 rateFun, uint32 rateDifficulty, uint32 rateAccessibility, uint32 rateOriginality, uint32 rateDirection) { playerRatingFill(scenarioRated, rateFun, rateDifficulty, rateAccessibility, rateOriginality, rateDirection); } -//**************************************************************************** +// **************************************************************************** // Return average scores of a session void CSessionBrowserImpl::on_sessionAverageScores(NLNET::TSockId /* from */, bool scenarioRated, uint32 rateFun, uint32 rateDifficulty, uint32 rateAccessibility, uint32 rateOriginality, uint32 rateDirection, uint32 rrpTotal) { averageScoresFill(scenarioRated, rateFun, rateDifficulty, rateAccessibility, rateOriginality, rateDirection, rrpTotal); } -//**************************************************************************** +// **************************************************************************** // Return average scores of a scenario void CSessionBrowserImpl::on_scenarioAverageScores(NLNET::TSockId /* from */, bool scenarioRated, uint32 rateFun, uint32 rateDifficulty, uint32 rateAccessibility, uint32 rateOriginality, uint32 rateDirection, uint32 rrpTotal) { @@ -564,7 +564,7 @@ void CSessionBrowserImpl::on_scenarioAverageScores(NLNET::TSockId /* from */, bo } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_ringRatings(NLNET::TSockId /* from */, uint32 /* charId */, uint32 authorRating, uint32 AMRating, uint32 masterlessRating) { _LastAuthorRating = authorRating; @@ -573,7 +573,7 @@ void CSessionBrowserImpl::on_ringRatings(NLNET::TSockId /* from */, uint32 /* ch ringStatsFill(); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::on_ringPoints(NLNET::TSockId /* from */, uint32 /* charId */, const std::string &ringPoints, const std::string &maxRingPoints) { _LastRingPoints = ringPoints; @@ -581,7 +581,7 @@ void CSessionBrowserImpl::on_ringPoints(NLNET::TSockId /* from */, uint32 /* cha ringStatsFill(); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::charsFill(const std::vector &chars) { // build datas & send to lua @@ -638,7 +638,7 @@ void CSessionBrowserImpl::charsFill(const std::vector &chars } } -//**************************************************************************** +// **************************************************************************** inline double ecoRingPoints(const std::string & ecoPoints, char * c) { @@ -697,7 +697,7 @@ void CSessionBrowserImpl::ringStatsFill() } } -//**************************************************************************** +// **************************************************************************** static RSMGR::TCharDesc buildChar(uint32 id, const std::string &charName, const std::string &guild, TRace race, TCult cult, uint32 shardId, TSessionLevel level, bool connected) { @@ -713,7 +713,7 @@ static RSMGR::TCharDesc buildChar(uint32 id, const std::string &charName, const return result; } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::testCharsFill() { std::vector chars; @@ -736,7 +736,7 @@ void CSessionBrowserImpl::testCharsFill() charsFill(chars); } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::callRingAccessPointMethod(const char *name, int numArg, int numResult) { // when you load an animation, lua state isn't initialized for a short time @@ -751,7 +751,7 @@ void CSessionBrowserImpl::callRingAccessPointMethod(const char *name, int numArg } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::callRingCharTrackingMethod(const char *name, int numArg, int numResult) { // when you load an animation, lua state isn't initialized for a short time @@ -766,7 +766,7 @@ void CSessionBrowserImpl::callRingCharTrackingMethod(const char *name, int numAr } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::callRingPlayerInfoMethod(const char *name, int numArg, int numResult) { // when you load an animation, lua state isn't initialized for a short time @@ -781,7 +781,7 @@ void CSessionBrowserImpl::callRingPlayerInfoMethod(const char *name, int numArg, } } -//**************************************************************************** +// **************************************************************************** void CSessionBrowserImpl::callScenarioScoresMethod(const char *name, int numArg, int numResult) { // when you load an animation, lua state isn't initialized for a short time diff --git a/code/ryzom/client/src/seven_zip/CMakeLists.txt b/code/ryzom/client/src/seven_zip/CMakeLists.txt index 6182eed5d..f116006d6 100644 --- a/code/ryzom/client/src/seven_zip/CMakeLists.txt +++ b/code/ryzom/client/src/seven_zip/CMakeLists.txt @@ -6,21 +6,28 @@ LIST(REMOVE_ITEM LIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/7zMain.cpp) ADD_EXECUTABLE(7zDec ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(7zDec ${PLATFORM_LINKFLAGS} ${LIBXML2_LIBRARIES} ${NELMISC_LIBRARY}) +INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +TARGET_LINK_LIBRARIES(7zDec ${PLATFORM_LINKFLAGS} ${NELMISC_LIBRARY}) -ADD_LIBRARY(seven_zip STATIC ${LIB_SRC}) -TARGET_LINK_LIBRARIES(seven_zip ${PLATFORM_LINKFLAGS}) +IF(NOT WIN32) + ADD_LIBRARY(ryzom_sevenzip SHARED ${LIB_SRC}) +ELSE(NOT WIN32) + ADD_LIBRARY(ryzom_sevenzip STATIC ${LIB_SRC}) +ENDIF(NOT WIN32) + +TARGET_LINK_LIBRARIES(ryzom_sevenzip ${PLATFORM_LINKFLAGS}) +SET_TARGET_PROPERTIES(ryzom_sevenzip PROPERTIES VERSION ${NL_VERSION}) IF(WIN32) SET_TARGET_PROPERTIES(seven_zip PROJECT_LABEL "Library: Seven Zip" DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:libc;libcmt;libcmtd;msvcrt" - LINK_FLAGS_RELEASE "/NODEFAULTLIB:libc;libcmt;libcmtd;msvcrtd") + LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt" ENDIF(WIN32) -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -D_SZ_ONE_DIRECTORY) +ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY) + +INSTALL(TARGETS ryzom_sevenzip LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) INSTALL(TARGETS 7zDec RUNTIME DESTINATION bin COMPONENT client) diff --git a/code/ryzom/client/src/sky.cpp b/code/ryzom/client/src/sky.cpp index a37ed77a3..d641d584f 100644 --- a/code/ryzom/client/src/sky.cpp +++ b/code/ryzom/client/src/sky.cpp @@ -38,7 +38,7 @@ using namespace NLMISC; H_AUTO_DECL ( RZ_Client_Render_Sky ) -//************************************************************************************************* +// ************************************************************************************************* CSky::CSky() { _Scene = NULL; @@ -57,13 +57,13 @@ CSky::CSky() _WaterEnvMapAlpha = 255; } -//************************************************************************************************* +// ************************************************************************************************* CSky::~CSky() { release(); } -//************************************************************************************************* +// ************************************************************************************************* void CSky::release() { if (_PlayListManager) @@ -99,7 +99,7 @@ void CSky::release() } } -//************************************************************************************************* +// ************************************************************************************************* void CSky::init(UDriver *drv, const CSkySheet &sheet, bool forceFallbackVersion /*= false*/, float numHourInDay /*= 24.f*/, std::vector *unsupportedObjects /*= NULL*/) { release(); @@ -226,7 +226,7 @@ void CSky::init(UDriver *drv, const CSkySheet &sheet, bool forceFallbackVersion _WaterEnvMapAlpha= sheet.WaterEnvMapAlpha; } -//************************************************************************************************* +// ************************************************************************************************* uint CSky::setup(const CClientDate &date, const CClientDate &animationDate, float weatherLevel, CRGBA fogColor, const NLMISC::CVector &sunLightDir, bool envMapScene) { if (!_Scene) return 0; @@ -268,7 +268,7 @@ uint CSky::setup(const CClientDate &date, const CClientDate &animationDate, floa return numVisibleObjects; } -//************************************************************************************************* +// ************************************************************************************************* NLMISC::CRGBA CSky::computeFogColor(const CClientDate &date, float weatherLevel) const { if (!_FogColor) return CRGBA::White; @@ -279,7 +279,7 @@ NLMISC::CRGBA CSky::computeFogColor(const CClientDate &date, float weatherLevel) } -//************************************************************************************************* +// ************************************************************************************************* CBitmap *buildSharedBitmap(const std::string &filename, std::map &bitmapByName, std::vector &builtBitmaps, diff --git a/code/ryzom/client/src/sky_object.cpp b/code/ryzom/client/src/sky_object.cpp index ef2095085..3a284612a 100644 --- a/code/ryzom/client/src/sky_object.cpp +++ b/code/ryzom/client/src/sky_object.cpp @@ -33,7 +33,7 @@ using namespace NL3D; // CSkyObject::CColorInfo // //////////////////////////// -//************************************************************************************************* +// ************************************************************************************************* void CSkyObject::CColorInfo::init(const CSkyObjectSheet::CColorInfoSheet &ci, std::map &bitmapByName, std::vector &builtBitmaps) @@ -43,7 +43,7 @@ void CSkyObject::CColorInfo::init(const CSkyObjectSheet::CColorInfoSheet &ci, Map = buildSharedBitmap(ci.MapName, bitmapByName, builtBitmaps, alreadyBuilt); } -//************************************************************************************************* +// ************************************************************************************************* CRGBA CSkyObject::CColorInfo::computeColor(float dayPart, float weatherLevel, CRGBA fogColor) { switch(Mode) @@ -73,7 +73,7 @@ CRGBA CSkyObject::CColorInfo::computeColor(float dayPart, float weatherLevel, CR } -//************************************************************************************************* +// ************************************************************************************************* //////////////////////////////////// // CSkyObject::CColorGradientInfo // //////////////////////////////////// @@ -131,7 +131,7 @@ static void dumpGrad(CBitmap &bm) */ -//************************************************************************************************* +// ************************************************************************************************* void CSkyObject::CColorGradientInfo::setup(NL3D::UInstance instance, float dayPart, float weatherLevel, CBitmap &gradientCache, CBitmap &gradientCacheBlurred) { if (instance.empty()) return; @@ -214,7 +214,7 @@ void CSkyObject::CColorGradientInfo::setup(NL3D::UInstance instance, float dayPa } } -//************************************************************************************************* +// ************************************************************************************************* //////////////// // CSkyObject // //////////////// @@ -266,7 +266,7 @@ void CSkyObject::init(const CSkyObjectSheet::CVersionSheet &sheet, } -//************************************************************************************************* +// ************************************************************************************************* bool CSkyObject::setup(const CClientDate &date, const CClientDate &animationDate, float numHoursInDay, float weatherLevel, CRGBA fogColor, bool envMapScene) { if (Instance.empty()) return false; @@ -439,7 +439,7 @@ bool CSkyObject::setup(const CClientDate &date, const CClientDate &animationDate return Active; } -//************************************************************************************************* +// ************************************************************************************************* CSkyObject::~CSkyObject() { } diff --git a/code/ryzom/client/src/timed_fx_manager.cpp b/code/ryzom/client/src/timed_fx_manager.cpp index 1c0e662d3..958d84426 100644 --- a/code/ryzom/client/src/timed_fx_manager.cpp +++ b/code/ryzom/client/src/timed_fx_manager.cpp @@ -73,7 +73,7 @@ const float DEFAULT_SPAWNED_FX_TIMED_OUT = 100.f; H_AUTO_DECL(RZ_TimedFX) -//******************************************************************************************* +// ******************************************************************************************* NLMISC::CMatrix CTimedFX::getInstanceMatrix() const { FPU_CHECKER @@ -87,7 +87,7 @@ NLMISC::CMatrix CTimedFX::getInstanceMatrix() const } -//******************************************************************************************* +// ******************************************************************************************* CTimedFXManager::CTimedFXManager() { FPU_CHECKER @@ -101,7 +101,7 @@ CTimedFXManager::CTimedFXManager() _MaxNumberOfFXInstances = 0; } -//******************************************************************************************* +// ******************************************************************************************* CTimedFXManager::~CTimedFXManager() { FPU_CHECKER @@ -109,7 +109,7 @@ CTimedFXManager::~CTimedFXManager() reset(); } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::init(NL3D::UScene *scene, const CClientDate &startDate, float /* dayLength */, @@ -141,7 +141,7 @@ void CTimedFXManager::init(NL3D::UScene *scene, } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::reset() { FPU_CHECKER @@ -161,7 +161,7 @@ void CTimedFXManager::reset() } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::setDate(const CClientDate &date) { FPU_CHECKER @@ -169,7 +169,7 @@ void CTimedFXManager::setDate(const CClientDate &date) _CurrDate = date; } -//******************************************************************************************* +// ******************************************************************************************* CTimedFXManager::TFXGroupHandle CTimedFXManager::add(const std::vector &fxs, EGSPD::CSeason::TSeason /* season */) { FPU_CHECKER @@ -316,7 +316,7 @@ CTimedFXManager::TFXGroupHandle CTimedFXManager::add(const std::vector -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::remove(TFXGroupHandle handle) { FPU_CHECKER @@ -346,7 +346,7 @@ void CTimedFXManager::remove(TFXGroupHandle handle) } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::update(const CClientDate &date, EGSPD::CSeason::TSeason /* season */, const NLMISC::CVector &camPos) { FPU_CHECKER @@ -475,7 +475,7 @@ void CTimedFXManager::update(const CClientDate &date, EGSPD::CSeason::TSeason /* } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::shutDown(TFXGroupHandle handle) { FPU_CHECKER @@ -493,7 +493,7 @@ void CTimedFXManager::shutDown(TFXGroupHandle handle) } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::CManagedFX::unlinkFromCandidateFXList() { FPU_CHECKER @@ -510,7 +510,7 @@ void CTimedFXManager::CManagedFX::unlinkFromCandidateFXList() } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::CManagedFX::unlinkFromInstanciatedFXList() { FPU_CHECKER @@ -527,7 +527,7 @@ void CTimedFXManager::CManagedFX::unlinkFromInstanciatedFXList() } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::CManagedFX::shutDown(NL3D::UScene *scene, CFXManager &fxManager) { FPU_CHECKER @@ -563,7 +563,7 @@ void CTimedFXManager::CManagedFX::shutDown(NL3D::UScene *scene, CFXManager &fxMa } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::cycleToDate(sint32 cycle, float hour, float cycleLength, float dayLength, CClientDate &result) { FPU_CHECKER @@ -578,7 +578,7 @@ void CTimedFXManager::cycleToDate(sint32 cycle, float hour, float cycleLength, f result.Hour = (float) (resultHour - (double) result.Day * (double) dayLength); } -//******************************************************************************************* +// ******************************************************************************************* sint32 CTimedFXManager::dateToCycle(const CClientDate &date, float cycleLength, float dayLength) { FPU_CHECKER @@ -590,7 +590,7 @@ sint32 CTimedFXManager::dateToCycle(const CClientDate &date, float cycleLength, } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::CManagedFX::computeHour(sint32 cycle, float bias, CClientDate &resultDate, float cycleLength, float dayLength, const NLMISC::CNoiseValue &nv, float minHour, float maxHour) const { FPU_CHECKER @@ -618,7 +618,7 @@ void CTimedFXManager::CManagedFX::computeHour(sint32 cycle, float bias, CClientD } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::CManagedFX::computeStartHour(sint32 cycle, CClientDate &resultDate, float cycleLength, float dayLength, const NLMISC::CNoiseValue &nv) const { FPU_CHECKER @@ -631,7 +631,7 @@ void CTimedFXManager::CManagedFX::computeStartHour(sint32 cycle, CClientDate &re computeHour(cycle, 0.f, resultDate, cycleLength, dayLength, nv, FXSheet->StartHourMin, FXSheet->StartHourMax); } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::CManagedFX::computeEndHour(sint32 cycle, CClientDate &resultDate, float cycleLength, float dayLength, const NLMISC::CNoiseValue &nv) const { FPU_CHECKER @@ -672,7 +672,7 @@ void CTimedFXManager::CManagedFX::computeEndHour(sint32 cycle, CClientDate &resu } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::dumpFXToAdd() const { FPU_CHECKER @@ -693,7 +693,7 @@ void CTimedFXManager::dumpFXToAdd() const } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::dumpFXToRemove() const { FPU_CHECKER @@ -714,7 +714,7 @@ void CTimedFXManager::dumpFXToRemove() const } } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::dumpFXInfo() const { FPU_CHECKER @@ -737,7 +737,7 @@ void CTimedFXManager::dumpFXInfo() const nlinfo("Num Intanciated FX = %d", (int) numInstance); } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::checkIntegrity() { FPU_CHECKER @@ -772,7 +772,7 @@ void CTimedFXManager::checkIntegrity() } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::setupUserParams(CManagedFX &fi, uint cycle) { FPU_CHECKER @@ -802,7 +802,7 @@ void CTimedFXManager::setupUserParams(CManagedFX &fi, uint cycle) } -//******************************************************************************************* +// ******************************************************************************************* // from a fx mode, get a description string const char *timedFXModeToStr(CSeasonFXSheet::TMode mode) { @@ -819,7 +819,7 @@ const char *timedFXModeToStr(CSeasonFXSheet::TMode mode) return "???"; } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::displayFXBoxes(TDebugDisplayMode displayMode) const { FPU_CHECKER @@ -897,7 +897,7 @@ void CTimedFXManager::displayFXBoxes(TDebugDisplayMode displayMode) const } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::linkCandidateFX(TCandidateFXListSortedByDist &targetList, float dist, CManagedFX *fx) { FPU_CHECKER @@ -915,7 +915,7 @@ void CTimedFXManager::linkCandidateFX(TCandidateFXListSortedByDist &targetList, targetList[rank] = fx; } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::linkInstanciatedFX(CManagedFX *&listHead, CManagedFX *fx) { FPU_CHECKER @@ -931,7 +931,7 @@ void CTimedFXManager::linkInstanciatedFX(CManagedFX *&listHead, CManagedFX *fx) listHead = fx; } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::updateInstanciatedFXList() { FPU_CHECKER @@ -1070,7 +1070,7 @@ void CTimedFXManager::updateInstanciatedFXList() _CandidateFXListTouched = false; } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::updateCandidateFXListSorting() { FPU_CHECKER @@ -1094,7 +1094,7 @@ void CTimedFXManager::updateCandidateFXListSorting() _CandidateFXListSortedByDist.swap(_CandidateFXListSortedByDistTmp); } -//******************************************************************************************* +// ******************************************************************************************* void CTimedFXManager::setMaxNumFXInstances(uint maxNumInstances) { FPU_CHECKER @@ -1103,7 +1103,7 @@ void CTimedFXManager::setMaxNumFXInstances(uint maxNumInstances) _CandidateFXListTouched; } -//******************************************************************************************* +// ******************************************************************************************* // temp, for debug NLMISC_COMMAND(dumpFXToAdd, "dumpFXToAdd", "<>") { @@ -1112,7 +1112,7 @@ NLMISC_COMMAND(dumpFXToAdd, "dumpFXToAdd", "<>") return true; } -//******************************************************************************************* +// ******************************************************************************************* // temp, for debug NLMISC_COMMAND(dumpFXToRemove, "dumpFXToRemove", "<>") { @@ -1122,7 +1122,7 @@ NLMISC_COMMAND(dumpFXToRemove, "dumpFXToRemove", "<>") } -//******************************************************************************************* +// ******************************************************************************************* // temp, for debug NLMISC_COMMAND(dumpFXInfo, "dumpFXInfo", "<>") { @@ -1134,7 +1134,7 @@ NLMISC_COMMAND(dumpFXInfo, "dumpFXInfo", "<>") extern class CIGCallback *IGCallbacks; -//******************************************************************************************* +// ******************************************************************************************* // temp, for debug NLMISC_COMMAND(updateSeason, "updateSeason", "<>") { @@ -1143,7 +1143,7 @@ NLMISC_COMMAND(updateSeason, "updateSeason", "<>") return true; } -//******************************************************************************************* +// ******************************************************************************************* // temp, for debug NLMISC_COMMAND(setMaxNumTimedFXs, "set the max number of timed fx that are visible at a time", "") { diff --git a/code/ryzom/client/src/water_map.cpp b/code/ryzom/client/src/water_map.cpp index ba2e5ca1b..d11a0a6d3 100644 --- a/code/ryzom/client/src/water_map.cpp +++ b/code/ryzom/client/src/water_map.cpp @@ -43,7 +43,7 @@ using namespace NLMISC; H_AUTO_DECL(RZ_WaterMap) -//********************************************************************************************************* +// ********************************************************************************************************* CWaterMap::CWaterMap() { H_AUTO_USE(RZ_WaterMap) @@ -54,7 +54,7 @@ CWaterMap::CWaterMap() } -//********************************************************************************************************* +// ********************************************************************************************************* void CWaterMap::init(const NLMISC::CVector2f &minCorner, const NLMISC::CVector2f &maxCorner, float cellSize /*=20.f*/) { H_AUTO_USE(RZ_WaterMap) @@ -80,7 +80,7 @@ void CWaterMap::init(const NLMISC::CVector2f &minCorner, const NLMISC::CVector2f Scene->setWaterCallback(this); } -//********************************************************************************************************* +// ********************************************************************************************************* void CWaterMap::release() { H_AUTO_USE(RZ_WaterMap) @@ -93,7 +93,7 @@ void CWaterMap::release() Scene->setWaterCallback(NULL); } -//********************************************************************************************************* +// ********************************************************************************************************* bool CWaterMap::getWaterHeight(const NLMISC::CVector2f &pos, float &height, bool &splashEnabled) { H_AUTO_USE(RZ_WaterMap) @@ -122,7 +122,7 @@ bool CWaterMap::getWaterHeight(const NLMISC::CVector2f &pos, float &height, bool return false; } -//********************************************************************************************************* +// ********************************************************************************************************* void CWaterMap::waterSurfaceAdded(const NLMISC::CPolygon2D &shape, const NLMISC::CMatrix &worldMatrix, bool splashEnabled, bool usesSceneWaterEnvMap) { if (ClientCfg.R2EDEnabled) @@ -211,7 +211,7 @@ void CWaterMap::waterSurfaceAdded(const NLMISC::CPolygon2D &shape, const NLMISC: } } -//********************************************************************************************************* +// ********************************************************************************************************* void CWaterMap::waterSurfaceRemoved(bool usesSceneWaterEnvMap) { H_AUTO_USE(RZ_WaterMap) @@ -233,7 +233,7 @@ static const NLMISC::CRGBA DebugCols[] = static const uint NumDebugCols = sizeof(DebugCols) / sizeof(DebugCols[0]); -//********************************************************************************************************* +// ********************************************************************************************************* void CWaterMap::dump(const std::string &filename) { H_AUTO_USE(RZ_WaterMap) @@ -295,7 +295,7 @@ void CWaterMap::dump(const std::string &filename) f.close(); } -//****************************************************************************************************************** +// ****************************************************************************************************************** void CWaterMap::render(const NLMISC::CVector2f &camPos, float maxDist /*=100.f*/) { H_AUTO_USE(RZ_WaterMap) @@ -332,7 +332,7 @@ void CWaterMap::render(const NLMISC::CVector2f &camPos, float maxDist /*=100.f*/ #if !FINAL_VERSION -//****************************************************************************************************************** +// ****************************************************************************************************************** // dump water map in a tga file NLMISC_COMMAND(dumpWaterMap, "dump water map", "") { @@ -342,7 +342,7 @@ NLMISC_COMMAND(dumpWaterMap, "dump water map", "") return true; } -//****************************************************************************************************************** +// ****************************************************************************************************************** // display the water map NLMISC_COMMAND(displayWaterMap, "dump water map", "<0 = on / 1 = off>") { diff --git a/code/ryzom/common/src/game_share/CMakeLists.txt b/code/ryzom/common/src/game_share/CMakeLists.txt index 843e3048a..a9f1ec401 100644 --- a/code/ryzom/common/src/game_share/CMakeLists.txt +++ b/code/ryzom/common/src/game_share/CMakeLists.txt @@ -8,16 +8,16 @@ LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/enum_template.cpp) LIST(REMOVE_ITEM PRIV_H ${CMAKE_CURRENT_SOURCE_DIR}/enum_template.h) IF(WIN32) - ADD_LIBRARY(game_share STATIC ${SRC}) + ADD_LIBRARY(ryzom_gameshare STATIC ${SRC}) ELSE(WIN32) - ADD_LIBRARY(game_share SHARED ${SRC}) + ADD_LIBRARY(ryzom_gameshare SHARED ${SRC}) ENDIF(WIN32) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -TARGET_LINK_LIBRARIES(game_share - ${NELMISC_LIBRARY} ${NELNET_LIBRARY} ${NELLIGO_LIBRARY} ${NELGEORGES_LIBRARY} +TARGET_LINK_LIBRARIES(ryzom_gameshare + ${NELMISC_LIBRARY} ${NELNET_LIBRARY} ${NELLIGO_LIBRARY} ${NELGEORGES_LIBRARY} ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES}) -SET_TARGET_PROPERTIES(game_share PROPERTIES VERSION ${NL_VERSION}) +SET_TARGET_PROPERTIES(ryzom_gameshare PROPERTIES VERSION ${NL_VERSION}) IF(WIN32) # SET_TARGET_PROPERTIES(${GAME_SHARE_LIB} PROPERTIES COMPILE_FLAGS "/Yustdgeorges.h") @@ -26,10 +26,10 @@ IF(WIN32) PROJECT_LABEL "Library: Game Share" DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:libc;libcmt;libcmtd;msvcrt" - LINK_FLAGS_RELEASE "/NODEFAULTLIB:libc;libcmt;libcmtd;msvcrtd") + LINK_FLAGS_DEBUG "/NODEFAULTLIB:msvcrt") ENDIF(WIN32) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -INSTALL(TARGETS game_share LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +INSTALL(TARGETS ryzom_gameshare LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + diff --git a/code/ryzom/common/src/game_share/bg_downloader_msg.cpp b/code/ryzom/common/src/game_share/bg_downloader_msg.cpp index db33b6121..cca585e10 100644 --- a/code/ryzom/common/src/game_share/bg_downloader_msg.cpp +++ b/code/ryzom/common/src/game_share/bg_downloader_msg.cpp @@ -24,7 +24,7 @@ namespace BGDownloader { -extern const char *DownloaderMutexName = "RyzomBgDownloader"; +const char *DownloaderMutexName = "RyzomBgDownloader"; ucstring getWrittenSize(uint32 nSize) { diff --git a/code/ryzom/common/src/game_share/brick_families.h b/code/ryzom/common/src/game_share/brick_families.h index 81d96576a..248d454be 100644 --- a/code/ryzom/common/src/game_share/brick_families.h +++ b/code/ryzom/common/src/game_share/brick_families.h @@ -600,7 +600,7 @@ namespace BRICK_FAMILIES EndBonus = BPBGLA, // TITLE - //****** + // ****** BeginTitle, BPTEA = BeginTitle, EndTitle = BPTEA, diff --git a/code/ryzom/common/src/game_share/crypt.cpp b/code/ryzom/common/src/game_share/crypt.cpp index 42a55e081..7c9fa28fd 100644 --- a/code/ryzom/common/src/game_share/crypt.cpp +++ b/code/ryzom/common/src/game_share/crypt.cpp @@ -403,45 +403,45 @@ static unsigned char PC2[] = { /* permuted choice table 2 */ static unsigned char S[8][64] = { /* 48->32 bit substitution tables */ /* S[1] */ - 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, - 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, - 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, - 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13, + {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, + 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, + 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, + 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}, /* S[2] */ - 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, - 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, - 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, - 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, + {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, + 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, + 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, + 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}, /* S[3] */ - 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, - 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, - 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, - 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, + {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, + 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, + 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, + 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}, /* S[4] */ - 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, - 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, - 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, - 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, + { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, + 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, + 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, + 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}, /* S[5] */ - 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, - 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, - 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, - 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, + { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, + 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, + 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, + 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}, /* S[6] */ - 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, - 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, - 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, - 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, + {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, + 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, + 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, + 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}, /* S[7] */ - 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, - 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, - 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, - 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, + { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, + 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, + 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, + 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}, /* S[8] */ - 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, - 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, - 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, - 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11, + {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, + 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, + 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, + 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11} }; static unsigned char P32Tr[] = { /* 32-bit permutation function */ diff --git a/code/ryzom/common/src/game_share/dms.h b/code/ryzom/common/src/game_share/dms.h index 6ecd37ca2..9347cdeed 100644 --- a/code/ryzom/common/src/game_share/dms.h +++ b/code/ryzom/common/src/game_share/dms.h @@ -80,7 +80,7 @@ namespace R2 public: virtual ~IServerEditionModule(){} virtual void createSessionWithoutSu(uint32 charId, NLMISC::CEntityId clientEid) = 0; - virtual TPioneersSessionsAllowed * const getSessionAllowedForChar(TCharId charId) const = 0; + virtual TPioneersSessionsAllowed * getSessionAllowedForChar(TCharId charId) const = 0; virtual CScenario* getScenarioById(TSessionId sessionId) const = 0; // getEditing position (use AdminModule::getPosition for having a position in editing and animation mode) virtual bool getPosition(TSessionId sessionId, double& x, double& y, double& orient, uint8& season, uint32 locationIndex = 0) = 0; diff --git a/code/ryzom/common/src/game_share/game_share.vcproj b/code/ryzom/common/src/game_share/game_share.vcproj index 3e699d301..9c336674c 100644 --- a/code/ryzom/common/src/game_share/game_share.vcproj +++ b/code/ryzom/common/src/game_share/game_share.vcproj @@ -86,75 +86,6 @@ Name="VCPostBuildEventTool" /> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/common/src/game_share/magic_fx.cpp b/code/ryzom/common/src/game_share/magic_fx.cpp index 5f2caa752..ac4e604df 100644 --- a/code/ryzom/common/src/game_share/magic_fx.cpp +++ b/code/ryzom/common/src/game_share/magic_fx.cpp @@ -45,7 +45,7 @@ namespace MAGICFX NL_STRING_CONVERSION_TABLE_ENTRY (UnknownSpellCastStage) NL_END_STRING_CONVERSION_TABLE(TSpellCastStage, SpellCastStageConversion, UnknownSpellCastStage) // - //************************************************************************************* + // ************************************************************************************* const std::string& toString(TSpellMode mode) { return SpellModeConversion.toString(mode); @@ -56,19 +56,19 @@ namespace MAGICFX return SpellModeConversion.fromString(str); } - //************************************************************************************* + // ************************************************************************************* const std::string& toString(TSpellType mode) { return SpellTypeConversion.toString(mode); } - //************************************************************************************* + // ************************************************************************************* const std::string& toString(TSpellCastStage mode) { return SpellCastStageConversion.toString(mode); } - //************************************************************************************* + // ************************************************************************************* TMagicFx toMagicFx( DMGTYPE::EDamageType type ,bool /* Link */) { switch(type) @@ -89,7 +89,7 @@ namespace MAGICFX } } - //************************************************************************************* + // ************************************************************************************* TMagicFx toMagicFx( EFFECT_FAMILIES::TEffectFamily effect) { switch(effect) @@ -152,7 +152,7 @@ namespace MAGICFX } } - //************************************************************************************* + // ************************************************************************************* TMagicFx healtoMagicFx( sint32 healHp, sint32 healSap, sint32 healSta, bool link ) { if ( !link ) diff --git a/code/ryzom/common/src/game_share/mirror.cpp b/code/ryzom/common/src/game_share/mirror.cpp index 1317ed15e..1d2855678 100644 --- a/code/ryzom/common/src/game_share/mirror.cpp +++ b/code/ryzom/common/src/game_share/mirror.cpp @@ -30,12 +30,13 @@ using namespace NLMISC; using namespace NLNET; using namespace std; - -#ifdef FAST_MIRROR -# pragma message(NL_LOC_MSG "Using **** FAST_MIRROR ****") -#else -# pragma message(NL_LOC_MSG "Not using FAST_MIRROR") -#endif +#ifdef NL_OS_WINDOWS +# ifdef FAST_MIRROR +# pragma message(NL_LOC_MSG "Using **** FAST_MIRROR ****") +# else +# pragma message(NL_LOC_MSG "Not using FAST_MIRROR") +# endif +#endif // NL_OS_WINDOWS const string MirrorVersion = string("1.10-")+string(ListRowSizeString); // ADDED: Unidirectional Mode (don't wait for delta) @@ -841,7 +842,9 @@ void CMirror::releaseTrackers( NLNET::CMessage& msgin ) for ( istfar=smidsToFindAndRemove.begin(); istfar!=smidsToFindAndRemove.end(); ++istfar ) { if ( (*istfar) != InvalidSMId ) + { MIRROR_INFO( "MIRROR: Need to remove tracker with smid %d", (*istfar) ); + } } #endif diff --git a/code/ryzom/common/src/game_share/mirror_prop_value.h b/code/ryzom/common/src/game_share/mirror_prop_value.h index ebb34f195..553c73b96 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value.h +++ b/code/ryzom/common/src/game_share/mirror_prop_value.h @@ -1208,7 +1208,7 @@ public: protected: /// Default constructor - CMirrorPropValueList() : _PtFront(NULL), _Container(NULL), _PropLocation() {} + CMirrorPropValueList() : _Container(NULL), _PtFront(NULL), _PropLocation() {} TSharedListRow allocateNewCell(); diff --git a/code/ryzom/common/src/game_share/mode_and_behaviour.h b/code/ryzom/common/src/game_share/mode_and_behaviour.h index 15466fe8a..502c4c67c 100644 --- a/code/ryzom/common/src/game_share/mode_and_behaviour.h +++ b/code/ryzom/common/src/game_share/mode_and_behaviour.h @@ -318,7 +318,7 @@ namespace MBEHAV } /// Cons cast into behaviour enum - operator const EBehaviour () const + operator EBehaviour () const { return (EBehaviour)Behaviour8; } diff --git a/code/ryzom/common/src/game_share/multi_target.cpp b/code/ryzom/common/src/game_share/multi_target.cpp index 91bdcf3fb..43e74cf7f 100644 --- a/code/ryzom/common/src/game_share/multi_target.cpp +++ b/code/ryzom/common/src/game_share/multi_target.cpp @@ -19,7 +19,7 @@ #include "stdpch.h" #include "multi_target.h" -//*********************************************************************** +// *********************************************************************** void CMultiTarget::pack(uint64 *destVP, uint numVP) { nlassert(numVP * 4 >= Targets.size()); // not enough room to stores visual properties! @@ -37,7 +37,7 @@ void CMultiTarget::pack(uint64 *destVP, uint numVP) } } -//*********************************************************************** +// *********************************************************************** void CMultiTarget::unpack(const uint64 *srcVP, uint numVP) { Targets.clear(); diff --git a/code/ryzom/common/src/game_share/multi_target.h b/code/ryzom/common/src/game_share/multi_target.h index 4da329e7a..324b97c34 100644 --- a/code/ryzom/common/src/game_share/multi_target.h +++ b/code/ryzom/common/src/game_share/multi_target.h @@ -64,14 +64,14 @@ public: // INLINE // //////////// -//******************************************************************************************* +// ******************************************************************************************* inline uint16 CMultiTarget::CTarget::getPacked() const { //return (uint16) TargetSlot | ((uint16) (Resist ? 1 : 0) << 15) | ((uint16) Distance << 8); return (uint16) TargetSlot | (uint16(Info) << 8); } -//******************************************************************************************* +// ******************************************************************************************* inline void CMultiTarget::CTarget::setPacked(uint16 value) { TargetSlot = uint8(value & 0xff); diff --git a/code/ryzom/common/src/game_share/range_weapon_type.cpp b/code/ryzom/common/src/game_share/range_weapon_type.cpp index a75aac6c2..9a8d662c0 100644 --- a/code/ryzom/common/src/game_share/range_weapon_type.cpp +++ b/code/ryzom/common/src/game_share/range_weapon_type.cpp @@ -32,13 +32,13 @@ NL_END_STRING_CONVERSION_TABLE(TRangeWeaponType, RangeWeaponTypeConversion, Unkn -//********************************************************************************* +// ********************************************************************************* TRangeWeaponType stringToRangeWeaponType(const std::string &str) { return RangeWeaponTypeConversion.fromString(str); } -//********************************************************************************* +// ********************************************************************************* std::string toString(TRangeWeaponType type) { return RangeWeaponTypeConversion.toString(type); diff --git a/code/ryzom/common/src/game_share/ring_session_manager_itf.h b/code/ryzom/common/src/game_share/ring_session_manager_itf.h index b03471403..6530ce008 100644 --- a/code/ryzom/common/src/game_share/ring_session_manager_itf.h +++ b/code/ryzom/common/src/game_share/ring_session_manager_itf.h @@ -25,7 +25,7 @@ #include "nel/net/login_cookie.h" -#include "../../nelns/welcome_service/welcome_service_itf.h" +#include "game_share/welcome_service_itf.h" #include "game_share/character_sync_itf.h" diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index a7a6f4ed9..3e178e12f 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -2572,7 +2572,7 @@ TUserRole CServerEditionModule::getRoleByCharId(TCharId charId) const } -TPioneersSessionsAllowed * const CServerEditionModule::getSessionAllowedForChar(TCharId charId) const +TPioneersSessionsAllowed * CServerEditionModule::getSessionAllowedForChar(TCharId charId) const { TPioneersSessionsAlloweds::const_iterator found = _PioneersSessionsAllowed.find(charId); if (found == _PioneersSessionsAllowed.end()) return NULL; diff --git a/code/ryzom/common/src/game_share/server_edition_module.h b/code/ryzom/common/src/game_share/server_edition_module.h index c98eeb586..71ca46d78 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.h +++ b/code/ryzom/common/src/game_share/server_edition_module.h @@ -474,7 +474,7 @@ namespace R2 TUserRole getRoleByCharId(TCharId charId) const; // get the session that is about to be joined by a client, or NULL if not found - TPioneersSessionsAllowed * const getSessionAllowedForChar(TCharId charId) const; + TPioneersSessionsAllowed * getSessionAllowedForChar(TCharId charId) const; // get the scenario use by the user CScenario* getScenarioByCharId(TCharId charId) const; diff --git a/code/ryzom/common/src/game_share/visual_fx.h b/code/ryzom/common/src/game_share/visual_fx.h index b30e8c18f..57f8a961c 100644 --- a/code/ryzom/common/src/game_share/visual_fx.h +++ b/code/ryzom/common/src/game_share/visual_fx.h @@ -40,7 +40,7 @@ public: // INLINES // ///////////// -//********************************************************************************************** +// ********************************************************************************************** inline void CVisualFX::unpack(sint64 vp) { Aura = (MAGICFX::TAuraFX) (vp & 31); @@ -48,7 +48,7 @@ inline void CVisualFX::unpack(sint64 vp) AuraReceipt = (vp & (1 << 10)) != 0; } -//********************************************************************************************** +// ********************************************************************************************** inline void CVisualFX::pack(sint64 &dest) { dest = ((sint64) AuraReceipt << 10) | ((sint64) (Aura & 31)) | ((sint64) (Link & 31) << 5); diff --git a/code/ryzom/common/src/game_share/welcome_service_itf.cpp b/code/ryzom/common/src/game_share/welcome_service_itf.cpp new file mode 100644 index 000000000..a8fdaea87 --- /dev/null +++ b/code/ryzom/common/src/game_share/welcome_service_itf.cpp @@ -0,0 +1,458 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +#include "stdpch.h" + +///////////////////////////////////////////////////////////////// +// WARNING : this is a generated file, don't change it ! +///////////////////////////////////////////////////////////////// + +#include "welcome_service_itf.h" + +namespace WS +{ + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + + + const CWelcomeServiceSkel::TMessageHandlerMap &CWelcomeServiceSkel::getMessageHandlers() const + { + static TMessageHandlerMap handlers; + static bool init = false; + + if (!init) + { + std::pair < TMessageHandlerMap::iterator, bool > res; + + res = handlers.insert(std::make_pair(std::string("WU"), &CWelcomeServiceSkel::welcomeUser_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + res = handlers.insert(std::make_pair(std::string("DU"), &CWelcomeServiceSkel::disconnectUser_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + init = true; + } + + return handlers; + } + bool CWelcomeServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message) + { + const TMessageHandlerMap &mh = getMessageHandlers(); + + TMessageHandlerMap::const_iterator it(mh.find(message.getName())); + + if (it == mh.end()) + { + return false; + } + + TMessageHandler cmd = it->second; + (this->*cmd)(sender, message); + + return true; + } + + + void CWelcomeServiceSkel::welcomeUser_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CWelcomeServiceSkel_welcomeUser_WU); + uint32 charId; + nlRead(__message, serial, charId); + std::string userName; + nlRead(__message, serial, userName); + NLNET::CLoginCookie cookie; + nlRead(__message, serial, cookie); + std::string priviledge; + nlRead(__message, serial, priviledge); + std::string exPriviledge; + nlRead(__message, serial, exPriviledge); + WS::TUserRole mode; + nlRead(__message, serial, mode); + uint32 instanceId; + nlRead(__message, serial, instanceId); + welcomeUser(sender, charId, userName, cookie, priviledge, exPriviledge, mode, instanceId); + } + + void CWelcomeServiceSkel::disconnectUser_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CWelcomeServiceSkel_disconnectUser_DU); + uint32 userId; + nlRead(__message, serial, userId); + disconnectUser(sender, userId); + } + // ask the welcome service to welcome a character + void CWelcomeServiceProxy::welcomeUser(NLNET::IModule *sender, uint32 charId, const std::string &userName, const NLNET::CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->welcomeUser(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), charId, userName, cookie, priviledge, exPriviledge, mode, instanceId); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_welcomeUser(__message, charId, userName, cookie, priviledge, exPriviledge, mode, instanceId); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + // ask the welcome service to disconnect a user + void CWelcomeServiceProxy::disconnectUser(NLNET::IModule *sender, uint32 userId) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->disconnectUser(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), userId); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_disconnectUser(__message, userId); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CWelcomeServiceProxy::buildMessageFor_welcomeUser(NLNET::CMessage &__message, uint32 charId, const std::string &userName, const NLNET::CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId) + { + __message.setType("WU"); + nlWrite(__message, serial, charId); + nlWrite(__message, serial, const_cast < std::string& > (userName)); + nlWrite(__message, serial, const_cast < NLNET::CLoginCookie& > (cookie)); + nlWrite(__message, serial, const_cast < std::string& > (priviledge)); + nlWrite(__message, serial, const_cast < std::string& > (exPriviledge)); + nlWrite(__message, serial, mode); + nlWrite(__message, serial, instanceId); + + + return __message; + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CWelcomeServiceProxy::buildMessageFor_disconnectUser(NLNET::CMessage &__message, uint32 userId) + { + __message.setType("DU"); + nlWrite(__message, serial, userId); + + + return __message; + } + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + + + const CLoginServiceSkel::TMessageHandlerMap &CLoginServiceSkel::getMessageHandlers() const + { + static TMessageHandlerMap handlers; + static bool init = false; + + if (!init) + { + std::pair < TMessageHandlerMap::iterator, bool > res; + + res = handlers.insert(std::make_pair(std::string("PUL"), &CLoginServiceSkel::pendingUserLost_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + init = true; + } + + return handlers; + } + bool CLoginServiceSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message) + { + const TMessageHandlerMap &mh = getMessageHandlers(); + + TMessageHandlerMap::const_iterator it(mh.find(message.getName())); + + if (it == mh.end()) + { + return false; + } + + TMessageHandler cmd = it->second; + (this->*cmd)(sender, message); + + return true; + } + + + void CLoginServiceSkel::pendingUserLost_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CLoginServiceSkel_pendingUserLost_PUL); + NLNET::CLoginCookie cookie; + nlRead(__message, serial, cookie); + pendingUserLost(sender, cookie); + } + // An awaited user did not connect before the allowed timeout expire + void CLoginServiceProxy::pendingUserLost(NLNET::IModule *sender, const NLNET::CLoginCookie &cookie) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->pendingUserLost(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), cookie); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_pendingUserLost(__message, cookie); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CLoginServiceProxy::buildMessageFor_pendingUserLost(NLNET::CMessage &__message, const NLNET::CLoginCookie &cookie) + { + __message.setType("PUL"); + nlWrite(__message, serial, const_cast < NLNET::CLoginCookie& > (cookie)); + + + return __message; + } + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + + + const CWelcomeServiceClientSkel::TMessageHandlerMap &CWelcomeServiceClientSkel::getMessageHandlers() const + { + static TMessageHandlerMap handlers; + static bool init = false; + + if (!init) + { + std::pair < TMessageHandlerMap::iterator, bool > res; + + res = handlers.insert(std::make_pair(std::string("RWS"), &CWelcomeServiceClientSkel::registerWS_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + res = handlers.insert(std::make_pair(std::string("RWSOS"), &CWelcomeServiceClientSkel::reportWSOpenState_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + res = handlers.insert(std::make_pair(std::string("WUR"), &CWelcomeServiceClientSkel::welcomeUserResult_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + res = handlers.insert(std::make_pair(std::string("UCP"), &CWelcomeServiceClientSkel::updateConnectedPlayerCount_skel)); + // if this assert, you have a doubly message name in your interface definition ! + nlassert(res.second); + + init = true; + } + + return handlers; + } + bool CWelcomeServiceClientSkel::fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message) + { + const TMessageHandlerMap &mh = getMessageHandlers(); + + TMessageHandlerMap::const_iterator it(mh.find(message.getName())); + + if (it == mh.end()) + { + return false; + } + + TMessageHandler cmd = it->second; + (this->*cmd)(sender, message); + + return true; + } + + + void CWelcomeServiceClientSkel::registerWS_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CWelcomeServiceClientSkel_registerWS_RWS); + uint32 shardId; + nlRead(__message, serial, shardId); + uint32 fixedSessionId; + nlRead(__message, serial, fixedSessionId); + bool isOnline; + nlRead(__message, serial, isOnline); + registerWS(sender, shardId, fixedSessionId, isOnline); + } + + void CWelcomeServiceClientSkel::reportWSOpenState_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CWelcomeServiceClientSkel_reportWSOpenState_RWSOS); + bool isOnline; + nlRead(__message, serial, isOnline); + reportWSOpenState(sender, isOnline); + } + + void CWelcomeServiceClientSkel::welcomeUserResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CWelcomeServiceClientSkel_welcomeUserResult_WUR); + uint32 userId; + nlRead(__message, serial, userId); + bool ok; + nlRead(__message, serial, ok); + std::string shardAddr; + nlRead(__message, serial, shardAddr); + std::string errorMsg; + nlRead(__message, serial, errorMsg); + welcomeUserResult(sender, userId, ok, shardAddr, errorMsg); + } + + void CWelcomeServiceClientSkel::updateConnectedPlayerCount_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message) + { + H_AUTO(CWelcomeServiceClientSkel_updateConnectedPlayerCount_UCP); + uint32 nbOnlinePlayers; + nlRead(__message, serial, nbOnlinePlayers); + uint32 nbPendingPlayers; + nlRead(__message, serial, nbPendingPlayers); + updateConnectedPlayerCount(sender, nbOnlinePlayers, nbPendingPlayers); + } + // Register the welcome service in the ring session manager + // The provided sessionId will be non-zero only for a shard with a fixed sessionId + void CWelcomeServiceClientProxy::registerWS(NLNET::IModule *sender, uint32 shardId, uint32 fixedSessionId, bool isOnline) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->registerWS(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), shardId, fixedSessionId, isOnline); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_registerWS(__message, shardId, fixedSessionId, isOnline); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + // WS report it's current open state + void CWelcomeServiceClientProxy::reportWSOpenState(NLNET::IModule *sender, bool isOnline) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->reportWSOpenState(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), isOnline); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_reportWSOpenState(__message, isOnline); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + // return for welcome user + void CWelcomeServiceClientProxy::welcomeUserResult(NLNET::IModule *sender, uint32 userId, bool ok, const std::string &shardAddr, const std::string &errorMsg) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->welcomeUserResult(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), userId, ok, shardAddr, errorMsg); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_welcomeUserResult(__message, userId, ok, shardAddr, errorMsg); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + // transmits the current player counts + void CWelcomeServiceClientProxy::updateConnectedPlayerCount(NLNET::IModule *sender, uint32 nbOnlinePlayers, uint32 nbPendingPlayers) + { + if (_LocalModuleSkel && _LocalModule->isImmediateDispatchingSupported()) + { + // immediate local synchronous dispatching + _LocalModuleSkel->updateConnectedPlayerCount(_ModuleProxy->getModuleGateway()->getPluggedModuleProxy(sender), nbOnlinePlayers, nbPendingPlayers); + } + else + { + // send the message for remote dispatching and execution or local queing + NLNET::CMessage __message; + + buildMessageFor_updateConnectedPlayerCount(__message, nbOnlinePlayers, nbPendingPlayers); + + _ModuleProxy->sendModuleMessage(sender, __message); + } + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CWelcomeServiceClientProxy::buildMessageFor_registerWS(NLNET::CMessage &__message, uint32 shardId, uint32 fixedSessionId, bool isOnline) + { + __message.setType("RWS"); + nlWrite(__message, serial, shardId); + nlWrite(__message, serial, fixedSessionId); + nlWrite(__message, serial, isOnline); + + + return __message; + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CWelcomeServiceClientProxy::buildMessageFor_reportWSOpenState(NLNET::CMessage &__message, bool isOnline) + { + __message.setType("RWSOS"); + nlWrite(__message, serial, isOnline); + + + return __message; + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CWelcomeServiceClientProxy::buildMessageFor_welcomeUserResult(NLNET::CMessage &__message, uint32 userId, bool ok, const std::string &shardAddr, const std::string &errorMsg) + { + __message.setType("WUR"); + nlWrite(__message, serial, userId); + nlWrite(__message, serial, ok); + nlWrite(__message, serial, const_cast < std::string& > (shardAddr)); + nlWrite(__message, serial, const_cast < std::string& > (errorMsg)); + + + return __message; + } + + // Message serializer. Return the message received in reference for easier integration + const NLNET::CMessage &CWelcomeServiceClientProxy::buildMessageFor_updateConnectedPlayerCount(NLNET::CMessage &__message, uint32 nbOnlinePlayers, uint32 nbPendingPlayers) + { + __message.setType("UCP"); + nlWrite(__message, serial, nbOnlinePlayers); + nlWrite(__message, serial, nbPendingPlayers); + + + return __message; + } + +} diff --git a/code/ryzom/common/src/game_share/welcome_service_itf.h b/code/ryzom/common/src/game_share/welcome_service_itf.h new file mode 100644 index 000000000..81a498a06 --- /dev/null +++ b/code/ryzom/common/src/game_share/welcome_service_itf.h @@ -0,0 +1,541 @@ + +///////////////////////////////////////////////////////////////// +// WARNING : this is a generated file, don't change it ! +///////////////////////////////////////////////////////////////// + +#ifndef WELCOME_SERVICE_ITF +#define WELCOME_SERVICE_ITF +#include "nel/misc/types_nl.h" +#ifdef NL_COMP_VC8 + #include +#endif +#include "nel/misc/hierarchical_timer.h" +#include "nel/misc/string_conversion.h" +#include "nel/net/message.h" +#include "nel/net/module.h" +#include "nel/net/module_builder_parts.h" +#include "nel/net/module_message.h" +#include "nel/net/module_gateway.h" + +#include "nel/net/login_cookie.h" + +namespace WS +{ + + + + struct TUserRole + { + enum TValues + { + ur_player, + ur_editor, + ur_animator, + /// the highest valid value in the enum + last_enum_item = ur_animator, + /// a value equal to the last enum item +1 + end_of_enum, + + invalid_val, + + /// Number of enumerated values + nb_enum_items = 3 + }; + + /// Index table to convert enum value to linear index table + const std::map &getIndexTable() const + { + static std::map indexTable; + static bool init = false; + if (!init) + { + // fill the index table + indexTable.insert(std::make_pair(ur_player, 0)); + indexTable.insert(std::make_pair(ur_editor, 1)); + indexTable.insert(std::make_pair(ur_animator, 2)); + + init = true; + } + + return indexTable; + } + + + static const NLMISC::CStringConversion &getConversionTable() + { + NL_BEGIN_STRING_CONVERSION_TABLE(TValues) + NL_STRING_CONVERSION_TABLE_ENTRY(ur_player) + NL_STRING_CONVERSION_TABLE_ENTRY(ur_editor) + NL_STRING_CONVERSION_TABLE_ENTRY(ur_animator) + NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val) + }; + static NLMISC::CStringConversion + conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) + / sizeof(TValues_nl_string_conversion_table[0]), invalid_val); + + return conversionTable; + } + + TValues _Value; + + public: + TUserRole() + : _Value(invalid_val) + { + } + TUserRole(TValues value) + : _Value(value) + { + } + + TUserRole(const std::string &str) + { + _Value = getConversionTable().fromString(str); + } + + void serial(NLMISC::IStream &s) + { + s.serialEnum(_Value); + } + + bool operator == (const TUserRole &other) const + { + return _Value == other._Value; + } + bool operator != (const TUserRole &other) const + { + return ! (_Value == other._Value); + } + bool operator < (const TUserRole &other) const + { + return _Value < other._Value; + } + + bool operator <= (const TUserRole &other) const + { + return _Value <= other._Value; + } + + bool operator > (const TUserRole &other) const + { + return !(_Value <= other._Value); + } + bool operator >= (const TUserRole &other) const + { + return !(_Value < other._Value); + } + + const std::string &toString() const + { + return getConversionTable().toString(_Value); + } + static const std::string &toString(TValues value) + { + return getConversionTable().toString(value); + } + + TValues getValue() const + { + return _Value; + } + + // return true if the actual value of the enum is valid, otherwise false + bool isValid() + { + if (_Value == invalid_val) + return false; + + // not invalid, check other enum value + return getConversionTable().isValid(_Value); + } + + + uint32 asIndex() + { + std::map::const_iterator it(getIndexTable().find(_Value)); + nlassert(it != getIndexTable().end()); + return it->second; + } + + }; + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + class CWelcomeServiceSkel + { + public: + /// the interceptor type + typedef NLNET::CInterceptorForwarder < CWelcomeServiceSkel> TInterceptor; + protected: + CWelcomeServiceSkel() + { + // do early run time check for message table + getMessageHandlers(); + } + virtual ~CWelcomeServiceSkel() + { + } + + void init(NLNET::IModule *module) + { + _Interceptor.init(this, module); + } + + // unused interceptors + std::string fwdBuildModuleManifest() const { return std::string(); } + void fwdOnModuleUp(NLNET::IModuleProxy * /* moduleProxy */) {} + void fwdOnModuleDown(NLNET::IModuleProxy * /* moduleProxy */) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy * /* moduleProxy */) {} + + // process module message interceptor + bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); + private: + + typedef void (CWelcomeServiceSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); + typedef std::map TMessageHandlerMap; + + const TMessageHandlerMap &getMessageHandlers() const; + + + void welcomeUser_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + void disconnectUser_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + // declare one interceptor member of the skeleton + TInterceptor _Interceptor; + + // declare the interceptor forwarder as friend of this class + friend class NLNET::CInterceptorForwarder < CWelcomeServiceSkel>; + public: + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + + // ask the welcome service to welcome a character + virtual void welcomeUser(NLNET::IModuleProxy *sender, uint32 charId, const std::string &userName, const NLNET::CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId) =0; + // ask the welcome service to disconnect a user + virtual void disconnectUser(NLNET::IModuleProxy *sender, uint32 userId) =0; + + + }; + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + class CWelcomeServiceProxy + { + /// Smart pointer on the module proxy + NLNET::TModuleProxyPtr _ModuleProxy; + + // Pointer on the local module that implement the interface (if the proxy is for a local module) + NLNET::TModulePtr _LocalModule; + // Direct pointer on the server implementation interface for collocated module + CWelcomeServiceSkel *_LocalModuleSkel; + + + public: + CWelcomeServiceProxy(NLNET::IModuleProxy *proxy) + { + nlassert(proxy->getModuleClassName() == "WelcomeService"); + _ModuleProxy = proxy; + + // initialize collocated servant interface + if (proxy->getModuleDistance() == 0) + { + _LocalModule = proxy->getLocalModule(); + nlassert(_LocalModule != NULL); + CWelcomeServiceSkel::TInterceptor *interceptor = NULL; + interceptor = static_cast < NLNET::CModuleBase* >(_LocalModule.getPtr())->getInterceptor(interceptor); + nlassert(interceptor != NULL); + + _LocalModuleSkel = interceptor->getParent(); + nlassert(_LocalModuleSkel != NULL); + } + else + _LocalModuleSkel = 0; + + } + virtual ~CWelcomeServiceProxy() + { + } + + NLNET::IModuleProxy *getModuleProxy() + { + return _ModuleProxy; + } + + // ask the welcome service to welcome a character + void welcomeUser(NLNET::IModule *sender, uint32 charId, const std::string &userName, const NLNET::CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId); + // ask the welcome service to disconnect a user + void disconnectUser(NLNET::IModule *sender, uint32 userId); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_welcomeUser(NLNET::CMessage &__message, uint32 charId, const std::string &userName, const NLNET::CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_disconnectUser(NLNET::CMessage &__message, uint32 userId); + + + + + }; + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + class CLoginServiceSkel + { + public: + /// the interceptor type + typedef NLNET::CInterceptorForwarder < CLoginServiceSkel> TInterceptor; + protected: + CLoginServiceSkel() + { + // do early run time check for message table + getMessageHandlers(); + } + virtual ~CLoginServiceSkel() + { + } + + void init(NLNET::IModule *module) + { + _Interceptor.init(this, module); + } + + // unused interceptors + std::string fwdBuildModuleManifest() const { return std::string(); } + void fwdOnModuleUp(NLNET::IModuleProxy * /* moduleProxy */) {} + void fwdOnModuleDown(NLNET::IModuleProxy * /* moduleProxy */) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy * /* moduleProxy */) {} + + // process module message interceptor + bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); + private: + + typedef void (CLoginServiceSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); + typedef std::map TMessageHandlerMap; + + const TMessageHandlerMap &getMessageHandlers() const; + + + void pendingUserLost_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + // declare one interceptor member of the skeleton + TInterceptor _Interceptor; + + // declare the interceptor forwarder as friend of this class + friend class NLNET::CInterceptorForwarder < CLoginServiceSkel>; + public: + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + + // An awaited user did not connect before the allowed timeout expire + virtual void pendingUserLost(NLNET::IModuleProxy *sender, const NLNET::CLoginCookie &cookie) =0; + + + }; + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + class CLoginServiceProxy + { + /// Smart pointer on the module proxy + NLNET::TModuleProxyPtr _ModuleProxy; + + // Pointer on the local module that implement the interface (if the proxy is for a local module) + NLNET::TModulePtr _LocalModule; + // Direct pointer on the server implementation interface for collocated module + CLoginServiceSkel *_LocalModuleSkel; + + + public: + CLoginServiceProxy(NLNET::IModuleProxy *proxy) + { + + _ModuleProxy = proxy; + + // initialize collocated servant interface + if (proxy->getModuleDistance() == 0) + { + _LocalModule = proxy->getLocalModule(); + nlassert(_LocalModule != NULL); + CLoginServiceSkel::TInterceptor *interceptor = NULL; + interceptor = static_cast < NLNET::CModuleBase* >(_LocalModule.getPtr())->getInterceptor(interceptor); + nlassert(interceptor != NULL); + + _LocalModuleSkel = interceptor->getParent(); + nlassert(_LocalModuleSkel != NULL); + } + else + _LocalModuleSkel = 0; + + } + virtual ~CLoginServiceProxy() + { + } + + NLNET::IModuleProxy *getModuleProxy() + { + return _ModuleProxy; + } + + // An awaited user did not connect before the allowed timeout expire + void pendingUserLost(NLNET::IModule *sender, const NLNET::CLoginCookie &cookie); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_pendingUserLost(NLNET::CMessage &__message, const NLNET::CLoginCookie &cookie); + + + + + }; + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + class CWelcomeServiceClientSkel + { + public: + /// the interceptor type + typedef NLNET::CInterceptorForwarder < CWelcomeServiceClientSkel> TInterceptor; + protected: + CWelcomeServiceClientSkel() + { + // do early run time check for message table + getMessageHandlers(); + } + virtual ~CWelcomeServiceClientSkel() + { + } + + void init(NLNET::IModule *module) + { + _Interceptor.init(this, module); + } + + // unused interceptors + std::string fwdBuildModuleManifest() const { return std::string(); } + void fwdOnModuleUp(NLNET::IModuleProxy * /* moduleProxy */) {} + void fwdOnModuleDown(NLNET::IModuleProxy * /* moduleProxy */) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy * /* moduleProxy */) {} + + // process module message interceptor + bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); + private: + + typedef void (CWelcomeServiceClientSkel::*TMessageHandler)(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); + typedef std::map TMessageHandlerMap; + + const TMessageHandlerMap &getMessageHandlers() const; + + + void registerWS_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + void reportWSOpenState_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + void welcomeUserResult_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + void updateConnectedPlayerCount_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); + + // declare one interceptor member of the skeleton + TInterceptor _Interceptor; + + // declare the interceptor forwarder as friend of this class + friend class NLNET::CInterceptorForwarder < CWelcomeServiceClientSkel>; + public: + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + + // Register the welcome service in the ring session manager + // The provided sessionId will be non-zero only for a shard with a fixed sessionId + virtual void registerWS(NLNET::IModuleProxy *sender, uint32 shardId, uint32 fixedSessionId, bool isOnline) =0; + // WS report it's current open state + virtual void reportWSOpenState(NLNET::IModuleProxy *sender, bool isOnline) =0; + // return for welcome user + virtual void welcomeUserResult(NLNET::IModuleProxy *sender, uint32 userId, bool ok, const std::string &shardAddr, const std::string &errorMsg) =0; + // transmits the current player counts + virtual void updateConnectedPlayerCount(NLNET::IModuleProxy *sender, uint32 nbOnlinePlayers, uint32 nbPendingPlayers) =0; + + + }; + + ///////////////////////////////////////////////////////////////// + // WARNING : this is a generated file, don't change it ! + ///////////////////////////////////////////////////////////////// + class CWelcomeServiceClientProxy + { + /// Smart pointer on the module proxy + NLNET::TModuleProxyPtr _ModuleProxy; + + // Pointer on the local module that implement the interface (if the proxy is for a local module) + NLNET::TModulePtr _LocalModule; + // Direct pointer on the server implementation interface for collocated module + CWelcomeServiceClientSkel *_LocalModuleSkel; + + + public: + CWelcomeServiceClientProxy(NLNET::IModuleProxy *proxy) + { + + _ModuleProxy = proxy; + + // initialize collocated servant interface + if (proxy->getModuleDistance() == 0) + { + _LocalModule = proxy->getLocalModule(); + nlassert(_LocalModule != NULL); + CWelcomeServiceClientSkel::TInterceptor *interceptor = NULL; + interceptor = static_cast < NLNET::CModuleBase* >(_LocalModule.getPtr())->getInterceptor(interceptor); + nlassert(interceptor != NULL); + + _LocalModuleSkel = interceptor->getParent(); + nlassert(_LocalModuleSkel != NULL); + } + else + _LocalModuleSkel = 0; + + } + virtual ~CWelcomeServiceClientProxy() + { + } + + NLNET::IModuleProxy *getModuleProxy() + { + return _ModuleProxy; + } + + // Register the welcome service in the ring session manager + // The provided sessionId will be non-zero only for a shard with a fixed sessionId + void registerWS(NLNET::IModule *sender, uint32 shardId, uint32 fixedSessionId, bool isOnline); + // WS report it's current open state + void reportWSOpenState(NLNET::IModule *sender, bool isOnline); + // return for welcome user + void welcomeUserResult(NLNET::IModule *sender, uint32 userId, bool ok, const std::string &shardAddr, const std::string &errorMsg); + // transmits the current player counts + void updateConnectedPlayerCount(NLNET::IModule *sender, uint32 nbOnlinePlayers, uint32 nbPendingPlayers); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_registerWS(NLNET::CMessage &__message, uint32 shardId, uint32 fixedSessionId, bool isOnline); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_reportWSOpenState(NLNET::CMessage &__message, bool isOnline); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_welcomeUserResult(NLNET::CMessage &__message, uint32 userId, bool ok, const std::string &shardAddr, const std::string &errorMsg); + + // Message serializer. Return the message received in reference for easier integration + static const NLNET::CMessage &buildMessageFor_updateConnectedPlayerCount(NLNET::CMessage &__message, uint32 nbOnlinePlayers, uint32 nbPendingPlayers); + + + + + }; + +} + +#endif diff --git a/code/ryzom/common/src/game_share/xml_auto_ptr.h b/code/ryzom/common/src/game_share/xml_auto_ptr.h index 70a011a00..36e67331b 100644 --- a/code/ryzom/common/src/game_share/xml_auto_ptr.h +++ b/code/ryzom/common/src/game_share/xml_auto_ptr.h @@ -34,7 +34,7 @@ public: operator std::string() const { return std::string(_Value); } bool operator ! () const { return _Value == NULL; } operator const unsigned char *() const { return (const unsigned char *) _Value; } - const char operator * () const { nlassert(_Value); return *_Value; } + char operator * () const { nlassert(_Value); return *_Value; } /// NB : This remove previous owned pointer with xmlFree CXMLAutoPtr &operator = (const char *other) { diff --git a/code/ryzom/server/dynamic_scenario_service.cfg b/code/ryzom/server/dynamic_scenario_service.cfg new file mode 100644 index 000000000..d264d0f73 --- /dev/null +++ b/code/ryzom/server/dynamic_scenario_service.cfg @@ -0,0 +1,320 @@ +// Auto generated config file +// Use with commandline: dynamic_scenario_service -C. -L. --nobreak --writepid +AESAliasName= "dss"; + +ASWebPort="46700"; +ASPort="46701"; +AESPort="46702"; +SUPort = 50505; +SUGlobalPort = 50503; +L3BSPort = "49950"; +L3SlaveBSPort = "49951"; +L3MasterLGSPort = 49992; +LGSBSPort = 49994; +L3LGSBSPort = 49995; +SUHost = "localhost"; +MFSHost = "localhost"; +BSHost = "localhost:49990"; +SlaveBSHost = ""; +MasterLGSHost = "localhost"; +SlaveLGSHost = "localhost"; +LGSBSHost = "localhost"; +DBHost = "localhost"; +#define DONT_USE_LGS_SLAVE +// Configure module gateway for layer 5 module comm +StartCommands += +{ +// Create a gateway module +"moduleManager.createModule StandardGateway gw", +// add a layer 5 transport +"gw.transportAdd L5Transport l5", +// open the transport +"gw.transportCmd l5(open)", + +/// Create default connection with admin executor service +// Create a gateway module +"moduleManager.createModule StandardGateway gw_aes", +// create the admin executor service module +"moduleManager.createModule AdminExecutorServiceClient aes_client", +"aes_client.plug gw_aes", + +// create a layer 3 client to connect to aes gateway +"gw_aes.transportAdd L3Client aes_l3c", +"gw_aes.transportCmd aes_l3c(connect addr=localhost:"+AESPort+")", +}; + +/// A list of vars to graph for any service +GraphVars = +{ +"ProcessUsedMemory", "60000", // every minute +}; + + +/* Force default value for PDLib directory (e.g. SaveFilesDirectory...) +* PLEASE NOTICE THAT THIS LINE MUST BE LEFT TO "" +* Only log analyser must have the $shard parameter to find all shards root directory +*/ +PDRootDirectory = ""; + +// Log PD updates to log file (1 enabled, 0 disabled), see PDLogSaveDirectory to choose where to log +PDEnableLog = 1; + +// Log PD StringManager updates to log file (1 enabled, 0 disabled), see PDLogSaveDirectory to choose where to log +PDEnableStringLog = 0; + +// Number of seconds between 2 logs to file +PDLogUpdate = 10; + +// MySGL wrapper strict mode - controls use of asserts if SQL requests fail +MSWStrictMode=0; + +// This is the mapping for logical continent to physical one +ContinentNameTranslator = +{ +"matis_newbie", "matis", +"zorai_newbie", "zorai", +"terre", "terre_oubliee", +"sources", "sources_interdites" +}; + +NegFiltersDebug = { "ZZZZZZZZZZZ" }; +NegFiltersInfo = { "ZZZZZZZZZZZ" }; +NegFiltersWarning = { "ZZZZZZZZZZZ", "Missing log context for log" }; +//NegFiltersDebug = { "NET", "ADMIN", "MIRROR", "NC", "PATH" }; +//NegFiltersInfo = { "NET", "ADMIN", "MIRROR", "NC", "CF", "TimerManagerUpdate" }; +// NegFiltersWarning = { "CT_LRC", "AnimalSpawned" }; + +// Block the system in the tick service that provokes stalls when overloaded +WaitForBSThreshold=0; + +// Only produce log*.log files and not *.log +DontLog=1; + +IgnoredFiles = { "continent.cfg", "__read_me.txt", "bandit.html", "flora_primr.primitive" }; + +// If the update loop is too slow, a thread will produce an assertion. +// By default, the value is set to 10 minutes. +// Set to 0 for no assertion. +UpdateAssertionThreadTimeout = 6000000; + +DefaultMaxExpectedBlockSize = 200000000; // 200 M ! +DefaultMaxSentBlockSize = 200000000; // 200 M ! + +// MS Packet size limit in bytes, PER DATASET (warning: depending on the weights, limits per property may be very small) +MaxOutBandwidth = 100000000; + +// how to sleep between 2 network updates +// 0 = pipe +// 1 = usleep +// 2 = nanosleep +// 3 = sched_yield +// 4 = nothing +UseYieldMethod = 0; + +// The privileges needed to access any ring session +PrivilegeForSessionAccess = ":DEV:SGM:GM:SG:"; + +// The max number of ring points (aka ring access) for each ecosystem +MaxRingPoints = "A1:D7:F7:J8:L6:R13"; + +// Level limit for newb scenarios +FreeTrialSkillLimit=21; + +// Level limit for newb scenarios +DefaultInterShardExchangeLevelCap=0; + +// Configureation for DSS +MaxNpcs = 300; +MaxStaticObjects = 200; + +// the following variable must be defined but should be empty - it's presence is used to change the behaviour +// of the packed sheet reader +GeorgePaths = { "" }; + +// Dissable nel net verbose logging +VerboseNETTC = 0; +VerboseLNETL0 = 0; +VerboseLNETL1 = 0; +VerboseLNETL2 = 0; +VerboseLNETL3 = 0; +VerboseLNETL4 = 0; +VerboseLNETL5 = 0; +VerboseLNETL6 = 0; + +// Dissable ryzom verbose logging +VerboseMIRROR = 0; +VerboseRingRPLog = 0; +VerboseCDBGroup = 0; + +// What to do with characters coming from another mainland shard? +// 0: teleport to the stored session id +// 1: let the character play anyway, but leave the stored session id unchanged +// 2: assign the stored session id with FixedSessionId and let play +AllowCharsFromAllSessions = 0; + +// Use Shard Unifier or not +DontUseSU = 0; + +// the domain's set of useful addresses +LSHost = SUHost; +RSMHost = SUHost; + +// MFS config +WebSrvUsersDirectory = ""; +WebRootDirectory = "/home/nevrax/live/save_shard/www"; +HoFHDTDirectory = "/local/www/hof/hdt"; + +// BS Specifics -------------------------------------------------------------------------- +// BS - set to 1 if a BS is not part of a naming service group (then BS not disclosed +// to other services by the Layer 5, i.e. the services sending requests to BS have +// to know its/their address(es) by another mean) +BSDontUseNS = 1; +// BS - set the host of the naming service where the BS register +BSNSHost = "localhost"; +UseBS = 1; +XMLSave = 0; + +// Where to save specific shard data (ie: player backup), relatively to SaveShardRoot +SaveFilesDirectory = ""; + +// where to save generic shard data (ie: packed_sheet) +WriteFilesDirectory = "r2_shard/data_shard"; + +// Will SaveFilesDirectory will be converted to a full path? +ConvertSaveFilesDirectoryToFullPath = 0; + +// BS - Root directory where data are backuped to +IncrementalBackupDirectory = "../incremental_backup"; + +// IOS - Directory to store ios.string_cache file +StringManagerCacheDirectory = "../data_shard_local"; + +// IOS - Directory to log chat into +LogChatDirectory = "../data_shard_local"; + +// MFS - Directories +WebRootDirectory = "../www"; + +// Root directory where data from shards are stored into +SaveShardRoot = "../save_shard/"; + +// SU Specifics -------------------------------------------------------------------------- +// SU - set to 1 if SU didn't use a naming service +SUDontUseNS = 1; +// SU - host for the NS used by SU +SUNSHost = "localhost"; +// SU - listen address of the SU service (for L5 connections) +SUAddress = SUHost+":"+SUPort; +// SU - nel and ring database names +DBNelName = "nel"; +DBRingName = "ring_open"; +// Nel DB user +DBNelUser = "open"; +// Ring DB user +DBRingUser = "open"; +// SU - password to access to the nel database with DBNelUseruser (default is no password) +DBNelPass = ""; +// SU - password to access to the ring database with DBRingUser (default is no password) +DBRingPass = ""; + +// WS Specifics -------------------------------------------------------------------------- +// WS - use or not the legacy WelcomeService from nel ns (only for backward compatibility during transition to ring) +DontUseLSService = 1; + +// Global config -------------------------------------------------------------------------- +// set to 0 if you want to use the admin system +DontUseAES = 1; + +// Dissable generation / display of nldebug messages +DissableNLDebug = 1; +DisableNLDebug = 1; +ShardId = 201; +BasePort = 51400; +SaveFilesDirectory="open_ring01/"; +NSHost = "localhost"; +// Player limits (AIS, EGS, WS, FS) +NbPlayersLimit = 5000; +NbGuildLimit = 15000; +PlayerLimit = NbPlayersLimit; +ClientLimit = 1000; + +// Set this shard as a ring (1) or mainland (0) shard (main behavior switch) +IsRingShard = 1; + +// Set a mainland SessionId. +// Live: Must be 0 for ring shards, non-zero (usually ShardId) for mainland shards +// Dev: Can be non-zero to initially connect a client to a ring shard +NoWSShardId = ShardId; +FixedSessionId = 0; + +// Mirror limits +DatasetSizefe_temp = 600000; +DatasetSizefame = 26000; + +// FS Specifics -------------------------------------------------------------------------- +// Client bandwidth ratio, set to 1 for standard operation, more than one allocate more bandwidth +BandwidthRatio = 2; + +// EGS Specifics -------------------------------------------------------------------------- +// Entity Limits (EGS) +NbObjectsLimit = 2000; +NbNpcSpawnedByEGSLimit = 5000; +NbForageSourcesLimit = 10000; +NbToxicCloudsLimit = 5000; + +// AIS Specifics -------------------------------------------------------------------------- +// Entity Limits (AIS) +NbPetLimit = NbPlayersLimit*4; +NbFaunaLimit = 50000; +NbNpcLimit = 50000; +NbFxLimit = 500; + +// This is the list of continent to use with their unique instance number +UsedContinents = +{ +"r2_desert", "10000", +"r2_forest", "10001", +"r2_jungle", "10002", +"r2_lakes", "10003", +"r2_roots", "10004", +}; + +// define the primitives configuration used. +UsedPrimitives = +{ +}; +FSListenHost = "localhost"; +#include "dynamic_scenario_service_default.cfg" +WriteFilesDirectory="../live/service_dynamic_scenario_service/"; +DontLog = 1; +WebSrvHost = "http://localhost:50000/"; +Mainlands = { + "302", "Open", "(Open Developer Community)", "en", +}; +HomeMainlandNames = +{ + "302", "Open", "open", +}; +RRDVarPath = "../rrd_graphs"; +NegFiltersInfo+= {"FESTATS", "FETIME", "FERECV", "FESEND: sent SYNC message to client 1", "EIT: Register EId"}; +NegFiltersWarning+= {"PIPO_SESSION1", "casino_session_matis01", "invalid damage type 10", "_log_Item_Delete", +"_log_Item_Money", "_log_Item_Create", "_log_Item_Move", "botChatMissionAdvance> invalid index 0", +"_MaxRange(0) < _MinRange(1)", "Can't find craft plan sheet 'unknown.unknown'"}; +DontUseAES=1; +RingRPEnabled=0; +DomainName = "ryzom_open"; +EnableStlAllocatorChecker = 0; +// start commands for setting up the exchange level caps of different ryzom shards +StartCommands += { "setShardExchangeLimit 101 250" }; +StartCommands += { "setShardExchangeLimit 102 250" }; +StartCommands += { "setShardExchangeLimit 103 250" }; +StartCommands += { "setShardExchangeLimit 104 0" }; +StartCommands += { "setShardExchangeLimit 105 0" }; +StartCommands += { "displayShardExchangeLimits" }; +StartCommands += { "EnableStlAllocatorChecker 0" }; + +Paths = { + ".", + "../common/data_common", + "../common/data_leveldesign", +}; diff --git a/code/ryzom/server/dynamic_scenario_service_default.cfg b/code/ryzom/server/dynamic_scenario_service_default.cfg new file mode 100644 index 000000000..e6d5942ac --- /dev/null +++ b/code/ryzom/server/dynamic_scenario_service_default.cfg @@ -0,0 +1,9 @@ + +DelayBeforeStartAct = 1; +MaxNpcs = 300; +MaxStaticObjects = 200; + +StartCommands += +{ + "unifiedNetwork.addService ShardUnifier ( address="+SUAddress+" sendId external autoRetry )", +}; diff --git a/code/ryzom/server/src/CMakeLists.txt b/code/ryzom/server/src/CMakeLists.txt index c338d5875..3e3ef3c5b 100644 --- a/code/ryzom/server/src/CMakeLists.txt +++ b/code/ryzom/server/src/CMakeLists.txt @@ -1,29 +1,30 @@ +# Supporting modules and libraries. ADD_SUBDIRECTORY(admin_modules) ADD_SUBDIRECTORY(server_share) ADD_SUBDIRECTORY(ai_share) ADD_SUBDIRECTORY(gameplay_module_lib) ADD_SUBDIRECTORY(pd_lib) -ADD_SUBDIRECTORY(frontend_service) -ADD_SUBDIRECTORY(entities_game_service) +# Ryzom Services ADD_SUBDIRECTORY(ai_service) ADD_SUBDIRECTORY(backup_service) ADD_SUBDIRECTORY(dynamic_scenario_service) +ADD_SUBDIRECTORY(entities_game_service) +ADD_SUBDIRECTORY(frontend_service) +ADD_SUBDIRECTORY(gpm_service) +ADD_SUBDIRECTORY(input_output_service) + # Deprecated, no longer used. +#ADD_SUBDIRECTORY(ags_test) #ADD_SUBDIRECTORY(ai_data_service) #ADD_SUBDIRECTORY(entity_view_service) #ADD_SUBDIRECTORY(general_utilities_service) +#ADD_SUBDIRECTORY(patchman_service) -#ags_test -# -# -# - -# #gpm_service -#input_output_service +# #log_analyser_service #logger_service #mail_forum_service diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index 0288a67ef..f45122431 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -5660,7 +5660,8 @@ bool CCharacter::onAnimalHungry( uint petIndex, bool justBecameHungry ) { // Consume to full satiety (last useful unit is entirely consumed) animal.Satiety = animal.MaxSatiety; - nbUnits = (sint)((caloriesNeeded / caloriesPerUnit) + 1); + nbUnits = (sint)ceil(caloriesNeeded / caloriesPerUnit); + } nbItemsLeftToConsume -= nbUnits; diff --git a/code/ryzom/server/src/frontend_service/client_host.h b/code/ryzom/server/src/frontend_service/client_host.h index c284567d9..a8e377a29 100644 --- a/code/ryzom/server/src/frontend_service/client_host.h +++ b/code/ryzom/server/src/frontend_service/client_host.h @@ -33,7 +33,7 @@ #include "entity_container.h" #include "game_share/ryzom_entity_id.h" #include "game_share/entity_types.h" -#include "../../nelns/welcome_service/welcome_service_itf.h" +#include "game_share/welcome_service_itf.h" #include #include diff --git a/code/ryzom/server/src/gpm_service/CMakeLists.txt b/code/ryzom/server/src/gpm_service/CMakeLists.txt new file mode 100644 index 000000000..80ed486bc --- /dev/null +++ b/code/ryzom/server/src/gpm_service/CMakeLists.txt @@ -0,0 +1,24 @@ +FILE(GLOB SRC *.cpp *.h) + +ADD_EXECUTABLE(gpm_service ${SRC}) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/src ${LIBXML2_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) +TARGET_LINK_LIBRARIES(gpm_service admin_modules + game_share + server_share + ${PLATFORM_LINKFLAGS} + ${LIBXML2_LIBRARIES} + ${NELMISC_LIBRARY} + ${NELNET_LIBRARY} + ${NELPACS_LIBRARY} + ${NELGEORGES_LIBRARY} + ${NELLIGO_LIBRARY}) +IF(WIN32) + SET_TARGET_PROPERTIES(gpm_service PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:libcmt /SUBSYSTEM:WINDOWS" + PROJECT_LABEL "Services: Global Position Manager Service (GPMS)") +ENDIF(WIN32) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +INSTALL(TARGETS gpm_service RUNTIME DESTINATION sbin COMPONENT services) + diff --git a/code/ryzom/server/src/input_output_service/CMakeLists.txt b/code/ryzom/server/src/input_output_service/CMakeLists.txt new file mode 100644 index 000000000..ae87eedb1 --- /dev/null +++ b/code/ryzom/server/src/input_output_service/CMakeLists.txt @@ -0,0 +1,35 @@ +FILE(GLOB SRC *.cpp *.h) + +LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/bot_chat_manager.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/bot_chat_manager.h + ${CMAKE_CURRENT_SOURCE_DIR}/ios_chat_log.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ios_chat_log.h + ${CMAKE_CURRENT_SOURCE_DIR}/ios_chat_log_inline.h + ${CMAKE_CURRENT_SOURCE_DIR}/ios_pd.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ios_pd.h + ${CMAKE_CURRENT_SOURCE_DIR}/ios_pd_inline.h) + +ADD_EXECUTABLE(ios_service ${SRC}) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/src ${LIBXML2_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) +TARGET_LINK_LIBRARIES(ios_service admin_modules + pd_lib + game_share + server_share + ${PLATFORM_LINKFLAGS} + ${LIBXML2_LIBRARIES} + ${NELMISC_LIBRARY} + ${NELNET_LIBRARY} + ${NELPACS_LIBRARY} + ${NELGEORGES_LIBRARY} + ${NELLIGO_LIBRARY}) +IF(WIN32) + SET_TARGET_PROPERTIES(ios_service PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:libcmt /SUBSYSTEM:WINDOWS" + PROJECT_LABEL "Services: Input Ouput Service (IOS)") +ENDIF(WIN32) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +INSTALL(TARGETS ios_service RUNTIME DESTINATION sbin COMPONENT services) + + diff --git a/code/ryzom/server/src/patchman_service/CMakeLists.txt b/code/ryzom/server/src/patchman_service/CMakeLists.txt new file mode 100644 index 000000000..aeffe1b6c --- /dev/null +++ b/code/ryzom/server/src/patchman_service/CMakeLists.txt @@ -0,0 +1,31 @@ +FILE(GLOB SRC *.cpp *.h) + +LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/Backup\ 1\ of\ file_repository.h + ${CMAKE_CURRENT_SOURCE_DIR}/rr_module_itf.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rr_module_itf.h) + +ADD_EXECUTABLE(patchman_service ${SRC}) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/server/src ${LIBXML2_INCLUDE_DIR} ${MYSQL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) +TARGET_LINK_LIBRARIES(patchman_service admin_modules + game_share + server_share + ${PLATFORM_LINKFLAGS} + ${LIBXML2_LIBRARIES} + ${MYSQL_LIBRARIES} + ${ZLIB_LIBRARIES} + ${NELMISC_LIBRARY} + ${NELNET_LIBRARY} + ${NELPACS_LIBRARY} + ${NELGEORGES_LIBRARY} + ${NELLIGO_LIBRARY}) +IF(WIN32) + SET_TARGET_PROPERTIES(patchman_service PROPERTIES + LINK_FLAGS "/NODEFAULTLIB:libcmt /SUBSYSTEM:WINDOWS" + PROJECT_LABEL "Services: Patch Manager (PMS)") +ENDIF(WIN32) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +INSTALL(TARGETS patchman_service RUNTIME DESTINATION sbin COMPONENT services) + + diff --git a/code/ryzom/server/src/patchman_service/deployment_configuration_synchroniser.h b/code/ryzom/server/src/patchman_service/deployment_configuration_synchroniser.h index e5b4c8603..2ab136413 100644 --- a/code/ryzom/server/src/patchman_service/deployment_configuration_synchroniser.h +++ b/code/ryzom/server/src/patchman_service/deployment_configuration_synchroniser.h @@ -23,7 +23,7 @@ //----------------------------------------------------------------------------- // game share -#include "game_share/deployment_configuration.h" +//#include "game_share/deployment_configuration.h" // local #include "module_admin_itf.h" diff --git a/code/ryzom/server/src/patchman_service/file_receiver.h b/code/ryzom/server/src/patchman_service/file_receiver.h index 7e006e3d2..b58180dac 100644 --- a/code/ryzom/server/src/patchman_service/file_receiver.h +++ b/code/ryzom/server/src/patchman_service/file_receiver.h @@ -23,7 +23,7 @@ //----------------------------------------------------------------------------- // game share -#include "game_share/deployment_configuration.h" +//#include "game_share/deployment_configuration.h" // local #include "module_admin_itf.h" diff --git a/code/ryzom/server/src/patchman_service/file_repository.h b/code/ryzom/server/src/patchman_service/file_repository.h index edd26fe69..daebd896d 100644 --- a/code/ryzom/server/src/patchman_service/file_repository.h +++ b/code/ryzom/server/src/patchman_service/file_repository.h @@ -45,7 +45,7 @@ #include "nel/net/module_builder_parts.h" // game share -#include "game_share/deployment_configuration.h" +//#include "game_share/deployment_configuration.h" // local #include "module_admin_itf.h" diff --git a/code/ryzom/server/src/patchman_service/mysql_wrapper_stub.cpp b/code/ryzom/server/src/patchman_service/mysql_wrapper_stub.cpp index 942f7f6cf..43b7df9bc 100644 --- a/code/ryzom/server/src/patchman_service/mysql_wrapper_stub.cpp +++ b/code/ryzom/server/src/patchman_service/mysql_wrapper_stub.cpp @@ -14,5 +14,5 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "game_share/mysql_wrapper.cpp" +#include "server_share/mysql_wrapper.cpp" diff --git a/code/ryzom/server/src/patchman_service/repository.cpp b/code/ryzom/server/src/patchman_service/repository.cpp index f89e17995..b71c11ef2 100644 --- a/code/ryzom/server/src/patchman_service/repository.cpp +++ b/code/ryzom/server/src/patchman_service/repository.cpp @@ -36,11 +36,14 @@ using namespace std; using namespace NLMISC; - //------------------------------------------------------------------------------------------------- // constants & utilities //------------------------------------------------------------------------------------------------- +// From spa_server_patch_applier.cpp +extern void writeVersionFile(const NLMISC::CSString& fileName, uint32 version); +extern uint32 readVersionFile(const NLMISC::CSString& fileName); + NLMISC::CSString getRepositoryIndexFileName(const NLMISC::CSString& repositoryName) { return "repository_"+repositoryName+".idx"; @@ -380,7 +383,7 @@ CRepository::const_iterator CRepository::end() const return _Files.end(); } -void CRepository::fillShortList(TFileInfoVector &files) const +void CRepository::fillShortList(PATCHMAN::TFileInfoVector &files) const { // start by clearing out any previous contents in the files vector files.clear(); diff --git a/code/ryzom/server/src/patchman_service/repository.h b/code/ryzom/server/src/patchman_service/repository.h index 314f52768..ed8949c52 100644 --- a/code/ryzom/server/src/patchman_service/repository.h +++ b/code/ryzom/server/src/patchman_service/repository.h @@ -110,7 +110,7 @@ public: iterator end(); const_iterator end() const; - void fillShortList(TFileInfoVector &files) const; + void fillShortList(PATCHMAN::TFileInfoVector &files) const; private: diff --git a/code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp b/code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp index 857d6b847..42287fb87 100644 --- a/code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp +++ b/code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service.cpp @@ -1,12 +1,1147 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// Includes +// + +#include "nel/misc/types_nl.h" + +#include +#include + +#include "nel/misc/debug.h" +#include "nel/misc/command.h" +#include "nel/misc/variable.h" +#include "nel/misc/displayer.h" + +#include "nel/net/callback_server.h" +#include "nel/net/service.h" +#include "nel/net/module_manager.h" + +// +// Namespaces +// + +using namespace std; + +using namespace NLMISC; +using namespace NLNET; + + +NLMISC_COMMAND(test, "none", "none") +{ + log.displayNL("Raw cmd line : '%s'", rawCommandString.c_str()); + log.displayNL("Dumping %u parameters :", args.size()); + for (uint i=0; i &a, const string &n, TServiceId s) : SockId(sock), Addr(a), Name(n), SId (s), WaitingUnregistration(false) { } + + TSockId SockId; // the connection between the service and the naming service + vector Addr; // address to send to the service who wants to lookup this service + // it s possible to have more than one addr, anyway, the naming service + // will send good address depending of the sub net address of the service + string Name; // name of the service + TServiceId SId; // id of the service + + bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK) + TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process + list WaitingUnregistrationServices; // list of service that we wait the answer +}; + + + +// Helper that emulates layer5's send() +//void sendToService( uint16 sid, CMessage& msgout ); + +// Helper that emulate layer5's getServiceName() +string getServiceName( TServiceId sid ); + +// Helper that returns the first address of a service +CInetAddress getHostAddress( TServiceId sid ); + +// Asks a service to stop and tell every one +void doUnregisterService (TServiceId sid); extern void admin_modules_forceLink(); - - void foo() { admin_modules_forceLink(); } +/** + * Manager for services instances + * (Moved from the TICKS to the NS) + * Implementable with layer 5, here implemented in NS (layer 3) + * \author Olivier Cado + * \author Nevrax France + * \date 2003 + */ +class CServiceInstanceManager +{ +public: + + /// Constructor + CServiceInstanceManager(); -#include "../../nelns/naming_service/naming_service.cpp" + /** Add the name of a service which must not be duplicated + * If uniqueOnShard is true, only one service is allowed. + * If uniqueOnShard is false, one service is allowed by physical machine. + */ + void addUniqueService( const std::string& serviceName, bool uniqueOnShard ) + { + _UniqueServices.insert( std::make_pair( serviceName, uniqueOnShard ) ); + } + + /// Check if a service is allowed to start (if so, add it) + bool queryStartService( const std::string& serviceName, TServiceId serviceId, const std::vector &addr, string& reason ); + + /// Release a service instance + void releaseService( NLNET::TServiceId serviceId ); + + /// Display information + void displayInfo( NLMISC::CLog *log = NLMISC::InfoLog ) const; + + /// Make all controlled services quit + void killAllServices(); + +private: + + /// List of restricted services + std::map< std::string, bool > _UniqueServices; + + /// List of granted (online) services + std::set< TServiceId > _OnlineServices; +}; + + +CServiceInstanceManager *SIMInstance = NULL; + + +/* + * Constructor + */ +CServiceInstanceManager::CServiceInstanceManager() +{ + nlassert( ! SIMInstance ); + SIMInstance = this; + + // Note: addCallbackArray() done in CRangeMirrorManager::init() +} + + +/* + * Check if a service is allowed to start. Answer with a GSTS (Grant Start Service) message + */ +bool CServiceInstanceManager::queryStartService( const std::string& serviceName, TServiceId serviceId, const vector &addr, string& reason ) +{ + bool grantStarting = true; + std::map< std::string, bool >::iterator ius = _UniqueServices.find( serviceName ); + if ( ius != _UniqueServices.end() ) + { + // Service is restricted + set< TServiceId >::iterator ios; + bool uniqueOnShard = (*ius).second; + for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) + { + string name = getServiceName( *ios ); + if ( name == serviceName ) + { + if ( uniqueOnShard ) + { + // Only one service by shard is allowed => deny + grantStarting = false; + reason = toString( "Service %s already found as %hu, must be unique on shard", serviceName.c_str(), ios->get() ); + nlinfo( reason.c_str() ); + break; + } + else + { + // Only one service by physical machine is allowed + + // Implementation for layer5 + //TSockId hostid1, hostid2; + /*CCallbackNetBase *cnb1 = CUnifiedNetwork::getInstance()->getNetBase( serviceId, hostid1 ); + CCallbackNetBase *cnb2 = CUnifiedNetwork::getInstance()->getNetBase( *ios, hostid2 ); + if ( cnb1->hostAddress( hostid1 ).internalIPAddress() == cnb2->hostAddress( hostid2 ).internalIPAddress() )*/ + + // Implementation for NS + if ( addr[0].internalIPAddress() == getHostAddress( *ios ).internalIPAddress() ) + { + grantStarting = false; + reason = toString( "Service %s already found as %hu on same machine", serviceName.c_str(), ios->get() ); + nlinfo( reason.c_str() ); + break; + } + } + } + } + } + + if ( grantStarting ) + { + _OnlineServices.insert( serviceId ); + } + return grantStarting; +} + + +/* + * Release a service instance + */ +void CServiceInstanceManager::releaseService( NLNET::TServiceId serviceId ) +{ + _OnlineServices.erase( serviceId ); // not a problem if not found +} + + +/* + * Display information + */ +void CServiceInstanceManager::displayInfo( NLMISC::CLog *log ) const +{ + log->displayNL( "Restricted services:" ); + std::map< std::string, bool >::const_iterator ius; + for ( ius=_UniqueServices.begin(); ius!=_UniqueServices.end(); ++ius ) + { + log->displayNL( "%s -> only one per %s", (*ius).first.c_str(), (*ius).second?"shard":"machine" ); + } + log->displayNL( "Online registered services:" ); + std::set< TServiceId >::const_iterator ios; + for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) + { + log->displayNL( "%s", CUnifiedNetwork::getInstance()->getServiceUnifiedName( *ios ).c_str() ); + } +} + + +/* + * Make all controlled services quit + */ +void CServiceInstanceManager::killAllServices() +{ + // Send to all known online services + std::set< TServiceId >::const_iterator ios; + for ( ios=_OnlineServices.begin(); ios!=_OnlineServices.end(); ++ios ) + { + doUnregisterService( (TServiceId)(*ios) ); + } +} + + + +// +// Variables +// + +list RegisteredServices; /// List of all registred services + +uint16 MinBasePort = 51000; /// Ports begin at 51000 +uint16 MaxBasePort = 52000; /// (note: in this implementation there can be no more than 1000 services) + +const TServiceId BaseSId(128); /// Allocated SIds begin at 128 (except for Agent Service) + +const TTime UnregisterTimeout = 10000; /// After 10s we remove an unregister service if every server didn't ACK the message + +CCallbackServer *CallbackServer = NULL; + +// +// Functions +// + +bool canAccess (const vector &addr, const CServiceEntry &entry, vector &accessibleAddr) +{ + accessibleAddr.clear (); + + if (entry.WaitingUnregistration) + return false; + + for (uint i = 0; i < addr.size(); i++) + { + uint32 net = addr[i].internalNetAddress(); + for (uint j = 0; j < entry.Addr.size(); j++) + { + if (net == entry.Addr[j].internalNetAddress()) + { + accessibleAddr.push_back (entry.Addr[j]); + } + } + } + + if (accessibleAddr.empty()) + { + nldebug ("service %s-%hu is not accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (addr).c_str ()); + } + else + { + nldebug ("service %s-%hu is accessible by '%s'", entry.Name.c_str(), entry.SId.get(), vectorCInetAddressToString (accessibleAddr).c_str ()); + } + + return !accessibleAddr.empty (); +} + +void displayRegisteredServices (CLog *log = InfoLog) +{ + log->displayNL ("Display the %d registered services :", RegisteredServices.size()); + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + TSockId id = (*it).SockId; + if (id == NULL) + { + log->displayNL ("> %s-%hu %s '%s' %s %d addr", (*it).Name.c_str(), it->SId.get(), "", "", (*it).WaitingUnregistration?"WaitUnreg":"", (*it).Addr.size()); + for(uint i = 0; i < (*it).Addr.size(); i++) + log->displayNL (" '%s'", (*it).Addr[i].asString().c_str()); + } + else + { + log->displayNL ("> %s-%hu %s '%s' %s %d addr", (*it).Name.c_str(), it->SId.get(), (*it).SockId->asString().c_str(), CallbackServer->hostAddress((*it).SockId).asString().c_str(), (*it).WaitingUnregistration?"WaitUnreg":"", (*it).Addr.size()); + for(uint i = 0; i < (*it).Addr.size(); i++) + log->displayNL (" '%s'", (*it).Addr[i].asString().c_str()); + } + } + log->displayNL ("End of the list"); +} + + +list::iterator effectivelyRemove (list::iterator &it) +{ + // remove the service from the registered service list + nlinfo ("Effectively remove the service %s-%hu", (*it).Name.c_str(), it->SId.get()); + return RegisteredServices.erase (it); +} + +/* + * Helper procedure for cbLookupAlternate and cbUnregister. + * Note: name is used for a LOGS. + */ +list::iterator doRemove (list::iterator it) +{ + nldebug ("Unregister the service %s-%hu '%s'", (*it).Name.c_str(), it->SId.get(), (*it).Addr[0].asString().c_str()); + + // tell to everybody that this service is unregistered + + CMessage msgout ("UNB"); + msgout.serial ((*it).Name); + msgout.serial ((*it).SId); + + vector accessibleAddress; + nlinfo ("Broadcast the Unregistration of %s-%hu to all registered services", (*it).Name.c_str(), it->SId.get()); + for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end (); it3++) + { + if (canAccess((*it).Addr, (*it3), accessibleAddress)) + { + CallbackServer->send (msgout, (*it3).SockId); + //CNetManager::send ("NS", msgout, (*it3).SockId); + nldebug ("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); + } + } + + // new system, after the unregistation broadcast, we wait ACK from all services before really remove + // the service, before, we tag the service as 'wait before unregister' + // if everybody didn't answer before the time out, we remove it + + (*it).SockId = NULL; + + (*it).WaitingUnregistration = true; + (*it).WaitingUnregistrationTime = CTime::getLocalTime(); + + // we remove all services awaiting his ACK because this service is down so it'll never ACK + for (list::iterator itr = RegisteredServices.begin(); itr != RegisteredServices.end (); itr++) + { + for (list::iterator itw = (*itr).WaitingUnregistrationServices.begin(); itw != (*itr).WaitingUnregistrationServices.end ();) + { + if ((*itw) == (*it).SId) + { + itw = (*itr).WaitingUnregistrationServices.erase (itw); + } + else + { + itw++; + } + } + } + + string res; + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) + { + if (!(*it2).WaitingUnregistration) + { + (*it).WaitingUnregistrationServices.push_back ((*it2).SId); + res += toString((*it2).SId.get()) + " "; + } + } + + nlinfo ("Before removing the service %s-%hu, we wait the ACK of '%s'", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); + + if ((*it).WaitingUnregistrationServices.empty()) + { + return effectivelyRemove (it); + } + else + { + return ++it; + } + + // Release from the service instance manager + SIMInstance->releaseService( (*it).SId ); +} + +void doUnregisterService (TServiceId sid) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + // found it, remove it + doRemove (it); + return; + } + } + nlwarning ("Service %hu not found", sid.get()); +} + +void doUnregisterService (TSockId from) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end ();) + { + if ((*it).SockId == from) + { + // it's possible that one "from" have more than one registred service, so we have to find in all the list + // found it, remove it + it = doRemove (it); + } + else + { + it++; + } + } +} + +/*void doUnregisterService (const CInetAddress &addr) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).Addr == addr) + { + // found it, remove it + doRemove (it); + return; + } + } + nlwarning ("Service %s not found", addr.asString().c_str()); +}*/ + +/* + * Helper function for cbRegister. + * If alloc_sid is true, sid is ignored + * Returns false in case of failure of sid allocation or bad sid provided + * Note: the reply is included in this function, because it must be done before things such as syncUniTime() + */ +bool doRegister (const string &name, const vector &addr, TServiceId sid, TSockId from, CCallbackNetBase &netbase, bool reconnection = false) +{ + // Find if the service is not already registered + string reason; + uint8 ok = true; + bool needRegister = true; + /*for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).Addr.asIPString() == addr.asIPString() ) + { + // we already have a service on this address, remplace it if it's the same name + if ((*it).Name == name) + { + // it's the same service, replace it + (*it).SockId = from; + sid = (*it).SId; + nlinfo ("Replace the service %s", name.c_str()); + } + else + { + nlwarning ("Try to register %s to %s but the service %s already on this address. ignore it!", name.c_str(), addr.asIPString().c_str(), (*it).Name.c_str()); + ok = false; + } + needRegister = false; + break; + } + }*/ + + if (needRegister) + { + if (sid.get() == 0) + { + // we have to find a sid + sid = BaseSId; + bool found = false; + while (!found) + { + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + break; + } + } + if (it == RegisteredServices.end ()) + { + // ok, we have an empty sid + found = true; + } + else + { + sid.set(sid.get()+1); + if (sid.get() == 0) // round the clock + { + nlwarning ("Service identifier allocation overflow"); + ok = false; + break; + } + } + } + + } + else + { + // we have to check that the user provided sid is available + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + nlwarning ("Sid %d already used by another service", sid.get()); + ok = false; + break; + } + } + if (it != RegisteredServices.end ()) + { + ok = true; + } + } + + // if ok, register the service and send a broadcast to other people + if (ok) + { + // Check if the instance is allowed to start, according to the restriction in the config file + if ( SIMInstance->queryStartService( name, sid, addr, reason ) ) + { + // add him in the registered list + RegisteredServices.push_back (CServiceEntry(from, addr, name, sid)); + + // tell to everybody but not him that this service is registered + if (!reconnection) + { + CMessage msgout ("RGB"); + TServiceId::size_type s = 1; + msgout.serial (s); + msgout.serial (const_cast(name)); + msgout.serial (sid); + // we need to send all addr to all services even if the service can't access because we use the address index + // to know which connection comes. + msgout.serialCont (const_cast &>(addr)); + nlinfo ("The service is %s-%d, broadcast the Registration to everybody", name.c_str(), sid.get()); + + vector accessibleAddress; + for (list::iterator it3 = RegisteredServices.begin(); it3 != RegisteredServices.end (); it3++) + { + // send only services that can be accessed and not itself + if ((*it3).SId != sid && canAccess(addr, (*it3), accessibleAddress)) + { + CallbackServer->send (msgout, (*it3).SockId); + //CNetManager::send ("NS", msgout, (*it3).SockId); + nldebug ("Broadcast to %s-%hu", (*it3).Name.c_str(), it3->SId.get()); + } + } + } + + // set the sid only if it s ok + from->setAppId (sid.get()); + } + else + { + // Reply "startup denied", and do not send registration to other services + ok = false; + } + } + + // send the message to the service to say if it s ok or not + if (!reconnection) + { + // send the answer to the client + CMessage msgout ("RG"); + msgout.serial (ok); + if (ok) + { + msgout.serial (sid); + + // send him all services available (also itself) + TServiceId::size_type nb = 0; + + vector accessibleAddress; + + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) + { + // send only services that are available + if (canAccess(addr, (*it2), accessibleAddress)) + nb++; + } + msgout.serial (nb); + + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + // send only services that are available + if (canAccess(addr, (*it), accessibleAddress)) + { + msgout.serial ((*it).Name); + msgout.serial ((*it).SId); + msgout.serialCont ((*it).Addr); + } + } + } + else + { + msgout.serial( reason ); + } + + netbase.send (msgout, from); + netbase.flush (from); + } + } + + //displayRegisteredServices (); + + return ok!=0; +} + +void checkWaitingUnregistrationServices () +{ + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end ();) + { + if ((*it).WaitingUnregistration && ((*it).WaitingUnregistrationServices.empty() || CTime::getLocalTime() > (*it).WaitingUnregistrationTime + UnregisterTimeout)) + { + if ((*it).WaitingUnregistrationServices.empty()) + { + nlinfo ("Removing the service %s-%hu because all services ACKd the removal", (*it).Name.c_str(), (*it).SId.get()); + } + else + { + string res; + for (list::iterator it2 = (*it).WaitingUnregistrationServices.begin(); it2 != (*it).WaitingUnregistrationServices.end (); it2++) + { + res += toString(it2->get()) + " "; + } + nlwarning ("Removing the service %s-%hu because time out occurs (service numbers %s didn't ACK)", (*it).Name.c_str(), (*it).SId.get(), res.c_str()); + } + it = effectivelyRemove (it); + } + else + { + it++; + } + } +} + + +/** + * Callback for service unregistration ACK. Mean that a service was ACK the unregistration broadcast + */ +static void cbACKUnregistration (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) +{ + TServiceId sid; + msgin.serial (sid); + + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid && (*it).WaitingUnregistration) + { + for (list::iterator it2 = (*it).WaitingUnregistrationServices.begin(); it2 != (*it).WaitingUnregistrationServices.end (); it2++) + { + if (*it2 == TServiceId(uint16(from->appId()))) + { + // remove the acked service + (*it).WaitingUnregistrationServices.erase (it2); + checkWaitingUnregistrationServices (); + return; + } + } + } + } +} + + +/** + * Callback for service registration when the naming service goes down and up (don't need to broadcast) + */ +static void cbResendRegisteration (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) +{ + string name; + vector addr; + TServiceId sid; + msgin.serial (name); + msgin.serialCont (addr); + msgin.serial (sid); + + doRegister (name, addr, sid, from, netbase, true); +} + + + +/** + * Callback for service registration. + * + * Message expected : RG + * - Name of service to register (string) + * - Address of service (CInetAddress) + * + * Message emitted : RG + * - Allocated service identifier (TServiceId) or 0 if failed + */ +static void cbRegister (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) +{ + string name; + vector addr; + TServiceId sid; + msgin.serial (name); + msgin.serialCont (addr); + msgin.serial (sid); + + doRegister (name, addr, sid, from, netbase); +} + + +/** + * Callback for service unregistration. + * + * Message expected : UNI + * - Service identifier (TServiceId) + */ +static void cbUnregisterSId (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) +{ + TServiceId sid; + msgin.serial( sid ); + + doUnregisterService (sid); + //displayRegisteredServices (); +} + + +/* + * Helper function for cbQueryPort + * + * \warning QueryPort + Registration is not atomic so more than one service could ask a port before register + */ +uint16 doAllocatePort (const CInetAddress &addr) +{ + static uint16 nextAvailablePort = MinBasePort; + + // check if nextavailableport is free + + if (nextAvailablePort >= MaxBasePort) nextAvailablePort = MinBasePort; + + bool ok; + do + { + ok = true; + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).Addr[0].port () == nextAvailablePort) + { + nextAvailablePort++; + ok = false; + break; + } + } + } + while (!ok); + + return nextAvailablePort++; +} + + +/** + * Callback for port allocation + * Note: if a service queries a port but does not register itself to the naming service, the + * port will remain allocated and unused. + * + * Message expected : QP + * - Name of service to register (string) + * - Address of service (CInetAddress) (its port can be 0) + * + * Message emitted : QP + * - Allocated port number (uint16) + */ +static void cbQueryPort (CMessage& msgin, TSockId from, CCallbackNetBase &netbase) +{ + // Allocate port + uint16 port = doAllocatePort (netbase.hostAddress (from)); + + // Send port back + CMessage msgout ("QP"); + msgout.serial (port); + netbase.send (msgout, from); + + nlinfo ("The service got port %hu", port); +} + + +/* + * Unregisters a service if it has not been done before. + * Note: this callback is called whenever someone disconnects from the NS. + * May be there are too many calls if many clients perform many transactional lookups. + */ +static void cbDisconnect /*(const string &serviceName, TSockId from, void *arg)*/ ( TSockId from, void *arg ) +{ + doUnregisterService (from); + //displayRegisteredServices (); +} + +/* + * a service is connected, send him all services infos + */ +static void cbConnect /*(const string &serviceName, TSockId from, void *arg)*/ ( TSockId from, void *arg ) +{ + // we have to wait the registred services message to send all services because it this points, we can't know which sub net + // the service can use + + //displayRegisteredServices (); + + // set the appid with a bad id (-1) + from->setAppId (~0); +} + +/*// returns the list of accessible services with a list of address +static void cbRegisteredServices(CMessage& msgin, TSockId from, CCallbackNetBase &netbase) +{ + vector addr; + msgin.serialCont (addr); + + nlinfo ("New service ask me the available services, sending him all services available"); + // send to the new service the list of all services that this service can access (depending of his sub net) + + CMessage msgout ("RGB"); + + uint8 nb = 0; + + vector accessibleAddress; + + for (list::iterator it2 = RegisteredServices.begin(); it2 != RegisteredServices.end (); it2++) + { + // send only services that are available + if (canAccess(addr, (*it2), accessibleAddress)) + nb++; + } + + msgout.serial (nb); + + for (list::iterator it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + // send only services that are available + if (canAccess(addr, (*it), accessibleAddress)) + { + msgout.serial ((*it).Name); + msgout.serial ((*it).SId); + msgout.serialCont (accessibleAddress); + } + } + + CNetManager::send ("NS", msgout, from); +}*/ + + +/* + * Helper that emulates layer5 send() + */ +/*void sendToService( uint16 sid, CMessage& msgout ) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + CallbackServer->send (msgout, (*it).SockId); + } + } +}*/ + + +/* + * Helper that emulate layer5's getServiceName() + */ +string getServiceName( TServiceId sid ) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + return (*it).Name; + } + } + return ""; // not found +} + + +/* + * Helper that returns the first address of a service + */ +CInetAddress getHostAddress( TServiceId sid ) +{ + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).SId == sid) + { + return (*it).Addr[0]; + } + } + return CInetAddress(); +} + + +// +// Callback array +// + +TCallbackItem CallbackArray[] = +{ + { "RG", cbRegister }, + { "RRG", cbResendRegisteration }, + { "QP", cbQueryPort }, + { "UNI", cbUnregisterSId }, + { "ACK_UNI", cbACKUnregistration }, +// { "RS", cbRegisteredServices }, +}; + + +// +// Service +// + +class CNamingService : public NLNET::IService +{ +public: + + /** + * Init + */ + void init() + { + // if a baseport is available in the config file, get it + CConfigFile::CVar *var; + if ((var = ConfigFile.getVarPtr ("BasePort")) != NULL) + { + uint16 newBasePort = var->asInt (); + nlinfo ("Changing the MinBasePort number from %hu to %hu", MinBasePort, newBasePort); + sint32 delta = MaxBasePort - MinBasePort; + nlassert (delta > 0); + MinBasePort = newBasePort; + MaxBasePort = MinBasePort + uint16 (delta); + } + + // Parameters for the service instance manager + try + { + CConfigFile::CVar& uniqueServices = ConfigFile.getVar("UniqueOnShardServices"); + for ( uint i=0; i!=uniqueServices.size(); ++i ) + { + _ServiceInstances.addUniqueService( uniqueServices.asString(i), true ); + } + } + catch(Exception &) + {} + try + { + CConfigFile::CVar& uniqueServicesM = ConfigFile.getVar("UniqueByMachineServices"); + for ( uint i=0; i!=uniqueServicesM.size(); ++i ) + { + _ServiceInstances.addUniqueService( uniqueServicesM.asString(i), false ); + } + } + catch(Exception &) + {} + +/* + // we don't try to associate message from client + CNetManager::getNetBase ("NS")->ignoreAllUnknownId (true); + + // add the callback in case of disconnection + CNetManager::setConnectionCallback ("NS", cbConnect, NULL); + + // add the callback in case of disconnection + CNetManager::setDisconnectionCallback ("NS", cbDisconnect, NULL); +*/ + // DEBUG + // DebugLog->addDisplayer( new CStdDisplayer() ); + + vector v = CInetAddress::localAddresses(); + nlinfo ("%d detected local addresses:", v.size()); + for (uint i = 0; i < v.size(); i++) + { + nlinfo (" %d - '%s'",i, v[i].asString().c_str()); + } + + uint16 nsport = 50000; + if ((var = ConfigFile.getVarPtr ("NSPort")) != NULL) + { + nsport = var->asInt (); + } + + CallbackServer = new CCallbackServer; + CallbackServer->init(nsport); + CallbackServer->addCallbackArray(CallbackArray, sizeof(CallbackArray)/sizeof(CallbackArray[0])); + CallbackServer->setConnectionCallback(cbConnect, NULL); + CallbackServer->setDisconnectionCallback(cbDisconnect, NULL); + } + + /** + * Update + */ + bool update () + { + checkWaitingUnregistrationServices (); + + CallbackServer->update (); + + return true; + } + + void release() + { + if (CallbackServer != NULL) + delete CallbackServer; + CallbackServer = NULL; + } + +private: + + /// Service instance manager singleton + CServiceInstanceManager _ServiceInstances; +}; + + +static const char* getCompleteServiceName(const IService* theService) +{ + static std::string s; + s= "naming_service"; + + if (theService->haveLongArg("nsname")) + { + s+= "_"+theService->getLongArg("nsname"); + } + + if (theService->haveLongArg("fullnsname")) + { + s= theService->getLongArg("fullnsname"); + } + + return s.c_str(); +} + +static const char* getShortServiceName(const IService* theService) +{ + static std::string s; + s= "NS"; + + if (theService->haveLongArg("shortnsname")) + { + s= theService->getLongArg("shortnsname"); + } + + return s.c_str(); +} +// +/// Naming Service +// +NLNET_SERVICE_MAIN( CNamingService, getShortServiceName(scn), getCompleteServiceName(scn), 0, EmptyCallbackArray, "", "") + + +// +// Commands +// + + +NLMISC_COMMAND (nsServices, "displays the list of all registered services", "") +{ + if(args.size() != 0) return false; + + displayRegisteredServices (&log); + + return true; +} + +NLMISC_COMMAND (kill, "kill a service and send an unregister broadcast to other service", "|") +{ + if(args.size() != 1) return false; + + // try with number + + TServiceId sid(atoi(args[0].c_str())); + + if(sid.get() == 0) + { + // not a number, try a name + list::iterator it; + for (it = RegisteredServices.begin(); it != RegisteredServices.end (); it++) + { + if ((*it).Name == args[0]) + { + sid = (*it).SId; + break; + } + } + if (it == RegisteredServices.end()) + { + log.displayNL ("Bad service name or id '%s'", args[0].c_str()); + return false; + } + } + + doUnregisterService (sid); + return true; +} + +NLMISC_DYNVARIABLE(uint32, NbRegisteredServices, "display the number of service that are registered in naming service") +{ + if (get) *pointer = RegisteredServices.size(); +} + +NLMISC_COMMAND( displayServiceInstances, "SIM: Display info on service instances", "" ) +{ + SIMInstance->displayInfo( &log ); + return true; +} + +NLMISC_COMMAND( killAllServices, "SIM: Make all the controlled services quit", "" ) +{ + SIMInstance->killAllServices(); + return true; +} diff --git a/code/ryzom/server/src/ryzom_welcome_service/Makefile b/code/ryzom/server/src/ryzom_welcome_service/Makefile index c93bec010..913850e01 100644 --- a/code/ryzom/server/src/ryzom_welcome_service/Makefile +++ b/code/ryzom/server/src/ryzom_welcome_service/Makefile @@ -14,6 +14,8 @@ CXXFLAGS = $(FLAGS_CMN) $(FLAGS_DBG_$(DBG)) \ LDFLAGS = $(LD_FLAGS_CMN) \ -L$(NEL_PATH)/lib \ -L../admin_modules \ + -L$(RYZOM_COMMON_SRC)/game_share \ + -lgame_share \ -lnelnet \ -lnelmisc \ -ladmin_modules \ diff --git a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp index 23166383a..bc2e366e2 100644 --- a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp +++ b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp @@ -1,4 +1,48 @@ +// NeLNS - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +#include "nel/misc/types_nl.h" + +#include +#include +#include + +#include + +#include "nel/misc/debug.h" +#include "nel/misc/config_file.h" +#include "nel/misc/displayer.h" +#include "nel/misc/command.h" +#include "nel/misc/variable.h" +#include "nel/misc/log.h" +#include "nel/misc/file.h" +#include "nel/misc/path.h" + +#include "nel/net/service.h" +#include "nel/net/unified_network.h" +#include "nel/net/login_cookie.h" + +#include "ryzom_welcome_service.h" + +#include "game_share/welcome_service_itf.h" + +using namespace std; +using namespace NLMISC; +using namespace NLNET; +using namespace WS; extern void admin_modules_forceLink(); @@ -8,5 +52,1527 @@ void foo() } -#include "../../../../nelns/welcome_service/welcome_service.cpp" -#include "../../../../nelns/welcome_service/welcome_service_itf.cpp" +CVariable PlayerLimit( + "ws","PlayerLimit", "Rough max number of players accepted on this shard (-1 for Unlimited)", + 5000, + 0, true ); + +// Forward declaration of callback cbShardOpen (see ShardOpen variable) +void cbShardOpen(IVariable &var); + +// Forward declaration of callback cbShardOpenStateFile (see ShardOpenStateFile variable) +void cbShardOpenStateFile(IVariable &var); + +// Forward declaration of callback cbUsePatchMode +void cbUsePatchMode(IVariable &var); + +// Types of open state +enum TShardOpenState +{ + ClosedForAll = 0, + OpenOnlyForAllowed = 1, + OpenForAll = 2 +}; + +static bool AllowDispatchMsgToLS = false; + +/** + * ShardOpen + * true if shard is open to public + * 0 means closed for all but :DEV: + * 1 means open only for groups in config file (see OpenGroups variable) and :DEV: + * 2 means open for all + */ +CVariable ShardOpen("ws", "ShardOpen", "Indicates if shard is open to public (0 closed for all but :DEV:, 1 open only for groups in cfg, 2 open for all)", 2, 0, true, cbShardOpen); + +/** + * ShardOpenStateFile + * true if shard is open to public + */ +CVariable ShardOpenStateFile("ws", "ShardOpenStateFile", "Name of the file that contains ShardOpen state", "", 0, true, cbShardOpenStateFile); + +/** + * OpenGroups + */ +CVariable OpenGroups("ws", "OpenGroups", "list of groups allowed at ShardOpen Level 1", "", 0, true); + +/** + * OpenFrontEndThreshold + * The FS balance algorithm works like this: + * - select the least loaded frontend + * - if this frontend has more than the OpenFrontEndThreshold + * - try to open a new frontend + * - reselect least loaded frontend + */ +CVariable OpenFrontEndThreshold("ws", "OpenFrontEndThreshold", "Limit number of players on all FS to decide to open a new FS", 800, 0, true ); + + +/** + * Use Patch mode + */ +CVariable UsePatchMode("ws", "UsePatchMode", "Use Frontends as Patch servers (at FS startup)", true, 0, true, cbUsePatchMode ); + +/** + * Use Patch mode + */ +CVariable DontUseLS("ws", "DontUseLS", "Don't use the login service", false, 0, true); + + +// Shortcut to the module instance +//CWelcomeServiceMod *CWelcomeServiceMod::_Instance = NULL; + + +/** + * Using expected services and current running service instances, this class + * reports a main "online status". + */ +class COnlineServices +{ +public: + + /// Set expected instances. Ex: { "TICKS", "FS", "FS", "FS" } + void setExpectedInstances( CConfigFile::CVar& var ) + { + // Reset "expected" counters (but don't clear the map, keep the running instances) + CInstances::iterator ici; + for ( ici=_Instances.begin(); ici!=_Instances.end(); ++ici ) + { + (*ici).second.Expected = 0; + } + // Rebuild "expected" counters + for ( uint i=0; i!=var.size(); ++i ) + { + ++_Instances[var.asString(i)].Expected; + } + } + + /// Add a service instance + void addInstance( const std::string& serviceName ) + { + ++_Instances[serviceName].Running; + } + + /// Remove a service instance + void removeInstance( const std::string& serviceName ) + { + CInstances::iterator ici = _Instances.find( serviceName ); + if ( ici != _Instances.end() ) + { + --(*ici).second.Running; + + // Remove from the map only if not part of the expected list + if ( ((*ici).second.Expected == 0) && ((*ici).second.Running == 0) ) + { + _Instances.erase( ici ); + } + } + else + { + nlwarning( "Can't remove instance of %s", serviceName.c_str() ); + } + } + + /// Check if all expected instances are online + bool getOnlineStatus() const + { + CInstances::const_iterator ici; + for ( ici=_Instances.begin(); ici!=_Instances.end(); ++ici ) + { + if ( ! ici->second.isOnlineAsExpected() ) + return false; + } + return true; + } + + /// Display contents + void display( NLMISC::CLog& log = *NLMISC::DebugLog ) + { + CInstances::const_iterator ici; + for ( ici=_Instances.begin(); ici!=_Instances.end(); ++ici ) + { + log.displayNL( "%s: %s (%u expected, %u running)", + (*ici).first.c_str(), + (*ici).second.Expected ? ((*ici).second.isOnlineAsExpected() ? "ONLINE" : "MISSING") : "OPTIONAL", + (*ici).second.Expected, (*ici).second.Running ); + } + } + +private: + + struct TInstanceCounters + { + TInstanceCounters() : Expected(0), Running(0) {} + + // If not expected, count as online as well + bool isOnlineAsExpected() const { return Running >= Expected; } + + uint Expected; + uint Running; + }; + + typedef std::map< std::string, TInstanceCounters > CInstances; + + CInstances _Instances; +}; + +/// Online services +COnlineServices OnlineServices; + + +/// Main online status +bool OnlineStatus; + +/// Send changes of status to the LS +void reportOnlineStatus( bool newStatus ) +{ + if ( newStatus != OnlineStatus && AllowDispatchMsgToLS ) + { + if (!DontUseLS) + { + CMessage msgout( "OL_ST" ); + msgout.serial( newStatus ); + CUnifiedNetwork::getInstance()->send( "LS", msgout ); + } + + if (CWelcomeServiceMod::isInitialized()) + { + // send a status report to welcome service client + CWelcomeServiceMod::getInstance()->reportWSOpenState(newStatus); + } + + OnlineStatus = newStatus; + } +} + + + +/// Set the version of the shard. you have to increase it each time the client-server protocol changes. +/// You have to increment the client too (the server and client version must be the same to run correctly) +static const uint32 ServerVersion = 1; + +/// Contains the correspondance between userid and the FES connection where the userid is connected. +map UserIdSockAssociations; + +// ubi hack +string FrontEndAddress; + + + +enum TFESState +{ + PatchOnly, + AcceptClientOnly +}; + +struct CFES +{ + CFES (TServiceId sid) : SId(sid), NbPendingUsers(0), NbUser(0), State(PatchOnly) { } + + TServiceId SId; // Connection to the front end + uint32 NbPendingUsers; // Number of not yet connected users (but rooted to this frontend) + uint32 NbUser; // Number of user currently connected on this front end + + TFESState State; // State of frontend (patching/accepting clients) + std::string PatchAddress; // Address of frontend patching server + + uint32 getUsersCountHeuristic() const + { + return NbUser + NbPendingUsers; + } + + void setToAcceptClients() + { + if (State == AcceptClientOnly) + return; + + // tell FS to accept client + State = AcceptClientOnly; + CMessage msgOpenFES("FS_ACCEPT"); + CUnifiedNetwork::getInstance()->send(SId, msgOpenFES); + + // report state to LS + bool dummy; + reportStateToLS(dummy, true); + } + + void reportStateToLS(bool& reportPatching, bool alive = true) + { + // report to LS + + bool patching = (State == PatchOnly); + if (alive && patching) + reportPatching = true; + + if ( AllowDispatchMsgToLS ) + { + if (!DontUseLS) + { + CMessage msgout("REPORT_FS_STATE"); + msgout.serial(SId); + msgout.serial(alive); + msgout.serial(patching); + msgout.serial(PatchAddress); + CUnifiedNetwork::getInstance()->send("LS", msgout); + } + } + } +}; + +list FESList; + +/* + * Find the best front end service for a new connecting user (return NULL if there is no suitable FES). + * Additionally, calculate totalNbUsers. + */ +CFES *findBestFES ( uint& totalNbUsers ) +{ + totalNbUsers = 0; + + CFES* best = NULL; + + for (list::iterator it=FESList.begin(); it!=FESList.end(); ++it) + { + CFES &fes = *it; + if (fes.State == AcceptClientOnly) + { + if (best == NULL || best->getUsersCountHeuristic() > fes.getUsersCountHeuristic()) + best = &fes; + + totalNbUsers += fes.NbUser; + } + + } + + return best; +} + +/** + * Select a frontend in patch mode to open + * Returns true if a new FES was open, false if no FES could be open + */ +bool openNewFES() +{ + for (list::iterator it=FESList.begin(); it!=FESList.end(); ++it) + { + if ((*it).State == PatchOnly) + { + nlinfo("openNewFES: ask the FS %d to accept clients", it->SId.get()); + + // switch FES to AcceptClientOnly + (*it).setToAcceptClients(); + return true; + } + } + + return false; +} + + + +void displayFES () +{ + nlinfo ("There's %d FES in the list:", FESList.size()); + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + nlinfo(" > %u NbUser:%d NbPendingUser:%d", it->SId.get(), it->NbUser, it->NbPendingUsers); + } + nlinfo ("End of the list"); +} + + + + + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// CONNECTION TO THE FRONT END SERVICE /////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void cbFESShardChooseShard (CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // the WS answer a user authorize + string reason; + CLoginCookie cookie; + string addr; + + // + // S09: receive "SCS" message from FES and send the "SCS" message to the LS + // + + CMessage msgout ("SCS"); + + msgin.serial (reason); + msgout.serial (reason); + + msgin.serial (cookie); + msgout.serial (cookie); + + if (reason.empty()) + { + msgin.serial (addr); + + // if we set the FontEndAddress in the welcome_service.cfg we use this address + if (FrontEndAddress.empty()) + { + msgout.serial (addr); + } + else + { + msgout.serial (FrontEndAddress); + } + + uint32 nbPendingUser; + msgin.serial(nbPendingUser); + + // update the pending user count for this shard + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + if (it->SId == sid) + { + it->NbPendingUsers = nbPendingUser; + break; + } + } + + /* + // OBSOLETE: LS doesn't read patching URLs + // build patch server list + std::string PatchURLS; + for (list::iterator it=FESList.begin(); it!=FESList.end(); ++it) + { + if ((*it).State == PatchOnly && !(*it).PatchAddress.empty()) + { + if (!PatchURLS.empty()) + PatchURLS += '|'; + PatchURLS += (*it).PatchAddress; + } + } + + + msgout.serial(PatchURLS); + */ + } + + if (PendingFeResponse.find(cookie) != PendingFeResponse.end()) + { + nldebug( "ERLOG: SCS recvd from %s-%hu => sending %s to SU", serviceName.c_str(), sid.get(), cookie.toString().c_str()); + + // this response is not waited by LS + TPendingFEResponseInfo &pfri = PendingFeResponse.find(cookie)->second; + + pfri.WSMod->frontendResponse(pfri.WaiterModule, pfri.UserId, reason, cookie, addr); + // cleanup pending record + PendingFeResponse.erase(cookie); + } + else + { + nldebug( "ERLOG: SCS recvd from %s-%hu, but pending %s not found", serviceName.c_str(), sid.get(), cookie.toString().c_str()); + + // return the result to the LS + if (!DontUseLS) + { + CUnifiedNetwork::getInstance()->send ("LS", msgout); + } + } + +} + +// This function is call when a FES accepted a new client or lost a connection to a client +void cbFESClientConnected (CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // + // S15: receive "CC" message from FES and send "CC" message to the "LS" + // + + CMessage msgout ("CC"); + + uint32 userid; + msgin.serial (userid); + msgout.serial (userid); + + uint8 con; + msgin.serial (con); + msgout.serial (con); + + if (!DontUseLS) + { + CUnifiedNetwork::getInstance()->send ("LS", msgout); + } + + // add or remove the user number really connected on this shard + uint32 totalNbOnlineUsers = 0, totalNbPendingUsers = 0; + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + if (it->SId == sid) + { + if (con) + { + (*it).NbUser++; + + // the client connected, it's no longer pending + if ((*it).NbPendingUsers > 0) + (*it).NbPendingUsers--; + } + else + { + if ( (*it).NbUser != 0 ) + (*it).NbUser--; + } + } + totalNbOnlineUsers += (*it).NbUser; + totalNbPendingUsers += (*it).NbPendingUsers; + } + + if (CWelcomeServiceMod::isInitialized()) + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); + + if (con) + { + // we know that this user is on this FES + UserIdSockAssociations.insert (make_pair (userid, sid)); + } + else + { + // remove the user + UserIdSockAssociations.erase (userid); + } + +} + +// This function is called when a FES rejected a client' cookie +void cbFESRemovedPendingCookie(CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + CLoginCookie cookie; + msgin.serial(cookie); + nldebug( "ERLOG: RPC recvd from %s-%hu => %s removed", serviceName.c_str(), sid.get(), cookie.toString().c_str(), cookie.toString().c_str()); + + + // client' cookie rejected, no longer pending + uint32 totalNbOnlineUsers = 0, totalNbPendingUsers = 0; + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + if ((*it).SId == sid) + { + if ((*it).NbPendingUsers > 0) + --(*it).NbPendingUsers; + } + totalNbOnlineUsers += (*it).NbUser; + totalNbPendingUsers += (*it).NbPendingUsers; + } + + if (CWelcomeServiceMod::isInitialized()) + { + CWelcomeServiceMod::getInstance()->pendingUserLost(cookie); + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); + } +} + +// This function is called by FES to setup its PatchAddress +void cbFESPatchAddress(CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + std::string address; + msgin.serial(address); + + bool acceptClients; + msgin.serial(acceptClients); + + nldebug("Received patch server address '%s' from service %s %d", address.c_str(), serviceName.c_str(), sid.get()); + + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + if ((*it).SId == sid) + { + nldebug("Affected patch server address '%s' to frontend %s %d", address.c_str(), serviceName.c_str(), sid.get()); + + if (!UsePatchMode.get() && !acceptClients) + { + // not in patch mode, force fs to accept clients + acceptClients = true; + (*it).setToAcceptClients(); + } + + (*it).PatchAddress = address; + (*it).State = (acceptClients ? AcceptClientOnly : PatchOnly); + if (acceptClients) + nldebug("Frontend %s %d reported to accept client, patching unavailable for that server", address.c_str(), serviceName.c_str(), sid.get()); + else + nldebug("Frontend %s %d reported to be in patching mode", address.c_str(), serviceName.c_str(), sid.get()); + + bool dummy; + (*it).reportStateToLS(dummy); + break; + } + } +} + +// This function is called by FES to setup the right number of players (if FES was already present before WS launching) +void cbFESNbPlayers(CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // *********** WARNING ******************* + // This version of the callback is deprecated, the system + // now use cbFESNbPlayers2 that report the pending user count + // as well as the number of connected players. + // It is kept for backward compatibility only. + // *************************************** + + uint32 nbPlayers; + msgin.serial(nbPlayers); + + uint32 totalNbOnlineUsers = 0, totalNbPendingUsers = 0; + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + if ((*it).SId == sid) + { + nldebug("Frontend '%d' reported %d online users", sid.get(), nbPlayers); + (*it).NbUser = nbPlayers; + if (nbPlayers != 0 && (*it).State == PatchOnly) + { + nlwarning("Frontend %d is in state PatchOnly, yet reports to have online %d players, state AcceptClientOnly is forced (FS_ACCEPT message sent)"); + (*it).setToAcceptClients(); + } + } + totalNbOnlineUsers += (*it).NbUser; + totalNbPendingUsers += (*it).NbPendingUsers; + } + + if (CWelcomeServiceMod::isInitialized()) + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); +} + + +// This function is called by FES to setup the right number of players (if FES was already present before WS launching) +void cbFESNbPlayers2(CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + uint32 nbPlayers; + uint32 nbPendingPlayers; + msgin.serial(nbPlayers); + msgin.serial(nbPendingPlayers); + + uint32 totalNbOnlineUsers = 0, totalNbPendingUsers = 0; + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + CFES &fes = *it; + if (fes.SId == sid) + { + nldebug("Frontend '%d' reported %d online users", sid.get(), nbPlayers); + fes.NbUser = nbPlayers; + fes.NbPendingUsers = nbPendingPlayers; + if (nbPlayers != 0 && fes.State == PatchOnly) + { + nlwarning("Frontend %d is in state PatchOnly, yet reports to have online %d players, state AcceptClientOnly is forced (FS_ACCEPT message sent)"); + (*it).setToAcceptClients(); + } + } + totalNbOnlineUsers += fes.NbUser; + totalNbPendingUsers += fes.NbPendingUsers; + } + + if (CWelcomeServiceMod::isInitialized()) + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); +} + +/* + * Set Shard open state + */ +void setShardOpenState(TShardOpenState state, bool writeInVar = true) +{ + if (writeInVar) + ShardOpen = state; + + if ( AllowDispatchMsgToLS ) + { + if (!DontUseLS) + { + // send to LS current shard state + CMessage msgout ("SET_SHARD_OPEN"); + uint8 shardOpenState = (uint8)state; + + msgout.serial (shardOpenState); + CUnifiedNetwork::getInstance()->send ("LS", msgout); + } + } +} + + +/* + * Set Shard Open State + * uint8 Open State (0 closed for all, 1 open for groups in cfg, 2 open for all) + */ +void cbSetShardOpen(CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + uint8 shardOpenState; + msgin.serial (shardOpenState); + + if (shardOpenState > OpenForAll) + { + shardOpenState = OpenForAll; + } + + setShardOpenState((TShardOpenState)shardOpenState); +} + +// forward declaration to callback +void cbShardOpenStateFile(IVariable &var); + +/* + * Restore Shard Open state from config file or from file if found + */ +void cbRestoreShardOpen(CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // first restore state from config file + CConfigFile::CVar* var = IService::getInstance()->ConfigFile.getVarPtr("ShardOpen"); + if (var != NULL) + { + setShardOpenState((TShardOpenState)var->asInt()); + } + + // then restore state from state file, if it exists + cbShardOpenStateFile(ShardOpenStateFile); +} + + + + + +// a new front end connecting to me, add it +void cbFESConnection (const std::string &serviceName, TServiceId sid, void *arg) +{ + FESList.push_back (CFES ((TServiceId)sid)); + nldebug("new FES connection: sid %u", sid.get()); + displayFES (); + + bool dummy; + FESList.back().reportStateToLS(dummy); + + if (!UsePatchMode.get()) + { + FESList.back().setToAcceptClients(); + } +} + + +// a front end closes the connection, deconnect him +void cbFESDisconnection (const std::string &serviceName, TServiceId sid, void *arg) +{ + nldebug("new FES disconnection: sid %u", sid.get()); + + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + if ((*it).SId == sid) + { + // send a message to the LS to say that all players from this FES are offline + map::iterator itc = UserIdSockAssociations.begin(); + map::iterator nitc = itc; + while (itc != UserIdSockAssociations.end()) + { + nitc++; + if ((*itc).second == sid) + { + // bye bye little player + uint32 userid = (*itc).first; + nlinfo ("Due to a frontend crash, removed the player %d", userid); + if (!DontUseLS) + { + CMessage msgout ("CC"); + msgout.serial (userid); + uint8 con = 0; + msgout.serial (con); + CUnifiedNetwork::getInstance()->send ("LS", msgout); + } + UserIdSockAssociations.erase (itc); + } + itc = nitc; + } + + bool dummy; + (*it).reportStateToLS(dummy, false); + + // remove the FES + FESList.erase (it); + + break; + } + } + + // Update the welcome service client with the new count of connection + + uint32 totalNbOnlineUsers =0, totalNbPendingUsers = 0; + for (list::iterator it = FESList.begin(); it != FESList.end(); it++) + { + const CFES &fes = *it; + totalNbOnlineUsers += fes.NbUser; + totalNbPendingUsers += fes.NbPendingUsers; + } + + if (CWelcomeServiceMod::isInitialized()) + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); + + displayFES (); +} + + +// +void cbServiceUp (const std::string &serviceName, TServiceId sid, void *arg) +{ + OnlineServices.addInstance( serviceName ); + bool online = OnlineServices.getOnlineStatus(); + reportOnlineStatus( online ); + + // send shard id to service + sint32 shardId; + if (IService::getInstance()->haveArg('S')) + { + // use the command line param if set + shardId = atoi(IService::getInstance()->getArg('S').c_str()); + } + else if (IService::getInstance()->ConfigFile.exists ("ShardId")) + { + // use the config file param if set + shardId = IService::getInstance()->ConfigFile.getVar ("ShardId").asInt(); + } + else + { + shardId = -1; + } + + if (shardId == -1) + { + nlerror ("ShardId variable must be valid (>0)"); + } + + CMessage msgout("R_SH_ID"); + msgout.serial(shardId); + CUnifiedNetwork::getInstance()->send (sid, msgout); +} + + +// +void cbServiceDown (const std::string &serviceName, TServiceId sid, void *arg) +{ + OnlineServices.removeInstance( serviceName ); + bool online = OnlineServices.getOnlineStatus(); + reportOnlineStatus( online ); +} + + +// Callback Array for message from FES +TUnifiedCallbackItem FESCallbackArray[] = +{ + { "SCS", cbFESShardChooseShard }, + { "CC", cbFESClientConnected }, + { "RPC", cbFESRemovedPendingCookie }, + { "FEPA", cbFESPatchAddress }, + { "NBPLAYERS", cbFESNbPlayers }, + { "NBPLAYERS2", cbFESNbPlayers2 }, + + { "SET_SHARD_OPEN", cbSetShardOpen }, + { "RESTORE_SHARD_OPEN", cbRestoreShardOpen }, +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////// CONNECTION TO THE LOGIN SERVICE /////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void cbLSChooseShard (CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // the LS warns me that a new client want to come in my shard + + nldebug( "ERLOG: CS recvd from %s-%hu", serviceName.c_str(), sid.get()); + + // + // S07: receive the "CS" message from LS and send the "CS" message to the selected FES + // + + CLoginCookie cookie; + msgin.serial (cookie); + string userName, userPriv, userExtended; + msgin.serial (userName); + + try + { + msgin.serial (userPriv); + } + catch (Exception &) + { + nlwarning ("LS didn't give me the user privilege for user '%s', set to empty", userName.c_str()); + } + + try + { + msgin.serial (userExtended); + } + catch (Exception &) + { + nlwarning ("LS didn't give me the extended data for user '%s', set to empty", userName.c_str()); + } + + + string ret = lsChooseShard(userName, cookie, userPriv, userExtended, WS::TUserRole::ur_player, 0xffffffff, ~0); + + if (!ret.empty()) + { + // send back an error message to LS + CMessage msgout ("SCS"); + msgout.serial (ret); + msgout.serial (cookie); + CUnifiedNetwork::getInstance()->send(sid, msgout); + } +} + +//void cbLSChooseShard (CMessage &msgin, const std::string &serviceName, uint16 sid) +std::string lsChooseShard (const std::string &userName, + const CLoginCookie &cookie, + const std::string &userPriv, + const std::string &userExtended, + WS::TUserRole userRole, + uint32 instanceId, + uint32 charSlot) +{ + // the LS warns me that a new client want to come in my shard + + // + // S07: receive the "CS" message from LS and send the "CS" message to the selected FES + // + +/* + uint totalNbUsers; + CFES *best = findBestFES( totalNbUsers ); + if (best == NULL) + { + // answer the LS that we can't accept the user + CMessage msgout ("SCS"); + string reason = "No front-end server available"; + msgout.serial (reason); + msgout.serial (cookie); + CUnifiedNetwork::getInstance()->send(sid, msgout); + return; + } +*/ + + uint totalNbUsers; + CFES* best = findBestFES( totalNbUsers ); + + // could not find a good FES or best FES has more players than balance limit + if (best == NULL || best->getUsersCountHeuristic() >= OpenFrontEndThreshold) + { + // open a new frontend + openNewFES(); + + // reselect best FES (will return newly open FES, or previous if no more FES available) + best = findBestFES(totalNbUsers); + + // check there is a FES available + if (best == NULL) + { + // answer the LS that we can't accept the user + return "No front-end server available"; + } + } + + + bool authorizeUser = false; + bool forceAuthorize = false; + + if (userPriv == ":DEV:") + { + // devs have all privileges + authorizeUser = true; + forceAuthorize = true; + } + else if (ShardOpen != ClosedForAll) + { + const std::string& allowedGroups = OpenGroups; + bool userInOpenGroups = (!userPriv.empty() && !allowedGroups.empty() && allowedGroups.find(userPriv) != std::string::npos); + + // open for all or user is privileged + authorizeUser = (ShardOpen == OpenForAll || userInOpenGroups); + // let authorized users to force access even if limit is reached + forceAuthorize = userInOpenGroups; + } + + bool shardLimitReached = ( (PlayerLimit.get() != -1) && (totalNbUsers >= (uint)PlayerLimit.get()) ); + + if (!forceAuthorize && (!authorizeUser || shardLimitReached)) + { + // answer the LS that we can't accept the user + CMessage msgout ("SCS"); + string reason; + if (shardLimitReached) + return "The shard is currently full, please try again in 5 minutes."; + else + return "The shard is closed."; + } + + + CMessage msgout ("CS"); + msgout.serial (const_cast(cookie)); + msgout.serial (const_cast(userName), const_cast(userPriv), const_cast(userExtended)); + msgout.serial (instanceId); + msgout.serial (charSlot); + + CUnifiedNetwork::getInstance()->send (best->SId, msgout); + best->NbPendingUsers++; + + // Update counts + uint32 totalNbOnlineUsers = 0, totalNbPendingUsers = 0; + for (list::iterator it=FESList.begin(); it!=FESList.end(); ++it) + { + totalNbOnlineUsers += (*it).NbUser; + totalNbPendingUsers += (*it).NbPendingUsers; + } + if (CWelcomeServiceMod::isInitialized()) + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); + + return ""; +} + +void cbFailed (CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // I can't connect to the Login Service, just nlerror (); + string reason; + msgin.serial (reason); + nlerror (reason.c_str()); +} + + +bool disconnectClient(uint32 userId) +{ + map::iterator it = UserIdSockAssociations.find (userId); + if (it == UserIdSockAssociations.end ()) + { + nlinfo ("Login service ask to disconnect user %d, he is not connected here, so ignoring", userId); + return false; + } + else + { + CMessage msgout ("DC"); + msgout.serial (userId); + CUnifiedNetwork::getInstance()->send (it->second, msgout); + + return true; + } +} + +void cbLSDisconnectClient (CMessage &msgin, const std::string &serviceName, TServiceId sid) +{ + // the LS tells me that i have to disconnect a client + + uint32 userid; + msgin.serial (userid); + + disconnectClient(userid); + +} + +// connection to the LS, send the identification message +void cbLSConnection (const std::string &serviceName, TServiceId sid, void *arg) +{ + sint32 shardId; + + if (IService::getInstance()->haveArg('S')) + { + // use the command line param if set + shardId = atoi(IService::getInstance()->getArg('S').c_str()); + } + else if (IService::getInstance()->ConfigFile.exists ("ShardId")) + { + // use the config file param if set + shardId = IService::getInstance()->ConfigFile.getVar ("ShardId").asInt(); + } + else + { + shardId = -1; + } + + if (shardId == -1) + { + nlerror ("ShardId variable must be valid (>0)"); + } + + CMessage msgout ("WS_IDENT"); + msgout.serial (shardId); + CUnifiedNetwork::getInstance()->send (sid, msgout); + + nlinfo ("Connected to %s-%hu and sent identification with shardId '%d'", serviceName.c_str(), sid.get(), shardId); + + // send state to LS + setShardOpenState((TShardOpenState)(ShardOpen.get()), false); + + // + if (!DontUseLS) + { + CMessage msgrpn("REPORT_NO_PATCH"); + CUnifiedNetwork::getInstance()->send("LS", msgrpn); + } + + bool reportPatching = false; + list::iterator itfs; + for (itfs=FESList.begin(); itfs!=FESList.end(); ++itfs) + (*itfs).reportStateToLS(reportPatching); +} + + +// Callback for detection of config file change about "ExpectedServices" +void cbUpdateExpectedServices( CConfigFile::CVar& var ) +{ + OnlineServices.setExpectedInstances( var ); +} + + +/* + * ShardOpen update functions/callbacks etc. + */ + +/** + * updateShardOpenFromFile() + * Update ShardOpen from a file. + * Read a line of text in the file, converts it to int (atoi), then casts into bool for ShardOpen. + */ +void updateShardOpenFromFile(const std::string& filename) +{ + CIFile f; + + if (!f.open(filename)) + { + nlwarning("Failed to update ShardOpen from file '%s', couldn't open file", filename.c_str()); + return; + } + + try + { + char readBuffer[256]; + f.getline(readBuffer, 256); + setShardOpenState((TShardOpenState)atoi(readBuffer)); + + nlinfo("Updated ShardOpen state to '%u' from file '%s'", ShardOpen.get(), filename.c_str()); + } + catch (Exception& e) + { + nlwarning("Failed to update ShardOpen from file '%s', exception raised while getline() '%s'", filename.c_str(), e.what()); + } +} + +std::string ShardOpenStateFileName; + +/** + * cbShardOpen() + * Callback for ShardOpen + */ +void cbShardOpen(IVariable &var) +{ + setShardOpenState((TShardOpenState)(ShardOpen.get()), false); +} + + +/** + * cbShardOpenStateFile() + * Callback for ShardOpenStateFile + */ +void cbShardOpenStateFile(IVariable &var) +{ + // remove previous file change callback + if (!ShardOpenStateFileName.empty()) + { + CFile::removeFileChangeCallback(ShardOpenStateFileName); + nlinfo("Removed callback for ShardOpenStateFileName file '%s'", ShardOpenStateFileName.c_str()); + } + + ShardOpenStateFileName = var.toString(); + + if (!ShardOpenStateFileName.empty()) + { + // set new callback for the file + CFile::addFileChangeCallback(ShardOpenStateFileName, updateShardOpenFromFile); + nlinfo("Set callback for ShardOpenStateFileName file '%s'", ShardOpenStateFileName.c_str()); + + // and update state from file... + updateShardOpenFromFile(ShardOpenStateFileName); + } +} + +/** + * cbUsePatchMode() + * Callback for UsePatchMode + */ +void cbUsePatchMode(IVariable &var) +{ + // if patch mode not set, set all fs in patching mode to accept clients now + if (!UsePatchMode.get()) + { + nlinfo("UsePatchMode disabled, switch all patching servers to actual frontends"); + + list::iterator it; + + for (it=FESList.begin(); it!=FESList.end(); ++it) + { + if ((*it).State == PatchOnly) + { + (*it).setToAcceptClients(); + } + } + } +} + + +// Callback Array for message from LS +TUnifiedCallbackItem LSCallbackArray[] = +{ + { "CS", cbLSChooseShard }, + { "DC", cbLSDisconnectClient }, + { "FAILED", cbFailed }, +}; + +class CWelcomeService : public IService +{ + +public: + + /// Init the service, load the universal time. + void init () + { + string FrontendServiceName = ConfigFile.getVar ("FrontendServiceName").asString(); + + try { FrontEndAddress = ConfigFile.getVar ("FrontEndAddress").asString(); } catch(Exception &) { } + + nlinfo ("Waiting frontend services named '%s'", FrontendServiceName.c_str()); + + CUnifiedNetwork::getInstance()->setServiceUpCallback(FrontendServiceName, cbFESConnection, NULL); + CUnifiedNetwork::getInstance()->setServiceDownCallback(FrontendServiceName, cbFESDisconnection, NULL); + CUnifiedNetwork::getInstance()->setServiceUpCallback("*", cbServiceUp, NULL); + CUnifiedNetwork::getInstance()->setServiceDownCallback("*", cbServiceDown, NULL); + + // add a connection to the LS + string LSAddr; + if (haveArg('T')) + { + // use the command line param if set + LSAddr = getArg('T'); + } + else if (ConfigFile.exists ("LSHost")) + { + // use the config file param if set + LSAddr = ConfigFile.getVar("LSHost").asString(); + } + + if (haveArg('S')) + { + // use the command line param if set + uint shardId = atoi(IService::getInstance()->getArg('S').c_str()); + + nlinfo("Using shard id %u from command line '%s'", shardId, IService::getInstance()->getArg('S').c_str()); + anticipateShardId(shardId); + } + else if (ConfigFile.exists ("ShardId")) + { + // use the config file param if set + uint shardId = IService::getInstance()->ConfigFile.getVar ("ShardId").asInt(); + + nlinfo("Using shard id %u from config file '%s'", shardId, IService::getInstance()->ConfigFile.getVar ("ShardId").asString().c_str()); + anticipateShardId(shardId); + } + + // the config file must have a valid address where the login service is + nlassert(!LSAddr.empty()); + + // add default port if not set by the config file + if (LSAddr.find (":") == string::npos) + LSAddr += ":49999"; + + AllowDispatchMsgToLS = true; + + if (ConfigFile.getVarPtr("DontUseLSService") == NULL + || !ConfigFile.getVar("DontUseLSService").asBool()) + { + // We are using NeL Login Service + CUnifiedNetwork::getInstance()->addCallbackArray(LSCallbackArray, sizeof(LSCallbackArray)/sizeof(LSCallbackArray[0])); + if (!DontUseLS) + { + CUnifiedNetwork::getInstance()->setServiceUpCallback("LS", cbLSConnection, NULL); + CUnifiedNetwork::getInstance()->addService("LS", LSAddr); + } + } + // List of expected service instances + ConfigFile.setCallback( "ExpectedServices", cbUpdateExpectedServices ); + cbUpdateExpectedServices( ConfigFile.getVar( "ExpectedServices" ) ); + + + /* + * read config variable ShardOpenStateFile to update + * + */ + cbShardOpenStateFile(ShardOpenStateFile); + +// // create a welcome service module (for SU comm) +// IModuleManager::getInstance().createModule("WelcomeService", "ws", ""); +// // plug the module in the default gateway +// NLMISC::CCommandRegistry::getInstance().execute("ws.plug wg", InfoLog()); + } + + bool update () + { + // update the service status + + removeStatusTag("DEV_ONLY"); + removeStatusTag("RESTRICTED"); + removeStatusTag("Open"); + + if (ShardOpen == 0) + addStatusTag("DEV_ONLY"); + else if (ShardOpen == 1) + addStatusTag("RESTRICTED"); + else if (ShardOpen == 2) + addStatusTag("Open"); + + return true; + } + +}; + + +static const char* getCompleteServiceName(const IService* theService) +{ + static std::string s; + s= "welcome_service"; + + if (theService->haveLongArg("wsname")) + { + s+= "_"+theService->getLongArg("wsname"); + } + + if (theService->haveLongArg("fullwsname")) + { + s= theService->getLongArg("fullwsname"); + } + + return s.c_str(); +} + +static const char* getShortServiceName(const IService* theService) +{ + static std::string s; + s= "WS"; + + if (theService->haveLongArg("shortwsname")) + { + s= theService->getLongArg("shortwsname"); + } + + return s.c_str(); +} + +// Service instantiation +NLNET_SERVICE_MAIN( CWelcomeService, getShortServiceName(scn), getCompleteServiceName(scn), 0, FESCallbackArray, "", ""); + + +// welcome service module +//class CWelcomeServiceMod : +// public CEmptyModuleCommBehav > >, +// public WS::CWelcomeServiceSkel +//{ +// void onProcessModuleMessage(IModuleProxy *sender, const CMessage &message) +// { +// if (CWelcomeServiceSkel::onDispatchMessage(sender, message)) +// return; +// +// nlwarning("Unknown message '%s' received by '%s'", +// message.getName().c_str(), +// getModuleName().c_str()); +// } +// +// +// ////// CWelcomeServiceSkel implementation +// +// // ask the welcome service to welcome a user +// virtual void welcomeUser(NLNET::IModuleProxy *sender, uint32 userId, const std::string &userName, const CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId) +// { +// string ret = lsChooseShard(userName, +// cookie, +// priviledge, +// exPriviledge, +// mode, +// instanceId); +// +// if (!ret.empty()) +// { +// // TODO : correct this +// string fsAddr; +// CWelcomeServiceClientProxy wsc(sender); +// wsc.welcomeUserResult(this, userId, ret.empty(), fsAddr); +// } +// } +// +// // ask the welcome service to disconnect a user +// virtual void disconnectUser(NLNET::IModuleProxy *sender, uint32 userId) +// { +// nlstop; +// } +// +//}; + +namespace WS +{ + + void CWelcomeServiceMod::onModuleUp(IModuleProxy *proxy) + { + if (proxy->getModuleClassName() == "RingSessionManager") + { + if (_RingSessionManager != NULL) + { + nlwarning("WelcomeServiceMod::onModuleUp : receiving module up for RingSessionManager '%s', but already have it as '%s', replacing it", + proxy->getModuleName().c_str(), + _RingSessionManager->getModuleName().c_str()); + } + // store this module as the ring session manager + _RingSessionManager = proxy; + + // say hello to our new friend (transmit fixed session id if set in config file) + nlinfo("Registering welcome service module into session manager '%s'", proxy->getModuleName().c_str()); + uint32 sessionId = 0; + CConfigFile::CVar *varFixedSessionId = IService::getInstance()->ConfigFile.getVarPtr( "FixedSessionId" ); + if ( varFixedSessionId ) + sessionId = varFixedSessionId->asInt(); + CWelcomeServiceClientProxy wscp(proxy); + wscp.registerWS(this, IService::getInstance()->getShardId(), sessionId, OnlineServices.getOnlineStatus()); + + // Send counts + uint32 totalNbOnlineUsers = 0, totalNbPendingUsers = 0; + for (list::iterator it=FESList.begin(); it!=FESList.end(); ++it) + { + totalNbOnlineUsers += (*it).NbUser; + totalNbPendingUsers += (*it).NbPendingUsers; + } + CWelcomeServiceMod::getInstance()->updateConnectedPlayerCount(totalNbOnlineUsers, totalNbPendingUsers); + } + else if (proxy->getModuleClassName() == "LoginService") + { + _LoginService = proxy; + } + } + + void CWelcomeServiceMod::onModuleDown(IModuleProxy *proxy) + { + if (_RingSessionManager == proxy) + { + // remove this module as the ring session manager + _RingSessionManager = NULL; + } + else if (_LoginService == proxy) + _LoginService = NULL; + } + + + void CWelcomeServiceMod::welcomeUser(NLNET::IModuleProxy *sender, uint32 charId, const std::string &userName, const CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId) + { + nldebug( "ERLOG: welcomeUser(%u,%s,%s,%s,%s,%u,%u)", charId, userName.c_str(), cookie.toString().c_str(), priviledge.c_str(), exPriviledge.c_str(), (uint)mode.getValue(), instanceId ); + string ret = lsChooseShard(userName, + cookie, + priviledge, + exPriviledge, + mode, + instanceId, + charId & 0xF); + + uint32 userId = charId >> 4; + if (!ret.empty()) + { + nldebug( "ERLOG: lsChooseShard returned an error => welcomeUserResult"); + // TODO : correct this + string fsAddr; + CWelcomeServiceClientProxy wsc(sender); + wsc.welcomeUserResult(this, userId, false, fsAddr, ret); + } + else + { + nldebug( "ERLOG: lsChooseShard OK => adding to pending"); + TPendingFEResponseInfo pfri; + pfri.WSMod = this; + pfri.UserId = userId; + pfri.WaiterModule = sender; + PendingFeResponse.insert(make_pair(cookie, pfri)); + } + } + + void CWelcomeServiceMod::pendingUserLost(const NLNET::CLoginCookie &cookie) + { + if (!_LoginService) + return; + + CLoginServiceProxy ls(_LoginService); + + ls.pendingUserLost(this, cookie); + } + + + // register the module + NLNET_REGISTER_MODULE_FACTORY(CWelcomeServiceMod, "WelcomeService"); + +} // namespace WS + + +// +// Variables +// + +NLMISC_DYNVARIABLE(uint32, OnlineUsersNumber, "number of connected users on this shard") +{ + // we can only read the value + if (get) + { + uint32 nbusers = 0; + for (list::iterator it = FESList.begin(); it != FESList.end (); it++) + { + nbusers += (*it).NbUser; + } + *pointer = nbusers; + } +} + + +// +// Commands +// + + +NLMISC_COMMAND (frontends, "displays the list of all registered front ends", "") +{ + if(args.size() != 0) return false; + + log.displayNL ("Display the %d registered front end :", FESList.size()); + for (list::iterator it = FESList.begin(); it != FESList.end (); it++) + { +// log.displayNL ("> FE %u: nb estimated users: %u nb users: %u, nb pending users : %u", + log.displayNL ("> FE %u: nb users: %u, nb pending users : %u", + it->SId.get(), + it->NbUser, + it->NbPendingUsers); + } + log.displayNL ("End ot the list"); + + return true; +} + +NLMISC_COMMAND (users, "displays the list of all registered users", "") +{ + if(args.size() != 0) return false; + + log.displayNL ("Display the %d registered users :", UserIdSockAssociations.size()); + for (map::iterator it = UserIdSockAssociations.begin(); it != UserIdSockAssociations.end (); it++) + { + log.displayNL ("> %u SId=%u", (*it).first, (*it).second.get()); + } + log.displayNL ("End ot the list"); + + return true; +} + +NLMISC_COMMAND( displayOnlineServices, "Display the online service instances", "" ) +{ + OnlineServices.display( log ); + return true; +} + +NLMISC_VARIABLE( bool, OnlineStatus, "Main online status of the shard" ); diff --git a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.h b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.h new file mode 100644 index 000000000..92d1a5986 --- /dev/null +++ b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.h @@ -0,0 +1,112 @@ +// NeLNS - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "nel/misc/types_nl.h" +#include "nel/misc/singleton.h" + +#include "nel/net/module_manager.h" +#include "nel/net/module_builder_parts.h" + +#include "game_share/welcome_service_itf.h" + +std::string lsChooseShard (const std::string &userName, + const NLNET::CLoginCookie &cookie, + const std::string &userPriv, + const std::string &userExtended, + WS::TUserRole userRole, + uint32 instanceId, + uint32 charSlot); + + +bool disconnectClient(uint32 userId); + + +namespace WS +{ + // welcome service module + class CWelcomeServiceMod : + public NLNET::CEmptyModuleCommBehav > >, + public WS::CWelcomeServiceSkel, + public NLMISC::CManualSingleton + { + /// the ring session manager module (if any) + NLNET::TModuleProxyPtr _RingSessionManager; + /// the login service module (if any) + NLNET::TModuleProxyPtr _LoginService; + + void onModuleUp(NLNET::IModuleProxy *proxy); + void onModuleDown(NLNET::IModuleProxy *proxy); + + + ////// CWelcomeServiceSkel implementation + + // ask the welcome service to welcome a user + virtual void welcomeUser(NLNET::IModuleProxy *sender, uint32 userId, const std::string &userName, const NLNET::CLoginCookie &cookie, const std::string &priviledge, const std::string &exPriviledge, WS::TUserRole mode, uint32 instanceId); + + // ask the welcome service to disconnect a user + virtual void disconnectUser(NLNET::IModuleProxy *sender, uint32 userId) + { + disconnectClient(userId); + } + + public: + CWelcomeServiceMod() + { + CWelcomeServiceSkel::init(this); + } + + void reportWSOpenState(bool shardOpen) + { + if (_RingSessionManager == NULL) // skip if the RSM is offline + return; + + CWelcomeServiceClientProxy wscp(_RingSessionManager); + wscp.reportWSOpenState(this, shardOpen); + } + + // forward response from the front end for a player slot to play in + // to the client of this welcome service (usually the Ring Session Manager) + void frontendResponse(NLNET::IModuleProxy *waiterModule, uint32 userId, const std::string &reason, const NLNET::CLoginCookie &cookie, const std::string &fsAddr) + { + CWelcomeServiceClientProxy wscp(waiterModule); + wscp.welcomeUserResult(this, userId, reason.empty(), fsAddr, reason); + } + + // send the current number of players on this shard to the Ring Session Manager + void updateConnectedPlayerCount(uint32 nbOnlinePlayers, uint32 nbPendingPlayers) + { + if (_RingSessionManager == NULL) // skip if the RSM is offline + return; + + CWelcomeServiceClientProxy wscp(_RingSessionManager); + wscp.updateConnectedPlayerCount(this, nbOnlinePlayers, nbPendingPlayers); + } + + // inform the LS that a pending client is lost + void pendingUserLost(const NLNET::CLoginCookie &cookie); + }; + + struct TPendingFEResponseInfo + { + CWelcomeServiceMod *WSMod; + NLNET::TModuleProxyPtr WaiterModule; + uint32 UserId; + }; + typedef std::map TPendingFeReponses; + // the list of cookie string that are pending an + TPendingFeReponses PendingFeResponse; + +} // namespace WS diff --git a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.vcproj b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.vcproj index b83039254..c223fb76a 100644 --- a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.vcproj +++ b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.vcproj @@ -94,82 +94,6 @@ Name="VCPostBuildEventTool" /> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/server/src/shard_unifier_service/login_service.cpp b/code/ryzom/server/src/shard_unifier_service/login_service.cpp index b8d04e5aa..ad0ff1f5f 100644 --- a/code/ryzom/server/src/shard_unifier_service/login_service.cpp +++ b/code/ryzom/server/src/shard_unifier_service/login_service.cpp @@ -5,7 +5,7 @@ #include "nel/net/module_builder_parts.h" #include "nel/net/login_cookie.h" -#include "../../nelns/welcome_service/welcome_service_itf.h" +#include "game_share/welcome_service_itf.h" #include "game_share/utils.h" #include "server_share/mysql_wrapper.h" @@ -23,8 +23,6 @@ using namespace MSW; using namespace RSMGR; using namespace ENTITYLOC; -#include "../../../../nelns/welcome_service/welcome_service_itf.cpp" - namespace LS { diff --git a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp index 7dc259524..0d2aa8882 100644 --- a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp @@ -4,7 +4,7 @@ #include "nel/net/module_builder_parts.h" #include "nel/net/callback_server.h" -#include "../../nelns/welcome_service/welcome_service_itf.h" +#include "game_share/welcome_service_itf.h" #include "game_share/r2_types.h" diff --git a/code/ryzom/tools/CMakeLists.txt b/code/ryzom/tools/CMakeLists.txt index aa418f7fd..695c59518 100644 --- a/code/ryzom/tools/CMakeLists.txt +++ b/code/ryzom/tools/CMakeLists.txt @@ -11,11 +11,12 @@ ADD_SUBDIRECTORY(pdr_util) ADD_SUBDIRECTORY(stats_scan) ADD_SUBDIRECTORY(sheets_packer) +ADD_SUBDIRECTORY(server) + # Old stuff that doesn't compile anymore. #ADD_SUBDIRECTORY(occ2huff) #ADD_SUBDIRECTORY(phrase_generator) #ADD_SUBDIRECTORY(sheet_random_generator) -#- this relies on something in the client # Not building these #xml_packer - this is in NeL tools. diff --git a/code/ryzom/tools/assoc_mem/CMakeLists.txt b/code/ryzom/tools/assoc_mem/CMakeLists.txt index d1f9ad3a3..2593f848f 100644 --- a/code/ryzom/tools/assoc_mem/CMakeLists.txt +++ b/code/ryzom/tools/assoc_mem/CMakeLists.txt @@ -6,7 +6,7 @@ LIST(REMOVE_ITEM SRC ADD_EXECUTABLE(assoc_mem ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NELMISC_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(assoc_mem ${PLATFORM_LINKFLAGS} ${LIBXML2_LIBRARIES} ${NELMISC_LIBRARY}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) diff --git a/code/ryzom/tools/server/CMakeLists.txt b/code/ryzom/tools/server/CMakeLists.txt new file mode 100644 index 000000000..7244c865a --- /dev/null +++ b/code/ryzom/tools/server/CMakeLists.txt @@ -0,0 +1,11 @@ +# Deprecated, no longer used +#ADD_SUBDIRECTORY(ai_build_wmap) + +# Not done yet. +#admin +#brick_param_extractor +#build_spell_sheet +#build_world_packed_col +#CMakeLists.txt +#sql +#www diff --git a/code/ryzom/tools/server/ai_build_wmap/CMakeLists.txt b/code/ryzom/tools/server/ai_build_wmap/CMakeLists.txt new file mode 100644 index 000000000..5ac473f79 --- /dev/null +++ b/code/ryzom/tools/server/ai_build_wmap/CMakeLists.txt @@ -0,0 +1,17 @@ +FILE(GLOB SRC *.cpp *.h) + +ADD_EXECUTABLE(ai_build_wmap ${SRC}) + +INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/server/src + ${CMAKE_SOURCE_DIR}/common/src + ${LIBXML2_INCLUDE_DIR} + ${NEL_INCLUDE_DIR}) +TARGET_LINK_LIBRARIES(ai_build_wmap game_share + server_share + ai_share + ${PLATFORM_LINKFLAGS} + ${LIBXML2_LIBRARIES} + ${NELMISC_LIBRARY}) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) + +INSTALL(TARGETS ai_build_wmap RUNTIME DESTINATION bin COMPONENT tools) diff --git a/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp b/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp index 76eaa8c2e..2d5b13716 100644 --- a/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp +++ b/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp @@ -24,9 +24,10 @@ #include "nel/misc/command.h" #include "nel/misc/path.h" #include "nel/misc/sstring.h" +#include "nel/misc/file.h" // Game share -#include "game_share/bmp4image.h" +#include "server_share/bmp4image.h" // AI share #include "ai_share/world_map.h"