merge
This commit is contained in:
commit
8ba1778f86
41 changed files with 612 additions and 364 deletions
|
@ -755,11 +755,13 @@ public:
|
|||
// Display a cursor from its name (case unsensitive)
|
||||
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false) = 0;
|
||||
|
||||
// Change default scale for all cursors
|
||||
virtual void setCursorScale(float scale) = 0;
|
||||
|
||||
/** Check whether there is a low level device manager available, and get its interface. Return NULL if not available
|
||||
* From this interface you can deal with mouse and keyboard as above, but you can also manage game device (joysticks, joypads ...)
|
||||
*/
|
||||
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0;
|
||||
|
||||
// @}
|
||||
|
||||
/// Get the width and the height of the window
|
||||
|
|
|
@ -440,6 +440,8 @@ public:
|
|||
// Display a cursor from its name (case unsensitive)
|
||||
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false);
|
||||
|
||||
// Change default scale for all cursors
|
||||
virtual void setCursorScale(float scale);
|
||||
// @}
|
||||
|
||||
|
||||
|
|
|
@ -604,6 +604,9 @@ public:
|
|||
// Display a cursor from its name (case unsensitive)
|
||||
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false) = 0;
|
||||
|
||||
// Change default scale for all cursors
|
||||
virtual void setCursorScale(float scale) = 0;
|
||||
|
||||
// @}
|
||||
|
||||
/// \name Misc.
|
||||
|
|
|
@ -127,6 +127,8 @@ namespace NLNET
|
|||
class IModuleTrackerCb
|
||||
{
|
||||
public:
|
||||
virtual ~IModuleTrackerCb() { }
|
||||
|
||||
virtual void onTrackedModuleUp(IModuleProxy *moduleProxy) =0;
|
||||
virtual void onTrackedModuleDown(IModuleProxy *moduleProxy) =0;
|
||||
};
|
||||
|
|
|
@ -173,7 +173,7 @@ CDriverD3D::CDriverD3D()
|
|||
_CurrRot = 0;
|
||||
_CurrHotSpotX = 0;
|
||||
_CurrHotSpotY = 0;
|
||||
_CursorScale = 0.85f;
|
||||
_CursorScale = 1.f;
|
||||
|
||||
_UserViewMtx.identity();
|
||||
_UserModelMtx.identity();
|
||||
|
@ -2722,6 +2722,7 @@ bool CDriverD3D::fillPresentParameter (D3DPRESENT_PARAMETERS ¶meters, D3DFOR
|
|||
D3DFMT_D24FS8,
|
||||
//D3DFMT_D16,
|
||||
};
|
||||
|
||||
const uint zbufferFormatCount = sizeof(zbufferFormats)/sizeof(D3DFORMAT);
|
||||
uint i;
|
||||
for (i=0; i<zbufferFormatCount; i++)
|
||||
|
@ -3763,52 +3764,82 @@ bool CDriverD3D::clipRect(NLMISC::CRect &rect)
|
|||
return rect.Width>0 && rect.Height>0;
|
||||
}
|
||||
|
||||
void CDriverD3D::getZBufferPart (std::vector<float> &/* zbuffer */, NLMISC::CRect &/* rect */)
|
||||
void CDriverD3D::getZBuffer(std::vector<float> &zbuffer)
|
||||
{
|
||||
H_AUTO_D3D(CDriverD3D_getZBuffer);
|
||||
|
||||
CRect rect(0, 0);
|
||||
getWindowSize(rect.Width, rect.Height);
|
||||
getZBufferPart(zbuffer, rect);
|
||||
}
|
||||
|
||||
void CDriverD3D::getZBufferPart (std::vector<float> &zbuffer, NLMISC::CRect &rect)
|
||||
{
|
||||
/* ace: currently not working
|
||||
zbuffer.clear();
|
||||
|
||||
IDirect3DSurface9 *surface;
|
||||
if (SUCCEEDED(_DeviceInterface->GetDepthStencilSurface(&surface)))
|
||||
{
|
||||
if (clipRect(rect))
|
||||
{
|
||||
IDirect3DSurface9 *surface;
|
||||
if(_DeviceInterface->GetDepthStencilSurface(&surface)== D3D_OK)
|
||||
{
|
||||
// Surface desc
|
||||
D3DSURFACE_DESC desc;
|
||||
if (surface->GetDesc(&desc) == D3D_OK)
|
||||
{
|
||||
// 32 bits format supported
|
||||
if (desc.Format == D3DFMT_D24S8)
|
||||
{
|
||||
// Lock the surface
|
||||
D3DLOCKED_RECT lock;
|
||||
::RECT winRect;
|
||||
RECT winRect;
|
||||
winRect.left = rect.left();
|
||||
winRect.right = rect.right();
|
||||
winRect.top = rect.top();
|
||||
winRect.bottom = rect.bottom();
|
||||
const uint lineCount = rect.Height;
|
||||
const uint width = rect.Width;
|
||||
HRESULT hr = surface->LockRect (&lock, &winRect, D3DLOCK_READONLY);
|
||||
if (hr == D3D_OK)
|
||||
|
||||
// Lock the surface
|
||||
D3DLOCKED_RECT lock;
|
||||
if (SUCCEEDED(surface->LockRect (&lock, &winRect, D3DLOCK_READONLY)))
|
||||
{
|
||||
zbuffer.resize(rect.Width*rect.Height);
|
||||
// Line count
|
||||
float *dest = &(zbuffer[0]);
|
||||
uint i;
|
||||
for (i=0; i<lineCount; i++)
|
||||
|
||||
// Surface desc
|
||||
D3DSURFACE_DESC desc;
|
||||
if (SUCCEEDED(surface->GetDesc(&desc)))
|
||||
{
|
||||
memcpy (dest+(4*i*width), ((uint8*)lock.pBits)+(i*lock.Pitch), width*4);
|
||||
const uint8* pBits = (uint8*)lock.pBits;
|
||||
|
||||
for(uint y=0; y<rect.Height; ++y)
|
||||
{
|
||||
uint offset = y*rect.Width;
|
||||
uint end = offset + rect.Width;
|
||||
|
||||
// 32 bits format supported
|
||||
if (desc.Format == D3DFMT_D32F_LOCKABLE)
|
||||
{
|
||||
const float *src = (float*)(pBits + lock.Pitch * y);
|
||||
float *dst = &zbuffer[offset];
|
||||
memcpy(dst, src, rect.Width * sizeof(float));
|
||||
}
|
||||
else if (desc.Format == D3DFMT_D24S8)
|
||||
{
|
||||
uint32* pRow = (uint32*)(pBits + lock.Pitch * y);
|
||||
while(offset != end)
|
||||
{
|
||||
uint32 value = *pRow++;
|
||||
zbuffer[offset++] = (float)value / (float)std::numeric_limits<uint32>::max();
|
||||
}
|
||||
}
|
||||
else if (desc.Format == D3DFMT_D16_LOCKABLE)
|
||||
{
|
||||
uint16* pRow = (uint16*)(pBits + lock.Pitch * y);
|
||||
while(offset != end)
|
||||
{
|
||||
uint16 value = *pRow++;
|
||||
zbuffer[offset++] = (float)value / (float)std::numeric_limits<uint16>::max();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surface->UnlockRect ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surface->Release();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void CDriverD3D::findNearestFullscreenVideoMode()
|
||||
|
@ -3932,9 +3963,4 @@ bool CDriverD3D::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CDriverD3D::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
return convertBitmapToIcon(bitmap, cursor, iconWidth, iconHeight, iconDepth, col, hotSpotX, hotSpotY, true);
|
||||
}
|
||||
|
||||
} // NL3D
|
||||
|
|
|
@ -822,9 +822,8 @@ public:
|
|||
virtual void setDepthRange(float znear, float zfar);
|
||||
virtual void getDepthRange(float &znear, float &zfar) const;
|
||||
|
||||
// todo hulud d3d buffers
|
||||
virtual void getZBuffer (std::vector<float> &/* zbuffer */) {}
|
||||
virtual void getBufferPart (CBitmap &bitmap, NLMISC::CRect &rect); // Only 32 bits back buffer supported
|
||||
virtual void getZBuffer (std::vector<float> &zbuffer);
|
||||
virtual void getBufferPart (CBitmap &bitmap, NLMISC::CRect &rect);
|
||||
|
||||
// return true if driver support Bloom effect.
|
||||
virtual bool supportBloomEffect() const;
|
||||
|
@ -923,14 +922,15 @@ public:
|
|||
// see if system cursor is currently captured
|
||||
virtual bool isSystemCursorCaptured();
|
||||
|
||||
virtual void setHardwareCursorScale(float scale) { _CursorScale = scale; }
|
||||
|
||||
// Add a new cursor (name is case unsensitive)
|
||||
virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap);
|
||||
|
||||
// Display a cursor from its name (case unsensitive)
|
||||
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false);
|
||||
|
||||
// Change default scale for all cursors
|
||||
virtual void setCursorScale(float scale);
|
||||
|
||||
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive);
|
||||
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable);
|
||||
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager();
|
||||
|
|
|
@ -177,11 +177,8 @@ void CDriverD3D::addCursor(const std::string &name, const NLMISC::CBitmap &curso
|
|||
CCursor &curs = _Cursors[name];
|
||||
curs = CCursor(); // erase possible previous cursor
|
||||
|
||||
uint destWidth;
|
||||
uint destHeight;
|
||||
|
||||
destWidth = GetSystemMetrics(SM_CXCURSOR);
|
||||
destHeight = GetSystemMetrics(SM_CYCURSOR);
|
||||
uint destWidth = GetSystemMetrics(SM_CXCURSOR);
|
||||
uint destHeight = GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
// build a square bitmap
|
||||
uint tmpSize = std::max(maxX - minX + 1, maxY - minY + 1);
|
||||
|
@ -198,9 +195,12 @@ void CDriverD3D::addCursor(const std::string &name, const NLMISC::CBitmap &curso
|
|||
// first resampling, same for all cursors
|
||||
tmpSize = (uint) (tmpSize * curs.HotspotScale);
|
||||
if (tmpSize == 0) tmpSize = 1;
|
||||
/*
|
||||
|
||||
if (curs.HotspotScale < 1.f)
|
||||
{
|
||||
curs.Src.resample(tmpSize, tmpSize);
|
||||
*/
|
||||
}
|
||||
|
||||
// shrink if necessary
|
||||
if (tmpSize > destWidth || tmpSize > destHeight) // need to shrink ?
|
||||
{
|
||||
|
@ -300,17 +300,19 @@ void CDriverD3D::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot
|
|||
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
void CDriverD3D::setCursorScale(float scale)
|
||||
{
|
||||
_CursorScale = scale;
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
nlCursor CDriverD3D::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
nlassert(isAlphaBlendedCursorSupported());
|
||||
|
||||
uint mouseW;
|
||||
uint mouseH;
|
||||
|
||||
// use cursor size from system
|
||||
mouseW = GetSystemMetrics(SM_CXCURSOR);
|
||||
mouseH = GetSystemMetrics(SM_CYCURSOR);
|
||||
uint mouseW = GetSystemMetrics(SM_CXCURSOR);
|
||||
uint mouseH = GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
CBitmap rotSrc = src;
|
||||
if (rot > 3) rot = 3; // mimic behavior of 'CViewRenderer::drawRotFlipBitmapTiled' (why not rot & 3 ??? ...)
|
||||
|
@ -374,6 +376,7 @@ void CDriverD3D::setMousePos(float x, float y)
|
|||
if (_HWnd == EmptyWindow)
|
||||
return;
|
||||
|
||||
// convert position size from float to pixels
|
||||
sint x1 = (sint)((float)_CurrentMode.Width*x);
|
||||
sint y1 = (sint)((float)_CurrentMode.Height*(1.0f-y));
|
||||
|
||||
|
@ -385,6 +388,28 @@ void CDriverD3D::setMousePos(float x, float y)
|
|||
SetCursorPos(pt.x, pt.y);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverD3D::setCapture (bool b)
|
||||
{
|
||||
H_AUTO_D3D(CDriverD3D_setCapture);
|
||||
|
||||
if (b && isSystemCursorInClientArea() && !isSystemCursorCaptured())
|
||||
{
|
||||
SetCapture(_HWnd);
|
||||
}
|
||||
else if (!b && isSystemCursorCaptured())
|
||||
{
|
||||
// if hardware mouse and not in client area, then force to update its aspect by updating its pos
|
||||
if (!isSystemCursorInClientArea())
|
||||
{
|
||||
// force update
|
||||
showCursor(true);
|
||||
}
|
||||
|
||||
ReleaseCapture();
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverD3D::isSystemCursorInClientArea()
|
||||
{
|
||||
|
@ -433,28 +458,6 @@ bool CDriverD3D::isSystemCursorInClientArea()
|
|||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverD3D::setCapture (bool b)
|
||||
{
|
||||
H_AUTO_D3D(CDriverD3D_setCapture);
|
||||
|
||||
if (b && isSystemCursorInClientArea() && !isSystemCursorCaptured())
|
||||
{
|
||||
SetCapture(_HWnd);
|
||||
}
|
||||
else if (!b && isSystemCursorCaptured())
|
||||
{
|
||||
// if hardware mouse and not in client area, then force to update its aspect by updating its pos
|
||||
if (!isSystemCursorInClientArea())
|
||||
{
|
||||
// force update
|
||||
showCursor(true);
|
||||
}
|
||||
|
||||
ReleaseCapture();
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverD3D::isSystemCursorCaptured()
|
||||
{
|
||||
|
@ -578,4 +581,9 @@ uint CDriverD3D::getDoubleClickDelay(bool hardwareMouse)
|
|||
return res;
|
||||
}
|
||||
|
||||
bool CDriverD3D::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
return convertBitmapToIcon(bitmap, cursor, iconWidth, iconHeight, iconDepth, col, hotSpotX, hotSpotY, true);
|
||||
}
|
||||
|
||||
} // NL3D
|
||||
|
|
|
@ -223,7 +223,7 @@ CDriverGL::CDriverGL()
|
|||
_CurrRot = 0;
|
||||
_CurrHotSpotX = 0;
|
||||
_CurrHotSpotY = 0;
|
||||
_CursorScale = 0.85f;
|
||||
_CursorScale = 1.f;
|
||||
_MouseCaptured = false;
|
||||
|
||||
_NeedToRestaureGammaRamp = false;
|
||||
|
|
|
@ -523,14 +523,15 @@ public:
|
|||
// see if system cursor is currently captured
|
||||
virtual bool isSystemCursorCaptured();
|
||||
|
||||
virtual void setHardwareCursorScale(float scale) { _CursorScale = scale; }
|
||||
|
||||
// Add a new cursor (name is case unsensitive)
|
||||
virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap);
|
||||
|
||||
// Display a cursor from its name (case unsensitive)
|
||||
virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false);
|
||||
|
||||
// Change default scale for all cursors
|
||||
virtual void setCursorScale(float scale);
|
||||
|
||||
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive);
|
||||
|
||||
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable);
|
||||
|
@ -1003,6 +1004,9 @@ private:
|
|||
// Convert a NLMISC::CBitmap to nlCursor
|
||||
bool convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY);
|
||||
|
||||
// Return the best cursor size depending on specified width and height
|
||||
bool getBestCursorSize(uint srcWidth, uint srcHeight, uint &dstWidth, uint &dstHeight);
|
||||
|
||||
// build a cursor from src, src should have the same size that the hardware cursor
|
||||
// or a assertion is thrown
|
||||
nlCursor buildCursor(const NLMISC::CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY);
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
# include <GL/gl.h>
|
||||
# include <GL/glx.h>
|
||||
# include <X11/Xatom.h>
|
||||
# ifdef HAVE_XRENDER
|
||||
# include <X11/extensions/Xrender.h>
|
||||
# endif // HAVE_XRENDER
|
||||
#endif // NL_OS_UNIX
|
||||
|
||||
#include "nel/misc/mouse_device.h"
|
||||
|
@ -205,20 +208,8 @@ void CDriverGL::addCursor(const std::string &name, const NLMISC::CBitmap &cursor
|
|||
CCursor &curs = _Cursors[name];
|
||||
curs = CCursor(); // erase possible previous cursor
|
||||
|
||||
uint destWidth;
|
||||
uint destHeight;
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
destWidth = GetSystemMetrics(SM_CXCURSOR);
|
||||
destHeight = GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
Status res = XQueryBestCursor(_dpy, _win, width, height, &destWidth, &destHeight);
|
||||
|
||||
#endif
|
||||
uint destWidth = 32, destHeight = 32;
|
||||
getBestCursorSize(width, height, destWidth, destHeight);
|
||||
|
||||
// build a square bitmap
|
||||
uint tmpSize = std::max(maxX - minX + 1, maxY - minY + 1);
|
||||
|
@ -379,27 +370,19 @@ void CDriverGL::setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot,
|
|||
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
void CDriverGL::setCursorScale(float scale)
|
||||
{
|
||||
_CursorScale = scale;
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
nlCursor CDriverGL::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
nlassert(isAlphaBlendedCursorSupported());
|
||||
|
||||
uint mouseW;
|
||||
uint mouseH;
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
// use cursor size from system
|
||||
mouseW = GetSystemMetrics(SM_CXCURSOR);
|
||||
mouseH = GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
// use best cursor size for bitmap
|
||||
Status res = XQueryBestCursor(_dpy, _win, src.getWidth(), src.getHeight(), &mouseW, &mouseH);
|
||||
|
||||
#endif
|
||||
uint mouseW = 32, mouseH = 32;
|
||||
getBestCursorSize(src.getWidth(), src.getHeight(), mouseW, mouseH);
|
||||
|
||||
CBitmap rotSrc = src;
|
||||
if (rot > 3) rot = 3; // mimic behavior of 'CViewRenderer::drawRotFlipBitmapTiled' (why not rot & 3 ??? ...)
|
||||
|
@ -437,7 +420,7 @@ void CDriverGL::setSystemArrow()
|
|||
#endif
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// ***************************************************************************
|
||||
void CDriverGL::showCursor(bool b)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_showCursor);
|
||||
|
@ -504,7 +487,7 @@ void CDriverGL::showCursor(bool b)
|
|||
#endif // NL_OS_UNIX
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// ***************************************************************************
|
||||
void CDriverGL::setMousePos(float x, float y)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setMousePos)
|
||||
|
@ -558,9 +541,10 @@ void CDriverGL::setMousePos(float x, float y)
|
|||
#endif // NL_OS_UNIX
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL::setCapture (bool b)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setCapture )
|
||||
H_AUTO_OGL(CDriverGL_setCapture);
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
|
@ -603,6 +587,7 @@ void CDriverGL::setCapture (bool b)
|
|||
#endif // NL_OS_UNIX
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDriverGL::isSystemCursorInClientArea()
|
||||
{
|
||||
if (_FullScreen /* || !IsMouseCursorHardware() */)
|
||||
|
@ -811,4 +796,161 @@ uint CDriverGL::getDoubleClickDelay(bool hardwareMouse)
|
|||
return res;
|
||||
}
|
||||
|
||||
bool CDriverGL::getBestCursorSize(uint srcWidth, uint srcHeight, uint &dstWidth, uint &dstHeight)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
// Windows provides default size for cursors
|
||||
dstWidth = (uint)GetSystemMetrics(SM_CXCURSOR);
|
||||
dstHeight = (uint)GetSystemMetrics(SM_CYCURSOR);
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
Status res = XQueryBestCursor(_dpy, _win, srcWidth, srcHeight, &dstWidth, &dstHeight);
|
||||
nlwarning("XQueryBestCursor returned %d", (sint)res);
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
|
||||
return convertBitmapToIcon(bitmap, cursor, iconWidth, iconHeight, iconDepth, col, hotSpotX, hotSpotY, true);
|
||||
|
||||
#elif defined(NL_OS_UNIX) && defined(HAVE_XRENDER) && !defined(NL_OS_MAC)
|
||||
|
||||
CBitmap src = bitmap;
|
||||
|
||||
// resample bitmap if necessary
|
||||
if (src.getWidth() != iconWidth || src.getHeight() != iconHeight)
|
||||
{
|
||||
src.resample(iconWidth, iconHeight);
|
||||
}
|
||||
|
||||
CBitmap colorBm;
|
||||
colorBm.resize(iconWidth, iconHeight, CBitmap::RGBA);
|
||||
const CRGBA *srcColorPtr = (CRGBA *) &(src.getPixels()[0]);
|
||||
const CRGBA *srcColorPtrLast = srcColorPtr + (iconWidth * iconHeight);
|
||||
CRGBA *destColorPtr = (CRGBA *) &(colorBm.getPixels()[0]);
|
||||
|
||||
do
|
||||
{
|
||||
// colorize icon
|
||||
destColorPtr->modulateFromColor(*srcColorPtr, col);
|
||||
|
||||
// X11 wants BGRA pixels : swap red and blue channels
|
||||
std::swap(destColorPtr->R, destColorPtr->B);
|
||||
|
||||
// premultiplied alpha
|
||||
if (destColorPtr->A < 255)
|
||||
{
|
||||
destColorPtr->R = (destColorPtr->R * destColorPtr->A) / 255;
|
||||
destColorPtr->G = (destColorPtr->G * destColorPtr->A) / 255;
|
||||
destColorPtr->B = (destColorPtr->B * destColorPtr->A) / 255;
|
||||
}
|
||||
|
||||
++ srcColorPtr;
|
||||
++ destColorPtr;
|
||||
}
|
||||
while (srcColorPtr != srcColorPtrLast);
|
||||
|
||||
// use malloc() because X will free() data itself
|
||||
CRGBA *src32 = (CRGBA*)malloc(colorBm.getSize()*4);
|
||||
memcpy(src32, &colorBm.getPixels(0)[0], colorBm.getSize()*4);
|
||||
|
||||
uint size = iconWidth * iconHeight;
|
||||
|
||||
// Create the icon pixmap
|
||||
sint screen = DefaultScreen(_dpy);
|
||||
Visual *visual = DefaultVisual(_dpy, screen);
|
||||
|
||||
if (!visual)
|
||||
{
|
||||
nlwarning("Failed to get a default visual for screen %d", screen);
|
||||
return false;
|
||||
}
|
||||
|
||||
// create the icon pixmap
|
||||
XImage* image = XCreateImage(_dpy, visual, 32, ZPixmap, 0, (char*)src32, iconWidth, iconHeight, 32, 0);
|
||||
|
||||
if (!image)
|
||||
{
|
||||
nlwarning("Failed to set the window's icon");
|
||||
return false;
|
||||
}
|
||||
|
||||
Pixmap pixmap = XCreatePixmap(_dpy, _win, iconWidth, iconHeight, 32 /* defDepth */);
|
||||
|
||||
if (!pixmap)
|
||||
{
|
||||
nlwarning("Failed to create a pixmap %ux%ux%d", iconWidth, iconHeight, 32);
|
||||
return false;
|
||||
}
|
||||
|
||||
GC gc = XCreateGC(_dpy, pixmap, 0, NULL);
|
||||
|
||||
if (!gc)
|
||||
{
|
||||
nlwarning("Failed to create a GC");
|
||||
return false;
|
||||
}
|
||||
|
||||
sint res = XPutImage(_dpy, pixmap, gc, image, 0, 0, 0, 0, iconWidth, iconHeight);
|
||||
// should return 0
|
||||
nlwarning("XPutImage returned %d", res);
|
||||
|
||||
res = XFreeGC(_dpy, gc);
|
||||
// should return 1
|
||||
nlwarning("XFreeGC returned %d", res);
|
||||
|
||||
if (image->data)
|
||||
{
|
||||
free(image->data);
|
||||
image->data = NULL;
|
||||
}
|
||||
|
||||
XDestroyImage(image);
|
||||
|
||||
XRenderPictFormat *format = XRenderFindStandardFormat(_dpy, PictStandardARGB32);
|
||||
|
||||
if (!format)
|
||||
{
|
||||
nlwarning("Failed to find a standard format");
|
||||
return false;
|
||||
}
|
||||
|
||||
Picture picture = XRenderCreatePicture(_dpy, pixmap, format, 0, 0);
|
||||
|
||||
if (!picture)
|
||||
{
|
||||
nlwarning("Failed to create picture");
|
||||
return false;
|
||||
}
|
||||
|
||||
cursor = XRenderCreateCursor(_dpy, picture, (uint)hotSpotX, (uint)hotSpotY);
|
||||
|
||||
if (!cursor)
|
||||
{
|
||||
nlwarning("Failed to create cursor");
|
||||
return false;
|
||||
}
|
||||
|
||||
XRenderFreePicture(_dpy, picture);
|
||||
res = XFreePixmap(_dpy, pixmap);
|
||||
// should return 1
|
||||
nlwarning("XFreePixmap returned %d", res);
|
||||
|
||||
return true;
|
||||
|
||||
#else
|
||||
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
} // NL3D
|
||||
|
|
|
@ -2659,7 +2659,7 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon,
|
|||
const CRGBA *srcColorPtr = (CRGBA *) &(src.getPixels()[0]);
|
||||
const CRGBA *srcColorPtrLast = srcColorPtr + (iconWidth * iconHeight);
|
||||
CRGBA *destColorPtr = (CRGBA *) &(colorBm.getPixels()[0]);
|
||||
static volatile uint8 alphaThreshold = 127;
|
||||
static uint8 alphaThreshold = 127;
|
||||
do
|
||||
{
|
||||
destColorPtr->modulateFromColor(*srcColorPtr, col);
|
||||
|
@ -2687,7 +2687,7 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon,
|
|||
|
||||
for (uint k = 0;k < colorBm16.size(); ++k)
|
||||
{
|
||||
if (src32[k].A <= 120)
|
||||
if (src32[k].A <= alphaThreshold)
|
||||
{
|
||||
bitMask[k / 8] |= (0x80 >> (k & 7));
|
||||
}
|
||||
|
@ -2720,18 +2720,8 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
return convertBitmapToIcon(bitmap, cursor, iconWidth, iconHeight, iconDepth, col, hotSpotX, hotSpotY, true);
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
|
||||
bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, std::vector<long> &icon)
|
||||
|
@ -2758,140 +2748,6 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, std::vector<l
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &cursor, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col, sint hotSpotX, sint hotSpotY)
|
||||
{
|
||||
#ifdef HAVE_XRENDER
|
||||
|
||||
CBitmap src = bitmap;
|
||||
|
||||
// resample bitmap if necessary
|
||||
if (src.getWidth() != iconWidth || src.getHeight() != iconHeight)
|
||||
{
|
||||
src.resample(iconWidth, iconHeight);
|
||||
}
|
||||
|
||||
CBitmap colorBm;
|
||||
colorBm.resize(iconWidth, iconHeight, CBitmap::RGBA);
|
||||
const CRGBA *srcColorPtr = (CRGBA *) &(src.getPixels()[0]);
|
||||
const CRGBA *srcColorPtrLast = srcColorPtr + (iconWidth * iconHeight);
|
||||
CRGBA *destColorPtr = (CRGBA *) &(colorBm.getPixels()[0]);
|
||||
|
||||
do
|
||||
{
|
||||
// colorize icon
|
||||
destColorPtr->modulateFromColor(*srcColorPtr, col);
|
||||
|
||||
// X11 wants BGRA pixels : swap red and blue channels
|
||||
std::swap(destColorPtr->R, destColorPtr->B);
|
||||
|
||||
// premultiplied alpha
|
||||
if (destColorPtr->A < 255)
|
||||
{
|
||||
destColorPtr->R = (destColorPtr->R * destColorPtr->A) / 255;
|
||||
destColorPtr->G = (destColorPtr->G * destColorPtr->A) / 255;
|
||||
destColorPtr->B = (destColorPtr->B * destColorPtr->A) / 255;
|
||||
}
|
||||
|
||||
++ srcColorPtr;
|
||||
++ destColorPtr;
|
||||
}
|
||||
while (srcColorPtr != srcColorPtrLast);
|
||||
|
||||
// use malloc() because X will free() data itself
|
||||
CRGBA *src32 = (CRGBA*)malloc(colorBm.getSize()*4);
|
||||
memcpy(src32, &colorBm.getPixels(0)[0], colorBm.getSize()*4);
|
||||
|
||||
uint size = iconWidth * iconHeight;
|
||||
|
||||
// Create the icon pixmap
|
||||
sint screen = DefaultScreen(_dpy);
|
||||
Visual *visual = DefaultVisual(_dpy, screen);
|
||||
|
||||
if (!visual)
|
||||
{
|
||||
nlwarning("Failed to get a default visual for screen %d", screen);
|
||||
return false;
|
||||
}
|
||||
|
||||
// create the icon pixmap
|
||||
XImage* image = XCreateImage(_dpy, visual, 32, ZPixmap, 0, (char*)src32, iconWidth, iconHeight, 32, 0);
|
||||
|
||||
if (!image)
|
||||
{
|
||||
nlwarning("Failed to set the window's icon");
|
||||
return false;
|
||||
}
|
||||
|
||||
Pixmap pixmap = XCreatePixmap(_dpy, _win, iconWidth, iconHeight, 32 /* defDepth */);
|
||||
|
||||
if (!pixmap)
|
||||
{
|
||||
nlwarning("Failed to create a pixmap %ux%ux%d", iconWidth, iconHeight, 32);
|
||||
return false;
|
||||
}
|
||||
|
||||
GC gc = XCreateGC(_dpy, pixmap, 0, NULL);
|
||||
|
||||
if (!gc)
|
||||
{
|
||||
nlwarning("Failed to create a GC");
|
||||
return false;
|
||||
}
|
||||
|
||||
sint res = XPutImage(_dpy, pixmap, gc, image, 0, 0, 0, 0, iconWidth, iconHeight);
|
||||
// should return 0
|
||||
nlwarning("XPutImage returned %d", res);
|
||||
|
||||
res = XFreeGC(_dpy, gc);
|
||||
// should return 1
|
||||
nlwarning("XFreeGC returned %d", res);
|
||||
|
||||
if (image->data)
|
||||
{
|
||||
free(image->data);
|
||||
image->data = NULL;
|
||||
}
|
||||
|
||||
XDestroyImage(image);
|
||||
|
||||
XRenderPictFormat *format = XRenderFindStandardFormat(_dpy, PictStandardARGB32);
|
||||
|
||||
if (!format)
|
||||
{
|
||||
nlwarning("Failed to find a standard format");
|
||||
return false;
|
||||
}
|
||||
|
||||
Picture picture = XRenderCreatePicture(_dpy, pixmap, format, 0, 0);
|
||||
|
||||
if (!picture)
|
||||
{
|
||||
nlwarning("Failed to create picture");
|
||||
return false;
|
||||
}
|
||||
|
||||
cursor = XRenderCreateCursor(_dpy, picture, (uint)hotSpotX, (uint)hotSpotY);
|
||||
|
||||
if (!cursor)
|
||||
{
|
||||
nlwarning("Failed to create cursor");
|
||||
return false;
|
||||
}
|
||||
|
||||
XRenderFreePicture(_dpy, picture);
|
||||
res = XFreePixmap(_dpy, pixmap);
|
||||
// should return 1
|
||||
nlwarning("XFreePixmap returned %d", res);
|
||||
|
||||
return true;
|
||||
|
||||
#else
|
||||
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // NL3D
|
||||
|
|
|
@ -1664,6 +1664,13 @@ void CDriverUser::setCursor(const std::string &name, NLMISC::CRGBA col, uint8
|
|||
_Driver->setCursor(name, col, rot, hotSpotX, hotSpotY, forceRebuild);
|
||||
}
|
||||
|
||||
void CDriverUser::setCursorScale(float scale)
|
||||
{
|
||||
NL3D_HAUTO_UI_DRIVER;
|
||||
|
||||
_Driver->setCursorScale(scale);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// Async Texture loading mgt
|
||||
|
|
|
@ -2960,12 +2960,18 @@ This MUST follow the Enum MISSION_DESC::TIconId
|
|||
<variable entry="UI:SAVE:CHAT:COLORS:TELL"
|
||||
type="rgba"
|
||||
value="170 170 170 255" />
|
||||
<variable entry="UI:SAVE:CHAT:COLORS:DYN"
|
||||
type="rgba"
|
||||
value="162 255 173 255" />
|
||||
<variable entry="UI:SAVE:CHAT:ENTER_DONT_QUIT_CB"
|
||||
type="bool"
|
||||
value="false" />
|
||||
<variable entry="UI:SAVE:CHAT:SHOW_TIMES_IN_CHAT_CB"
|
||||
type="bool"
|
||||
value="false" />
|
||||
<variable entry="UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB"
|
||||
type="bool"
|
||||
value="false" />
|
||||
<!-- ***************************** -->
|
||||
<!-- * SYSTEM INFO COLORS * -->
|
||||
<!-- ***************************** -->
|
||||
|
|
|
@ -1605,14 +1605,23 @@
|
|||
posparent="cc_univ"
|
||||
x="0"
|
||||
y="-4" />
|
||||
<instance template="tgcw_color"
|
||||
id="cc_dyn"
|
||||
text="uiDynColor"
|
||||
title="uiCCDDyn"
|
||||
tooltip="uittChooseDynColor"
|
||||
posref="BL TL"
|
||||
posparent="cc_shout"
|
||||
x="0"
|
||||
y="-4" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="enter_dontquit_cb"
|
||||
text="uiEnterDontQuitCB"
|
||||
tooltip="uittChatEnter"
|
||||
posparent="cc_univ"
|
||||
posparent="cc_dyn"
|
||||
posref="BL TL"
|
||||
x="0"
|
||||
y="-25" />
|
||||
y="-8" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="show_times_in_chat_cb"
|
||||
text="uiShowTimesInChatCB"
|
||||
|
@ -1621,17 +1630,27 @@
|
|||
posref="BL TL"
|
||||
x="0"
|
||||
y="-8" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="show_dyn_channel_name_in_chat_cb"
|
||||
text="uiShowDynChannelNameInChatCB"
|
||||
tooltip="uittShowDynChannelNameInChat"
|
||||
posparent="show_times_in_chat_cb"
|
||||
posref="BL TL"
|
||||
x="0"
|
||||
y="-8" />
|
||||
<instance template="tgcw_scrollbarint"
|
||||
id="font_size"
|
||||
text="uiFontSize"
|
||||
posref="BL TL"
|
||||
posparent="show_times_in_chat_cb"
|
||||
posparent="show_dyn_channel_name_in_chat_cb"
|
||||
x="0"
|
||||
y="-8" />
|
||||
<link expr="@UI:SAVE:CHAT:ENTER_DONT_QUIT_CB"
|
||||
target="enter_dontquit_cb:c:pushed" />
|
||||
<link expr="@UI:SAVE:CHAT:SHOW_TIMES_IN_CHAT_CB"
|
||||
target="show_times_in_chat_cb:c:pushed" />
|
||||
<link expr="@UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB"
|
||||
target="show_dyn_channel_name_in_chat_cb:c:pushed" />
|
||||
</group>
|
||||
<ctrl style="skin_scroll"
|
||||
id="sb_chat_colors"
|
||||
|
@ -3062,6 +3081,11 @@
|
|||
widget="colbut"
|
||||
link="UI:SAVE:CHAT:COLORS:SHOUT"
|
||||
realtime="true" />
|
||||
<param ui="chat_colors:cc_dyn:c"
|
||||
type="db"
|
||||
widget="colbut"
|
||||
link="UI:SAVE:CHAT:COLORS:DYN"
|
||||
realtime="true" />
|
||||
<!--
|
||||
<param ui="chat_colors:cc_shout:c" type="db" widget="colbut" link="UI:SAVE:CHAT:COLORS:SHOUT" realtime="true" />
|
||||
<param ui="chat_colors:cc_civi:c" type="db" widget="colbut" link="UI:SAVE:CHAT:COLORS:CIVILIZATION" realtime="true" />
|
||||
|
@ -3077,6 +3101,11 @@
|
|||
widget="boolbut"
|
||||
link="UI:SAVE:CHAT:SHOW_TIMES_IN_CHAT_CB"
|
||||
realtime="true" />
|
||||
<param ui="chat_colors:show_dyn_channel_name_in_chat_cb:c"
|
||||
type="db"
|
||||
widget="boolbut"
|
||||
link="UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB"
|
||||
realtime="true" />
|
||||
<param ui="chat_colors:font_size:c"
|
||||
type="db"
|
||||
widget="sbint"
|
||||
|
|
|
@ -801,6 +801,7 @@ struct CClientConfig
|
|||
public:
|
||||
/// Constructor.
|
||||
CClientConfig();
|
||||
virtual ~CClientConfig() {}
|
||||
|
||||
static void setValues (); // Set the values of the ClientCfg instance
|
||||
static void setValuesOnFileChange (); // called when cfg modified
|
||||
|
|
|
@ -1235,7 +1235,7 @@ REGISTER_ACTION_HANDLER( CHandlerEnterTell, "enter_tell");
|
|||
// updateChatModeAndButton
|
||||
//
|
||||
//-----------------------------------------------
|
||||
void CClientChatManager::updateChatModeAndButton(uint mode)
|
||||
void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChannelDbIndex)
|
||||
{
|
||||
// Check if USER chat is active
|
||||
bool userActive = false;
|
||||
|
@ -1274,11 +1274,19 @@ void CClientChatManager::updateChatModeAndButton(uint mode)
|
|||
case CChatGroup::team: if (teamActive) pUserBut->setHardText("uiFilterTeam"); break;
|
||||
case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break;
|
||||
case CChatGroup::dyn_chat:
|
||||
uint32 index = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex();
|
||||
uint32 textId = pIM->getDbProp("SERVER:DYN_CHAT:CHANNEL"+toString(index)+":NAME")->getValue32();
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex);
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
if (title.empty())
|
||||
{
|
||||
// Dyn channel does not exist, don't change
|
||||
m = PeopleInterraction.TheUserChat.Filter.getTargetGroup();
|
||||
dynamicChannelDbIndex = PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
pUserBut->setHardText(title.toUtf8());
|
||||
}
|
||||
break;
|
||||
// NB: user chat cannot have yubo_chat target
|
||||
}
|
||||
|
@ -1300,8 +1308,8 @@ void CClientChatManager::updateChatModeAndButton(uint mode)
|
|||
pEditBox->setX(pUserBut->getWReal()+4);
|
||||
}
|
||||
|
||||
PeopleInterraction.TheUserChat.Filter.setTargetGroup(m);
|
||||
PeopleInterraction.ChatGroup.Filter.setTargetGroup(m);
|
||||
PeopleInterraction.TheUserChat.Filter.setTargetGroup(m, dynamicChannelDbIndex);
|
||||
PeopleInterraction.ChatGroup.Filter.setTargetGroup(m, dynamicChannelDbIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ public :
|
|||
/**
|
||||
* update chat mode button
|
||||
*/
|
||||
void updateChatModeAndButton(uint mode);
|
||||
void updateChatModeAndButton(uint mode, uint32 dynamicChannelDbIndex = 0);
|
||||
|
||||
/**
|
||||
* Get the string for a tell. display now if ready or delay in flushBuffer()
|
||||
|
|
|
@ -1126,7 +1126,11 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","<FileName>")
|
|||
if(strncmp(line, "/*", 2)==0)
|
||||
inComment++;
|
||||
if(inComment<=0)
|
||||
ICommand::execute(line, g_log);
|
||||
{
|
||||
ucstring ucline(line);
|
||||
CInterfaceManager::parseTokens(ucline);
|
||||
ICommand::execute(ucline.toUtf8(), g_log);
|
||||
}
|
||||
if(strncmp(line, "*/", 2)==0)
|
||||
inComment--;
|
||||
}
|
||||
|
@ -1216,12 +1220,14 @@ static bool talkInChan(uint32 nb,std::vector<std::string>args)
|
|||
tmp = tmp+" ";
|
||||
}
|
||||
|
||||
PeopleInterraction.talkInDynamicChannel(nb,ucstring(tmp));
|
||||
ucstring uctmp;
|
||||
uctmp.fromUtf8(tmp);
|
||||
PeopleInterraction.talkInDynamicChannel(nb, uctmp);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatMngr.updateChatModeAndButton(CChatGroup::dyn_chat);
|
||||
ChatMngr.updateChatModeAndButton(CChatGroup::dyn_chat, nb);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -522,6 +522,11 @@ void checkUnderCursor()
|
|||
else
|
||||
{
|
||||
CShapeInstanceReference instref = EntitiesMngr.getShapeInstanceUnderPos(cursX, cursY);
|
||||
|
||||
bool cleanSelectedInstance = EntitiesMngr.instancesRemoved();
|
||||
if (cleanSelectedInstance)
|
||||
selectedInstance = noSelectedInstance;
|
||||
|
||||
UInstance instance = instref.Instance;
|
||||
if (!instance.empty())
|
||||
{
|
||||
|
@ -865,9 +870,12 @@ void contextWebIG(bool rightClick, bool dblClick)
|
|||
{
|
||||
CInterfaceManager *IM = CInterfaceManager::getInstance();
|
||||
CInterfaceElement *pGC = IM->getElementFromId("ui:interface:bot_chat_object");
|
||||
CInterface3DShape *el= dynamic_cast<CInterface3DShape*>(IM->getElementFromId("ui:interface:bot_chat_object:scene3d:object"));
|
||||
CInterface3DShape *el= dynamic_cast<CInterface3DShape*>(IM->getElementFromId("ui:interface:bot_chat_object:scene3d:object_1"));
|
||||
if (el != NULL)
|
||||
{
|
||||
el->setName(selectedInstance.getShapeName());
|
||||
el->setPosX(0.0f);
|
||||
}
|
||||
if (selectedInstanceURL.empty())
|
||||
{
|
||||
if (pGC != NULL)
|
||||
|
|
|
@ -948,6 +948,9 @@ class CHandlerBrowse : public IActionHandler
|
|||
}
|
||||
}
|
||||
|
||||
ucstring ucparams(params);
|
||||
CInterfaceManager::parseTokens(ucparams);
|
||||
params = ucparams.toUtf8();
|
||||
// go. NB: the action handler himself may translate params from utf8
|
||||
CInterfaceManager::getInstance()->runActionHandler(action, elementGroup, params);
|
||||
|
||||
|
@ -2406,10 +2409,13 @@ void setupItemPreview(CSheetHelpSetup &setup, CItemSheet *pIS)
|
|||
else if (pIS->Family == ITEMFAMILY::SHIELD)
|
||||
{
|
||||
cs.VisualPropA.PropertySubData.WeaponLeftHand = CVisualSlotManager::getInstance()->sheet2Index( CSheetId(setup.SrcSheet->getSheetId()), SLOTTYPE::LEFT_HAND_SLOT );
|
||||
if (cs.VisualPropA.PropertySubData.WeaponRightHand != 0)
|
||||
{
|
||||
CItemSheet *pES = SheetMngr.getItem(SLOTTYPE::RIGHT_HAND_SLOT, cs.VisualPropA.PropertySubData.WeaponRightHand);
|
||||
if (pES->ItemType == ITEM_TYPE::TWO_HAND_AXE || pES->ItemType == ITEM_TYPE::TWO_HAND_MACE || pES->ItemType == ITEM_TYPE::TWO_HAND_SWORD ||
|
||||
pES->ItemType == ITEM_TYPE::MAGICIAN_STAFF || pES->ItemType == ITEM_TYPE::AUTOLAUCH || pES->ItemType == ITEM_TYPE::LAUNCHER || pES->ItemType == ITEM_TYPE::RIFLE)
|
||||
cs.VisualPropA.PropertySubData.WeaponRightHand = 0;
|
||||
}
|
||||
SCharacter3DSetup::setupDBFromCharacterSummary("UI:TEMP:CHAR3D", cs);
|
||||
|
||||
}
|
||||
|
|
|
@ -621,8 +621,6 @@ void screenShotPNG()
|
|||
COFile fs(filename);
|
||||
if (!btm.writePNG(fs, 24))
|
||||
{
|
||||
// PNG file has been incorrectly written (mainly because libpng1x.dll was not found)
|
||||
// so close and delete it
|
||||
fs.close();
|
||||
CFile::deleteFile(filename);
|
||||
return;
|
||||
|
|
|
@ -379,7 +379,7 @@ void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32
|
|||
const bool guildActive = pIM->getDbProp("SERVER:GUILD:NAME")->getValueBool();
|
||||
switch(groupType)
|
||||
{
|
||||
case CChatGroup::dyn_chat: // dyn_chat takes the color of say
|
||||
case CChatGroup::dyn_chat: entry+="DYN"; break;
|
||||
case CChatGroup::say: entry+="SAY"; break;
|
||||
case CChatGroup::shout: entry+="SHOUT"; break;
|
||||
case CChatGroup::team: if(!teamActive) return; entry+="GROUP"; break;
|
||||
|
|
|
@ -199,7 +199,7 @@ bool CChatWindow::isVisible() const
|
|||
}
|
||||
|
||||
//=================================================================================
|
||||
void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType /* gt */, uint32 /* dynamicChatDbIndex */, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/)
|
||||
void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/)
|
||||
{
|
||||
if (!_Chat)
|
||||
{
|
||||
|
@ -210,8 +210,26 @@ void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGr
|
|||
|
||||
CChatTextManager &ctm = getChatTextMngr();
|
||||
|
||||
ucstring newmsg = msg;
|
||||
ucstring prefix;
|
||||
if (gt == CChatGroup::dyn_chat)
|
||||
{
|
||||
prefix = "[" + NLMISC::toString(dynamicChatDbIndex) + "]";
|
||||
// Find position to put the new string
|
||||
// After timestamp?
|
||||
size_t pos = msg.find(ucstring("]"));
|
||||
if (pos == ucstring::npos)
|
||||
{
|
||||
// No timestamp, so put it right after the color and add a space
|
||||
pos = msg.find(ucstring("}"));
|
||||
prefix += " ";
|
||||
}
|
||||
newmsg = msg.substr(0, pos + 1) + prefix + msg.substr(pos + 1);
|
||||
prefix.clear();
|
||||
}
|
||||
|
||||
gl = dynamic_cast<CGroupList *>(_Chat->getGroup("cb:text_list"));
|
||||
if (gl) gl->addChild(ctm.createMsgText(msg, col));
|
||||
if (gl) gl->addChild(ctm.createMsgText(newmsg, col));
|
||||
|
||||
// if the group is closed, make it blink
|
||||
if (!_Chat->isOpen())
|
||||
|
@ -557,15 +575,32 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
|
|||
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
||||
CRGBA newMsgColor= stringToRGBA(pIM->getDefine("chat_group_tab_color_newmsg").c_str());
|
||||
|
||||
ucstring newmsg = msg;
|
||||
ucstring prefix;
|
||||
if (gt == CChatGroup::dyn_chat)
|
||||
{
|
||||
prefix = "[" + NLMISC::toString(dynamicChatDbIndex) + "]";
|
||||
// Find position to put the new string
|
||||
// After timestamp?
|
||||
size_t pos = msg.find(ucstring("]"));
|
||||
if (pos == ucstring::npos)
|
||||
{
|
||||
// No timestamp, so put it right after the color and add a space
|
||||
pos = msg.find(ucstring("}"));
|
||||
prefix += " ";
|
||||
}
|
||||
newmsg = msg.substr(0, pos + 1) + prefix + msg.substr(pos + 1);
|
||||
prefix.clear();
|
||||
}
|
||||
|
||||
if (gl != NULL)
|
||||
{
|
||||
gl->addChild(ctm.createMsgText(msg, col));
|
||||
gl->addChild(ctm.createMsgText(newmsg, col));
|
||||
if (!gl->getParent()->getActive())
|
||||
if (tab != NULL)
|
||||
tab->setTextColorNormal(newMsgColor);
|
||||
}
|
||||
|
||||
|
||||
// *** Display the message in the UserChat (special case)
|
||||
{
|
||||
tab = dynamic_cast<CCtrlTabButton*>(_Chat->getCtrl("header_opened:channel_select:tab5"));
|
||||
|
@ -585,14 +620,36 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
|
|||
case CChatGroup::guild: if (ci.Guild.isListeningWindow(cw)) gl = gl2; break;
|
||||
case CChatGroup::system: if (ci.SystemInfo.isListeningWindow(cw)) gl = gl2; break;
|
||||
case CChatGroup::universe: if (ci.Universe.isListeningWindow(cw)) gl = gl2; break;
|
||||
// NB: the yubo chat and dyn_chat cannot be in a user chat
|
||||
case CChatGroup::dyn_chat:
|
||||
if (ci.DynamicChat[dynamicChatDbIndex].isListeningWindow(cw))
|
||||
{
|
||||
gl = gl2;
|
||||
|
||||
// Add dynchannel number and optionally name before text if user channel
|
||||
if (CInterfaceManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false)->getValueBool())
|
||||
{
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex);
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
if ( ! title.empty())
|
||||
{
|
||||
prefix = " " + title;
|
||||
}
|
||||
}
|
||||
|
||||
// Put the new prefix in the correct position
|
||||
size_t pos = newmsg.find(ucstring("] "));
|
||||
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
|
||||
}
|
||||
break;
|
||||
|
||||
// NB: the yubo chat cannot be in a user chat
|
||||
case CChatGroup::yubo_chat: gl = NULL; break;
|
||||
case CChatGroup::dyn_chat: gl = NULL; break;
|
||||
}
|
||||
|
||||
if (gl != NULL)
|
||||
{
|
||||
gl->addChild(ctm.createMsgText(msg, col));
|
||||
gl->addChild(ctm.createMsgText(newmsg, col));
|
||||
if (!gl->getParent()->getActive())
|
||||
if (tab != NULL)
|
||||
tab->setTextColorNormal(newMsgColor);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
//===================================================================================
|
||||
void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
||||
{
|
||||
sint ver= f.serialVersion(2);
|
||||
sint ver = f.serialVersion(3);
|
||||
f.serialCheck((uint32) 'USHC');
|
||||
f.serial(SrcGuild);
|
||||
f.serial(SrcTeam);
|
||||
|
@ -36,4 +36,12 @@ void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
|||
|
||||
if(ver>=2)
|
||||
f.serial(SrcRegion);
|
||||
|
||||
if (ver >= 3)
|
||||
{
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++) {
|
||||
f.serial(SrcDynChat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
bool SrcSystemInfo;
|
||||
bool SrcRegion;
|
||||
bool SrcUniverse;
|
||||
bool SrcDynChat[CChatGroup::MaxDynChanPerPlayer];
|
||||
// output
|
||||
CChatGroup::TGroupType Target;
|
||||
public:
|
||||
|
|
|
@ -111,7 +111,7 @@ void CGroupHTML::addImageDownload(const string &url, CViewBase *img)
|
|||
curl_easy_setopt(curl, CURLOPT_FILE, fp);
|
||||
|
||||
curl_multi_add_handle(MultiCurl, curl);
|
||||
Curls.push_back(CDataDownload(curl, url, fp, ImgType, img, ""));
|
||||
Curls.push_back(CDataDownload(curl, url, fp, ImgType, img, "", ""));
|
||||
#ifdef LOG_DL
|
||||
nlwarning("adding handle %x, %d curls", curl, Curls.size());
|
||||
#endif
|
||||
|
@ -146,7 +146,7 @@ string CGroupHTML::localBnpName(const string &url)
|
|||
}
|
||||
|
||||
// Add a bnp download request in the multi_curl, return true if already downloaded
|
||||
bool CGroupHTML::addBnpDownload(const string &url, const string &action, const string &script)
|
||||
bool CGroupHTML::addBnpDownload(const string &url, const string &action, const string &script, const string &md5sum)
|
||||
{
|
||||
// Search if we are not already downloading this url.
|
||||
for(uint i = 0; i < Curls.size(); i++)
|
||||
|
@ -160,18 +160,17 @@ bool CGroupHTML::addBnpDownload(const string &url, const string &action, const s
|
|||
}
|
||||
}
|
||||
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!MultiCurl || !curl)
|
||||
return false;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
|
||||
string dest = localBnpName(url);
|
||||
string tmpdest = localBnpName(url)+".tmp";
|
||||
#ifdef LOG_DL
|
||||
nlwarning("add to download '%s' dest '%s'", url.c_str(), dest.c_str());
|
||||
#endif
|
||||
// create the local file
|
||||
|
||||
// erase the tmp file if exists
|
||||
if (NLMISC::CFile::fileExists(tmpdest))
|
||||
NLMISC::CFile::deleteFile(tmpdest);
|
||||
|
||||
// create/delete the local file
|
||||
if (NLMISC::CFile::fileExists(dest))
|
||||
{
|
||||
if (action == "override" || action == "delete")
|
||||
|
@ -186,21 +185,31 @@ bool CGroupHTML::addBnpDownload(const string &url, const string &action, const s
|
|||
}
|
||||
if (action != "delete")
|
||||
{
|
||||
FILE *fp = fopen (dest.c_str(), "wb");
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!MultiCurl || !curl)
|
||||
return false;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
|
||||
FILE *fp = fopen (tmpdest.c_str(), "wb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
nlwarning("Can't open file '%s' for writing: code=%d '%s'", dest.c_str (), errno, strerror(errno));
|
||||
nlwarning("Can't open file '%s' for writing: code=%d '%s'", tmpdest.c_str (), errno, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
curl_easy_setopt(curl, CURLOPT_FILE, fp);
|
||||
|
||||
curl_multi_add_handle(MultiCurl, curl);
|
||||
Curls.push_back(CDataDownload(curl, url, fp, BnpType, NULL, script));
|
||||
Curls.push_back(CDataDownload(curl, url, fp, BnpType, NULL, script, md5sum));
|
||||
#ifdef LOG_DL
|
||||
nlwarning("adding handle %x, %d curls", curl, Curls.size());
|
||||
#endif
|
||||
RunningCurls++;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -259,30 +268,29 @@ void CGroupHTML::checkDownloads()
|
|||
string file;
|
||||
|
||||
if (it->type == ImgType)
|
||||
file = localImageName(it->url)+".tmp";
|
||||
file = localImageName(it->url);
|
||||
else
|
||||
file = localBnpName(it->url);
|
||||
|
||||
if(res != CURLE_OK || r < 200 || r >= 300)
|
||||
if(res != CURLE_OK || r < 200 || r >= 300 || ((it->md5sum != "") && (it->md5sum != getMD5(file+".tmp").toString())))
|
||||
{
|
||||
NLMISC::CFile::deleteFile(file.c_str());
|
||||
NLMISC::CFile::deleteFile((file+".tmp").c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
string finalUrl;
|
||||
if (it->type == ImgType)
|
||||
{
|
||||
string image = localImageName(it->url);
|
||||
CFile::moveFile(image.c_str(), (image+".tmp").c_str());
|
||||
if (lookupLocalFile (finalUrl, image.c_str(), false))
|
||||
CFile::moveFile(file.c_str(), (file+".tmp").c_str());
|
||||
if (lookupLocalFile (finalUrl, file.c_str(), false))
|
||||
{
|
||||
for(uint i = 0; i < it->imgs.size(); i++)
|
||||
{
|
||||
// don't display image that are not power of 2
|
||||
uint32 w, h;
|
||||
CBitmap::loadSize (image, w, h);
|
||||
CBitmap::loadSize (file, w, h);
|
||||
if (w == 0 || h == 0 || ((!NLMISC::isPowerOf2(w) || !NLMISC::isPowerOf2(h)) && !NL3D::CTextureFile::supportNonPowerOfTwoTextures()))
|
||||
image.clear();
|
||||
file.clear();
|
||||
|
||||
CCtrlButton *btn = dynamic_cast<CCtrlButton*>(it->imgs[i]);
|
||||
if(btn)
|
||||
|
@ -290,8 +298,8 @@ void CGroupHTML::checkDownloads()
|
|||
#ifdef LOG_DL
|
||||
nlwarning("refresh new downloading image %d button %p", i, it->imgs[i]);
|
||||
#endif
|
||||
btn->setTexture (image);
|
||||
btn->setTexturePushed(image);
|
||||
btn->setTexture (file);
|
||||
btn->setTexturePushed(file);
|
||||
btn->invalidateCoords();
|
||||
btn->invalidateContent();
|
||||
btn->resetInvalidCoords();
|
||||
|
@ -306,7 +314,7 @@ void CGroupHTML::checkDownloads()
|
|||
#ifdef LOG_DL
|
||||
nlwarning("refresh new downloading image %d image %p", i, it->imgs[i]);
|
||||
#endif
|
||||
btm->setTexture (image);
|
||||
btm->setTexture (file);
|
||||
btm->invalidateCoords();
|
||||
btm->invalidateContent();
|
||||
btm->resetInvalidCoords();
|
||||
|
@ -319,25 +327,15 @@ void CGroupHTML::checkDownloads()
|
|||
}
|
||||
else
|
||||
{
|
||||
CFile::moveFile(file.c_str(), (file+".tmp").c_str());
|
||||
if (lookupLocalFile (finalUrl, file.c_str(), false))
|
||||
{
|
||||
bool memoryCompressed = CPath::isMemoryCompressed();
|
||||
if (memoryCompressed)
|
||||
{
|
||||
CPath::memoryUncompress();
|
||||
}
|
||||
CPath::addSearchPath("user/", true, false, NULL);
|
||||
if (memoryCompressed)
|
||||
{
|
||||
CPath::memoryCompress();
|
||||
}
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
pIM->executeLuaScript(_ObjectScript, true);
|
||||
_ObjectScript = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
pIM->executeLuaScript(it->luaScript, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Curls.erase(it);
|
||||
break;
|
||||
}
|
||||
|
@ -1499,11 +1497,12 @@ void CGroupHTML::endElement (uint element_number)
|
|||
{
|
||||
if (!_ObjectData.empty())
|
||||
{
|
||||
if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript))
|
||||
if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript, _ObjectMD5Sum))
|
||||
{
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
pIM->executeLuaScript(_ObjectScript, true);
|
||||
}
|
||||
_ObjectScript = "";
|
||||
}
|
||||
}
|
||||
_Object = false;
|
||||
|
|
|
@ -540,7 +540,7 @@ private:
|
|||
|
||||
struct CDataDownload
|
||||
{
|
||||
CDataDownload(CURL *c, const std::string &u, FILE *f, TDataType t, CViewBase *i, const std::string &s) : curl(c), url(u), luaScript(s), type(t), fp(f)
|
||||
CDataDownload(CURL *c, const std::string &u, FILE *f, TDataType t, CViewBase *i, const std::string &s, const std::string &m) : curl(c), url(u), luaScript(s), md5sum(m), type(t), fp(f)
|
||||
{
|
||||
if (t == ImgType) imgs.push_back(i);
|
||||
}
|
||||
|
@ -548,6 +548,7 @@ private:
|
|||
CURL *curl;
|
||||
std::string url;
|
||||
std::string luaScript;
|
||||
std::string md5sum;
|
||||
TDataType type;
|
||||
FILE *fp;
|
||||
std::vector<CViewBase *> imgs;
|
||||
|
@ -567,7 +568,7 @@ private:
|
|||
// BnpDownload system
|
||||
void initBnpDownload();
|
||||
void checkBnpDownload();
|
||||
bool addBnpDownload(const std::string &url, const std::string &action, const std::string &script);
|
||||
bool addBnpDownload(const std::string &url, const std::string &action, const std::string &script, const std::string &md5sum);
|
||||
std::string localBnpName(const std::string &url);
|
||||
|
||||
void releaseDownloads();
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
};
|
||||
public:
|
||||
CGroupMap(const TCtorParam ¶m);
|
||||
~CGroupMap();
|
||||
virtual ~CGroupMap();
|
||||
// Add a decoration to the map. The map will call the 'onAdd' method. When this object is destroyed, it will call the 'onRemove' method
|
||||
void addDeco(IDeco *deco);
|
||||
// Remove a decoration from the map. This will also call the 'onRemove' method. It is up to the owner to delete it.
|
||||
|
|
|
@ -64,7 +64,6 @@ CInputHandlerManager::CInputHandlerManager()
|
|||
_MouseButtonsState = noButton;
|
||||
_MouseX = _MouseY = _MouseLastX = _MouseLastY = 0;
|
||||
_Focus = true;
|
||||
// Driver->setFocus(true);
|
||||
_MouseWheel = 0;
|
||||
_SkipInterfaceManager=false;
|
||||
_RecoverFocusLost = false;
|
||||
|
@ -153,12 +152,11 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
|
|||
CEventSetFocus *pEvent=(CEventSetFocus *)&event;
|
||||
if (!pEvent->Get)
|
||||
{
|
||||
// Disactive all keys
|
||||
// Deactivate all keys
|
||||
_MouseButtonsDown = noButton;
|
||||
_MouseButtonsReleased = noButton;
|
||||
_MouseButtonsState = noButton;
|
||||
_Focus = false;
|
||||
// Driver->setFocus(false);
|
||||
|
||||
if (!_SkipInterfaceManager)
|
||||
{
|
||||
|
@ -184,7 +182,6 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
|
|||
_RecoverFocusLost = true; // force to update mouse pos on next click or move
|
||||
Driver->showCursor(IsMouseCursorHardware());
|
||||
_Focus = true;
|
||||
// Driver->setFocus(true);
|
||||
}
|
||||
|
||||
if(!_SkipInterfaceManager)
|
||||
|
|
|
@ -6348,8 +6348,8 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|||
// Get the whole token substring first
|
||||
end_pos = str.find(end_token, start_pos + 1);
|
||||
|
||||
if ((start_pos == string::npos) ||
|
||||
(end_pos == string::npos) ||
|
||||
if ((start_pos == ucstring::npos) ||
|
||||
(end_pos == ucstring::npos) ||
|
||||
(end_pos <= start_pos + 1))
|
||||
{
|
||||
// Wrong formatting; give up on this one.
|
||||
|
@ -6566,17 +6566,15 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|||
}
|
||||
|
||||
|
||||
// Replace all occurances of token with the replacement
|
||||
// Replace token
|
||||
size_t token_whole_pos = str.find(token_whole);
|
||||
start_pos = 0;
|
||||
|
||||
// Only do extra replacement if using default
|
||||
extra_replacement = (token_replacement == token_default) ? extra_replacement : 0;
|
||||
while (str.find(token_whole, start_pos) != string::npos)
|
||||
if (str.find(token_whole, start_pos) != string::npos)
|
||||
{
|
||||
str = str.replace(token_whole_pos, token_whole.length() + extra_replacement, token_replacement);
|
||||
start_pos = token_whole_pos + token_replacement.length();
|
||||
token_whole_pos = str.find(token_whole, start_pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1351,6 +1351,7 @@ void CLuaIHM::registerIHM(CLuaState &ls)
|
|||
ls.registerFunc("enableModalWindow", enableModalWindow);
|
||||
ls.registerFunc("disableModalWindow", disableModalWindow);
|
||||
ls.registerFunc("getPlayerPos", getPlayerPos);
|
||||
ls.registerFunc("addSearchPathUser", addSearchPathUser);
|
||||
ls.registerFunc("displaySystemInfo", displaySystemInfo);
|
||||
ls.registerFunc("disableContextHelpForControl", disableContextHelpForControl);
|
||||
ls.registerFunc("disableContextHelp", disableContextHelp);
|
||||
|
@ -4244,6 +4245,23 @@ int CLuaIHM::getPlayerPos(CLuaState &ls)
|
|||
return 3;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
int CLuaIHM::addSearchPathUser(CLuaState &ls)
|
||||
{
|
||||
//H_AUTO(Lua_CLuaIHM_addSearchPathUser)
|
||||
bool memoryCompressed = CPath::isMemoryCompressed();
|
||||
if (memoryCompressed)
|
||||
{
|
||||
CPath::memoryUncompress();
|
||||
}
|
||||
CPath::addSearchPath("user/", true, false, NULL);
|
||||
if (memoryCompressed)
|
||||
{
|
||||
CPath::memoryCompress();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
int CLuaIHM::isPlayerFreeTrial(CLuaState &ls)
|
||||
{
|
||||
|
|
|
@ -346,6 +346,7 @@ private:
|
|||
static int enableModalWindow(CLuaState &ls);
|
||||
static int disableModalWindow(CLuaState &ls);
|
||||
static int getPlayerPos(CLuaState &ls);
|
||||
static int addSearchPathUser(CLuaState &ls);
|
||||
static int getClientCfgVar(CLuaState &ls);
|
||||
static int isPlayerFreeTrial(CLuaState &ls);
|
||||
static int isPlayerNewbie(CLuaState &ls);
|
||||
|
|
|
@ -487,9 +487,6 @@ void CPeopleInterraction::initStdInputs()
|
|||
if (YuboChat)
|
||||
ChatInput.YuboChat.addListeningWindow(YuboChat);
|
||||
|
||||
// NB: The universe channel can only be seen from the user chat (and hence chat group)
|
||||
// There is no Special universe window
|
||||
|
||||
if (TheUserChat.Window)
|
||||
{
|
||||
ChatInput.AroundMe.addListeningWindow(TheUserChat.Window);
|
||||
|
@ -498,6 +495,11 @@ void CPeopleInterraction::initStdInputs()
|
|||
ChatInput.Guild.addListeningWindow(TheUserChat.Window);
|
||||
ChatInput.Universe.addListeningWindow (TheUserChat.Window);
|
||||
// Don't add the system info by default
|
||||
// Dynamic chats
|
||||
for(i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
ChatInput.DynamicChat[i].addListeningWindow(TheUserChat.Window);
|
||||
}
|
||||
}
|
||||
|
||||
ChatInput.Tell.addListeningPeopleList(&FriendList);
|
||||
|
@ -1572,6 +1574,7 @@ void CPeopleInterraction::buildFilteredChatSummary(const CFilteredChat &src, CFi
|
|||
fcs.SrcTell = ChatInput.Tell.isListeningWindow(src.Window);
|
||||
fcs.SrcRegion = ChatInput.Region.isListeningWindow(src.Window);
|
||||
fcs.SrcUniverse = ChatInput.Universe.isListeningWindow(src.Window);
|
||||
|
||||
// fill target infos
|
||||
if (src.Filter.getTargetPartyChat() != NULL || !src.Filter.getTargetPlayer().empty())
|
||||
{
|
||||
|
@ -1581,6 +1584,11 @@ void CPeopleInterraction::buildFilteredChatSummary(const CFilteredChat &src, CFi
|
|||
{
|
||||
fcs.Target = src.Filter.getTargetGroup();
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
fcs.SrcDynChat[i] = ChatInput.DynamicChat[i].isListeningWindow(src.Window);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
|
@ -1725,6 +1733,11 @@ void CPeopleInterraction::setupUserChatFromSummary(const CFilteredChatSummary &s
|
|||
ChatInput.Tell.setWindowState(dest.Window, summary.SrcTell);
|
||||
ChatInput.Region.setWindowState(dest.Window, summary.SrcRegion);
|
||||
ChatInput.Universe.setWindowState(dest.Window, summary.SrcUniverse);
|
||||
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
ChatInput.DynamicChat[i].setWindowState(dest.Window, summary.SrcDynChat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
|
@ -2491,7 +2504,7 @@ public:
|
|||
for (uint i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
string s = toString(i);
|
||||
uint32 textId = im->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":NAME")->getValue32();
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(i);
|
||||
bool active = (textId != 0);
|
||||
if (active)
|
||||
{
|
||||
|
@ -2678,7 +2691,7 @@ class CHandlerSelectChatSource : public IActionHandler
|
|||
CViewTextMenu *pVTM = dynamic_cast<CViewTextMenu *>(im->getElementFromId(MAIN_CHAT_SOURCE_MENU+":tab:dyn"+s));
|
||||
if (pVTM)
|
||||
{
|
||||
uint32 textId = im->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":NAME")->getValue32();
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(i);
|
||||
bool active = (textId != 0);
|
||||
pVTM->setActive(active);
|
||||
if (active)
|
||||
|
@ -2799,6 +2812,22 @@ class CHandlerSelectChatSource : public IActionHandler
|
|||
++ insertionIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Add all existing dynamic channels and set the names
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
string s = toString(i);
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(i);
|
||||
bool active = (textId != 0);
|
||||
if (active)
|
||||
{
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
menu->addLineAtIndex(insertionIndex, "["+s+"] " + title, FILTER_TOGGLE, "dyn"+s);
|
||||
menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw)));
|
||||
++insertionIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2907,6 +2936,14 @@ class CHandlerChatSourceSelected : public IActionHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (nlstricmp(sParams.substr(0, 3), "dyn") == 0)
|
||||
{
|
||||
uint8 i = 0;
|
||||
fromString(sParams.substr(3), i);
|
||||
if (ci.DynamicChat[i].isListeningWindow(cw)) ci.DynamicChat[i].removeListeningWindow(cw);
|
||||
else ci.DynamicChat[i].addListeningWindow(cw);
|
||||
}
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER( CHandlerChatSourceSelected, "chat_source_selected");
|
||||
|
|
|
@ -48,7 +48,7 @@ CViewPointer::CViewPointer (const TCtorParam ¶m)
|
|||
: CViewBase(param),
|
||||
_Buttons(NLMISC::noButton)
|
||||
{
|
||||
_PointerX = _PointerY = _PointerOldX = _PointerOldY = 0;
|
||||
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
||||
_PointerDown = false;
|
||||
_PointerVisible = true;
|
||||
_TxIdDefault = -2;
|
||||
|
|
|
@ -729,7 +729,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
|
|||
|
||||
_GlobalTextures.push_back (gt);
|
||||
|
||||
// Driver->setHardwareCursorScale(ClientCfg.HardwareCursorScale);
|
||||
Driver->setCursorScale(ClientCfg.HardwareCursorScale);
|
||||
|
||||
char bufTmp[256], tgaName[256];
|
||||
string sTGAname;
|
||||
|
|
|
@ -666,7 +666,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
|||
string entry="UI:SAVE:CHAT:COLORS:";
|
||||
switch(mode)
|
||||
{
|
||||
case CChatGroup::dyn_chat: // dyn_chat takes the color of say
|
||||
case CChatGroup::dyn_chat: entry+="DYN"; break;
|
||||
case CChatGroup::say: entry+="SAY"; break;
|
||||
case CChatGroup::shout: entry+="SHOUT"; break;
|
||||
case CChatGroup::team: entry+="GROUP"; break;
|
||||
|
@ -763,10 +763,14 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
|||
sint32 dbIndex= ChatMngr.getDynamicChannelDbIndexFromId(dynChatId);
|
||||
// if found, display, else discarded
|
||||
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer)
|
||||
{
|
||||
PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible);
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ucstring::size_type index = finalString.find(ucstring("<BPFX>"));
|
||||
|
|
|
@ -1381,10 +1381,9 @@ bool CClientEditionModule::loadUserComponent(const std::string& filename, bool m
|
|||
}
|
||||
|
||||
CHashKeyMD5 md5Id;
|
||||
uint32 timeStamp;
|
||||
uint32 timeStamp = 0;
|
||||
if (! compressed)
|
||||
{
|
||||
|
||||
FILE* file = fopen(filename.c_str(),"rb");
|
||||
if (!file)
|
||||
{
|
||||
|
@ -1488,9 +1487,6 @@ bool CClientEditionModule::loadUserComponent(const std::string& filename, bool m
|
|||
uncompressedFile = new uint8[ data.size() ];
|
||||
memcpy(uncompressedFile, data.c_str(), data.size());
|
||||
uncompressedFileLength = (uint32)data.size();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1572,6 +1568,9 @@ bool CClientEditionModule::loadUserComponent(const std::string& filename, bool m
|
|||
|
||||
uncompressedFile[uncompressedFileLength] = '\0';
|
||||
}
|
||||
|
||||
// TODO: compute md5Id and timeStamp
|
||||
|
||||
_UserComponents[filename] = new CUserComponent(filename, uncompressedFile, uncompressedFileLength, compressedFile, compressedFileLength);
|
||||
_UserComponents[filename]->Md5Id = md5Id;
|
||||
_UserComponents[filename]->TimeStamp = timeStamp;
|
||||
|
|
|
@ -556,6 +556,10 @@ void CDynamicMapClient::requestSetNode(const std::string& instanceId, const std:
|
|||
class CNotifySonDeletion : public CEditor::IObserverAction
|
||||
{
|
||||
public:
|
||||
virtual ~CNotifySonDeletion()
|
||||
{
|
||||
}
|
||||
|
||||
CInstance &ErasedInstance;
|
||||
CNotifySonDeletion(CInstance &erasedInstance) : ErasedInstance(erasedInstance) {}
|
||||
virtual void doAction(CEditor::IInstanceObserver &obs)
|
||||
|
@ -568,6 +572,10 @@ public:
|
|||
class CTraverseEraseRequestedSons : public IInstanceVisitor
|
||||
{
|
||||
public:
|
||||
virtual ~CTraverseEraseRequestedSons()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void visit(CInstance &inst)
|
||||
{
|
||||
CNotifySonDeletion notifySonDeletion(inst);
|
||||
|
|
|
@ -376,6 +376,8 @@ public:
|
|||
|
||||
struct IInstanceObserver : public NLMISC::CRefCount // refptr'ed observers
|
||||
{
|
||||
virtual ~IInstanceObserver() {}
|
||||
|
||||
typedef NLMISC::CRefPtr<IInstanceObserver> TRefPtr;
|
||||
// called when the watched instance has been created
|
||||
virtual void onInstanceCreated(CInstance &/* instance */) {}
|
||||
|
@ -970,6 +972,7 @@ public:
|
|||
// allowing for safe removal of observer when they are triggered
|
||||
struct IObserverAction
|
||||
{
|
||||
virtual ~IObserverAction() { }
|
||||
virtual void doAction(IInstanceObserver &obs) = 0;
|
||||
};
|
||||
void triggerInstanceObserver(const TInstanceId &id, IObserverAction &action);
|
||||
|
|
|
@ -44,6 +44,8 @@ class CSerializeContext;
|
|||
// vistor triggered at traversal of object tree. see CObject::visit
|
||||
struct IObjectVisitor
|
||||
{
|
||||
virtual ~IObjectVisitor() { }
|
||||
|
||||
virtual void visit(CObjectRefId &/* obj */) {}
|
||||
virtual void visit(CObjectString &/* obj */) {}
|
||||
virtual void visit(CObjectNumber &/* obj */) {}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "char_filter_factory.h"
|
||||
#include "character.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// namespaces
|
||||
|
|
Loading…
Reference in a new issue