mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-27 02:50:53 +00:00
Merged develop
This commit is contained in:
commit
c7bfb9cf20
54 changed files with 695 additions and 112 deletions
|
@ -110,6 +110,10 @@ FIND_PACKAGE(Jpeg)
|
|||
|
||||
IF(WITH_STATIC_LIBXML2)
|
||||
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
|
||||
IF(NOT WIN32 AND NOT APPLE)
|
||||
FIND_PACKAGE(LibLZMA REQUIRED)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
|
||||
ENDIF(NOT WIN32 AND NOT APPLE)
|
||||
ENDIF(WITH_STATIC_LIBXML2)
|
||||
|
||||
IF(WITH_STATIC)
|
||||
|
|
|
@ -52,12 +52,6 @@ IF(DXSDK_DIR)
|
|||
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
|
||||
|
||||
#FIND_DXSDK_LIBRARY(DXSDK_MESH_LIBRARY mesh)
|
||||
#FIND_DXSDK_LIBRARY(DXSDK_MAXUTIL_LIBRARY maxutil)
|
||||
#FIND_DXSDK_LIBRARY(DXSDK_MAXSCRIPT_LIBRARY maxscrpt)
|
||||
#FIND_DXSDK_LIBRARY(DXSDK_PARAMBLK2_LIBRARY paramblk2)
|
||||
#FIND_DXSDK_LIBRARY(DXSDK_BMM_LIBRARY bmm)
|
||||
ENDIF(DXSDK_DIR)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
|
||||
|
|
|
@ -12,6 +12,12 @@ MACRO(FIND_CORRECT_LUA_VERSION)
|
|||
SET(LUA52_LIBRARY "liblua5.2")
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
|
||||
|
||||
IF(NOT LUALIB_FOUND)
|
||||
# fedora (v20)
|
||||
SET(LUA52_LIBRARY "liblua-5.2")
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
|
||||
ENDIF(NOT LUALIB_FOUND)
|
||||
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.2")
|
||||
FIND_PACKAGE(Lua52 REQUIRED)
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
// For clipTrav. cleared at beginning of CClipTrav::traverse
|
||||
void clearVisibleList();
|
||||
|
||||
// For ClipTrav only. NB: list is cleared at begininng of traverse(). NB: only CTransform are supported
|
||||
// For ClipTrav only. NB: list is cleared at beginning of traverse(). NB: only CTransform are supported
|
||||
void addVisibleModel(CTransform *model)
|
||||
{
|
||||
_VisibleList[_CurrentNumVisibleModels]= model;
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
|
||||
void setShaded (bool b) { _Shaded = b; }
|
||||
|
||||
void setShadeOutline (bool b) { _ShadeOutline = b; }
|
||||
|
||||
void setShadeExtent (float shext) { _ShadeExtent = shext; }
|
||||
|
||||
/// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255)
|
||||
|
@ -107,6 +109,8 @@ public:
|
|||
|
||||
bool getShaded() const { return _Shaded; }
|
||||
|
||||
bool getShadeOutline() const { return _ShadeOutline; }
|
||||
|
||||
bool getKeep800x600Ratio() const {return _Keep800x600Ratio;}
|
||||
|
||||
NLMISC::CRGBA getShadeColor () const { return _ShadeColor; }
|
||||
|
@ -144,6 +148,12 @@ public:
|
|||
rCS.Color = _ShadeColor;
|
||||
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
|
||||
rCS.render2D(*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
|
||||
if (_ShadeOutline)
|
||||
{
|
||||
rCS.render2D(*_Driver, x-_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
|
||||
rCS.render2D(*_Driver, x-_ShadeExtent, z+_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
|
||||
rCS.render2D(*_Driver, x+_ShadeExtent, z+_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
|
||||
}
|
||||
rCS.Color= bkup;
|
||||
}
|
||||
rCS.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
|
||||
|
@ -162,6 +172,12 @@ public:
|
|||
rCS.Color= _ShadeColor;
|
||||
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
|
||||
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax);
|
||||
if (_ShadeOutline)
|
||||
{
|
||||
rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax);
|
||||
rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z+_ShadeExtent, xmin, ymin, xmax, ymax);
|
||||
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z+_ShadeExtent, xmin, ymin, xmax, ymax);
|
||||
}
|
||||
rCS.Color= bkup;
|
||||
}
|
||||
rCS.render2DClip (*_Driver, rdrBuffer, x, z, xmin, ymin, xmax, ymax);
|
||||
|
@ -180,6 +196,12 @@ public:
|
|||
rCS.Color= _ShadeColor;
|
||||
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
|
||||
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
|
||||
if (_ShadeOutline)
|
||||
{
|
||||
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
|
||||
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax);
|
||||
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax);
|
||||
}
|
||||
rCS.Color= bkup;
|
||||
}
|
||||
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y, depth, xmin, ymin, xmax, ymax);
|
||||
|
@ -200,6 +222,12 @@ public:
|
|||
_TempString.Color = _ShadeColor;
|
||||
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
|
||||
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
if (_ShadeOutline)
|
||||
{
|
||||
_TempString.render2D(*_Driver,x-_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
_TempString.render2D(*_Driver,x-_ShadeExtent,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
_TempString.render2D(*_Driver,x+_ShadeExtent,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
}
|
||||
_TempString.Color = bkup;
|
||||
}
|
||||
|
||||
|
@ -224,6 +252,12 @@ public:
|
|||
_TempString.Color = _ShadeColor;
|
||||
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
|
||||
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
if (_ShadeOutline)
|
||||
{
|
||||
_TempString.render2D(*_Driver,x-_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
_TempString.render2D(*_Driver,x-_ShadeExtent,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
_TempString.render2D(*_Driver,x+_ShadeExtent,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
|
||||
}
|
||||
_TempString.Color = bkup;
|
||||
}
|
||||
|
||||
|
@ -317,6 +351,9 @@ private:
|
|||
/// true if text is shaded
|
||||
bool _Shaded;
|
||||
|
||||
/// true if shade appears as an outline
|
||||
bool _ShadeOutline;
|
||||
|
||||
/// shade's extent (shadow size)
|
||||
float _ShadeExtent;
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
float getScaleY() const;
|
||||
void setShaded(bool b);
|
||||
bool getShaded() const;
|
||||
void setShadeOutline(bool b);
|
||||
bool getShadeOutline() const;
|
||||
void setShadeExtent(float shext) ;
|
||||
void setShadeColor (NLMISC::CRGBA sc);
|
||||
NLMISC::CRGBA getShadeColor () const;
|
||||
|
|
|
@ -174,6 +174,15 @@ public:
|
|||
* \return the shade state
|
||||
*/
|
||||
virtual bool getShaded () const = 0;
|
||||
/**
|
||||
* set the shade states
|
||||
* \param the shade state
|
||||
*/
|
||||
virtual void setShadeOutline (bool b) = 0;
|
||||
/**
|
||||
* \return the shade state
|
||||
*/
|
||||
virtual bool getShadeOutline () const = 0;
|
||||
/**
|
||||
* set the shadow's size
|
||||
* \param the shade extent
|
||||
|
|
|
@ -285,7 +285,7 @@ namespace NLGUI
|
|||
void addImage(const char *image, bool globalColor, bool reloadImg=false);
|
||||
|
||||
// Add a text area in the current paragraph
|
||||
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content);
|
||||
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
|
||||
|
||||
// Add a combo box in the current paragraph
|
||||
CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name);
|
||||
|
@ -557,6 +557,7 @@ namespace NLGUI
|
|||
std::string _TextAreaName;
|
||||
uint _TextAreaRow;
|
||||
uint _TextAreaCols;
|
||||
uint _TextAreaMaxLength;
|
||||
|
||||
// current mode is in select option
|
||||
bool _SelectOption;
|
||||
|
|
|
@ -381,6 +381,7 @@ namespace NLGUI
|
|||
|
||||
bool _CloseSubMenuUsingPopModal;
|
||||
bool _Shadow;
|
||||
bool _ShadowOutline;
|
||||
bool _Formatted;
|
||||
uint8 _Space;
|
||||
sint32 _FontSize;
|
||||
|
|
|
@ -150,16 +150,17 @@ namespace NLGUI
|
|||
sint32 TxId_E_Open, W_E_Open, H_E_Open;
|
||||
sint32 TxId_M_Open, W_M_Open, H_M_Open;
|
||||
|
||||
sint32 TxId_TL_HighLight;
|
||||
sint32 TxId_T_HighLight;
|
||||
sint32 TxId_TR_HighLight;
|
||||
sint32 TxId_L_HighLight;
|
||||
sint32 TxId_R_HighLight;
|
||||
sint32 TxId_BL_HighLight;
|
||||
sint32 TxId_B_HighLight;
|
||||
sint32 TxId_BR_HighLight;
|
||||
sint32 TxId_TL_HighLight, W_TL_HighLight, H_TL_HighLight;
|
||||
sint32 TxId_T_HighLight, W_T_HighLight, H_T_HighLight;
|
||||
sint32 TxId_TR_HighLight, W_TR_HighLight, H_TR_HighLight;
|
||||
sint32 TxId_L_HighLight, W_L_HighLight, H_L_HighLight;
|
||||
sint32 TxId_R_HighLight, W_R_HighLight, H_R_HighLight;
|
||||
sint32 TxId_BL_HighLight, W_BL_HighLight, H_BL_HighLight;
|
||||
sint32 TxId_B_HighLight, W_B_HighLight, H_B_HighLight;
|
||||
sint32 TxId_BR_HighLight, W_BR_HighLight, H_BR_HighLight;
|
||||
|
||||
sint32 HeaderH;
|
||||
sint32 InsetT; // Offset height of top texture
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -189,6 +189,7 @@ namespace NLGUI
|
|||
HTML_ATTR(TEXTAREA,DISABLED),
|
||||
HTML_ATTR(TEXTAREA,ID),
|
||||
HTML_ATTR(TEXTAREA,LANG),
|
||||
HTML_ATTR(TEXTAREA,MAXLENGTH),
|
||||
HTML_ATTR(TEXTAREA,NAME),
|
||||
HTML_ATTR(TEXTAREA,READONLY),
|
||||
HTML_ATTR(TEXTAREA,ROWS),
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace NLGUI
|
|||
|
||||
/// Constructor
|
||||
CViewText (const std::string& id, const std::string Text="", sint FontSize=12,
|
||||
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false);
|
||||
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false, bool ShadowOutline=false);
|
||||
|
||||
virtual ~CViewText();
|
||||
|
||||
|
@ -83,6 +83,7 @@ namespace NLGUI
|
|||
void setFontSize (sint nFontSize);
|
||||
void setColor (const NLMISC::CRGBA &color);
|
||||
void setShadow (bool bShadow);
|
||||
void setShadowOutline (bool bShadowOutline);
|
||||
void setShadowColor (const NLMISC::CRGBA &color);
|
||||
void setLineMaxW (sint nMaxW, bool invalidate=true);
|
||||
void setMultiLine (bool bMultiLine);
|
||||
|
@ -102,6 +103,7 @@ namespace NLGUI
|
|||
sint getFontSize() const;
|
||||
NLMISC::CRGBA getColor() { return _Color; }
|
||||
bool getShadow() { return _Shadow; }
|
||||
bool getShadowOutline() { return _ShadowOutline; }
|
||||
NLMISC::CRGBA getShadowColor() { return _ShadowColor; }
|
||||
sint getLineMaxW() const { return _LineMaxW; }
|
||||
bool getMultiLine() const { return _MultiLine; }
|
||||
|
@ -229,6 +231,7 @@ namespace NLGUI
|
|||
NLMISC::CRGBA _Color;
|
||||
/// the shadow mode
|
||||
bool _Shadow;
|
||||
bool _ShadowOutline;
|
||||
/// the case mode
|
||||
TCaseMode _CaseMode;
|
||||
/// the text shadow color
|
||||
|
|
|
@ -148,7 +148,7 @@ CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_PP(NULL), m_VP(NULL),
|
|||
m_QuadUV.V2 = CVector(1.f, 1.f, 0.5f);
|
||||
m_QuadUV.V3 = CVector(0.f, 1.f, 0.5f);
|
||||
|
||||
if (drv->textureCoordinateAlternativeMode())
|
||||
/*if (drv->textureCoordinateAlternativeMode())
|
||||
{
|
||||
m_QuadUV.Uv0 = CUV(0.f, 1.f);
|
||||
m_QuadUV.Uv1 = CUV(1.f, 1.f);
|
||||
|
@ -156,12 +156,12 @@ CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_PP(NULL), m_VP(NULL),
|
|||
m_QuadUV.Uv3 = CUV(0.f, 0.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
{*/
|
||||
m_QuadUV.Uv0 = CUV(0.f, 0.f);
|
||||
m_QuadUV.Uv1 = CUV(1.f, 0.f);
|
||||
m_QuadUV.Uv2 = CUV(1.f, 1.f);
|
||||
m_QuadUV.Uv3 = CUV(0.f, 1.f);
|
||||
}
|
||||
/*}*/
|
||||
|
||||
/*CVertexBuffer &vb = m_VB;
|
||||
vb.clearValueEx();
|
||||
|
|
|
@ -40,6 +40,7 @@ CTextContext::CTextContext()
|
|||
_ScaleZ = 1.0f;
|
||||
|
||||
_Shaded = false;
|
||||
_ShadeOutline = false;
|
||||
_ShadeExtent = 0.001f;
|
||||
_ShadeColor = NLMISC::CRGBA(0,0,0);
|
||||
|
||||
|
|
|
@ -148,6 +148,18 @@ bool CTextContextUser::getShaded() const
|
|||
|
||||
return _TextContext.getShaded();
|
||||
}
|
||||
void CTextContextUser::setShadeOutline(bool b)
|
||||
{
|
||||
H_AUTO2;
|
||||
|
||||
_TextContext.setShadeOutline(b);
|
||||
}
|
||||
bool CTextContextUser::getShadeOutline() const
|
||||
{
|
||||
H_AUTO2;
|
||||
|
||||
return _TextContext.getShadeOutline();
|
||||
}
|
||||
void CTextContextUser::setShadeExtent(float shext)
|
||||
{
|
||||
H_AUTO2;
|
||||
|
|
|
@ -2373,7 +2373,7 @@ namespace NLGUI
|
|||
{
|
||||
setMaxH(_PopupMaxH);
|
||||
// _W is given by scripter-man
|
||||
newH = pLayer->H_T;
|
||||
newH = (pLayer->H_T - pLayer->InsetT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2382,7 +2382,7 @@ namespace NLGUI
|
|||
_W = _Parent->getW();
|
||||
}
|
||||
setMaxH (16384); // No scrollbar for container of layer > 0
|
||||
newH = pLayer->H_T;
|
||||
newH = (pLayer->H_T - pLayer->InsetT);
|
||||
}
|
||||
|
||||
if (_Opened)
|
||||
|
@ -2396,11 +2396,11 @@ namespace NLGUI
|
|||
_HeaderOpened->setY (- newH);
|
||||
_HeaderOpened->setW (_W-(pLayer->W_L+pLayer->W_R));
|
||||
_HeaderOpened->updateCoords();
|
||||
newH += max (_HeaderOpened->getHReal(), pLayer->getValSInt32 ("header_h"));
|
||||
newH += max (_HeaderOpened->getHReal(), pLayer->HeaderH);
|
||||
}
|
||||
else
|
||||
{
|
||||
newH += pLayer->getValSInt32 ("header_h");
|
||||
newH += pLayer->HeaderH;
|
||||
}
|
||||
|
||||
newH -= (sint32) _ContentYOffset;
|
||||
|
@ -2448,12 +2448,12 @@ namespace NLGUI
|
|||
if (_LayerSetup == 0)
|
||||
{
|
||||
// zeH is the height to substract to total height of the container to obtain height of the list
|
||||
sint32 zeH = pLayer->H_T + pLayer->H_B_Open + pLayer->H_EM_Open;
|
||||
sint32 zeH = (pLayer->H_T - pLayer->InsetT) + pLayer->H_B_Open + pLayer->H_EM_Open;
|
||||
|
||||
if (_HeaderOpened != NULL)
|
||||
zeH += max (_HeaderOpened->getHReal(), pLayer->getValSInt32 ("header_h"));
|
||||
zeH += max (_HeaderOpened->getHReal(), pLayer->HeaderH);
|
||||
else
|
||||
zeH += pLayer->getValSInt32 ("header_h");
|
||||
zeH += pLayer->HeaderH;
|
||||
|
||||
if (_Content != NULL)
|
||||
zeH += _Content->getHReal();
|
||||
|
@ -2513,11 +2513,11 @@ namespace NLGUI
|
|||
_HeaderClosed->setY (-newH);
|
||||
_HeaderClosed->setW (_W-(pLayer->W_L+pLayer->W_R));
|
||||
_HeaderClosed->updateCoords();
|
||||
newH += max (_HeaderClosed->getHReal(), pLayer->getValSInt32 ("header_h"));
|
||||
newH += max (_HeaderClosed->getHReal(), pLayer->HeaderH);
|
||||
}
|
||||
else
|
||||
{
|
||||
newH += pLayer->getValSInt32 ("header_h");
|
||||
newH += pLayer->HeaderH;
|
||||
}
|
||||
newH += pLayer->H_B;
|
||||
|
||||
|
@ -2731,7 +2731,8 @@ namespace NLGUI
|
|||
// h is the size of what is on top of the child list
|
||||
sint32 x, y, w, h;
|
||||
|
||||
h = pLayer->H_T + pLayer->H_B_Open;
|
||||
bool bHasChild = (_List->getNbElement() > 0);
|
||||
h = (pLayer->H_T - pLayer->InsetT) + (((!_Opened) || (!bHasChild)) ? pLayer->H_B : pLayer->H_B_Open);
|
||||
|
||||
if (_Opened)
|
||||
{
|
||||
|
@ -2749,7 +2750,6 @@ namespace NLGUI
|
|||
{
|
||||
h = _HReal;
|
||||
}
|
||||
bool bHasChild = (_List->getNbElement() > 0);
|
||||
|
||||
x = _XReal;
|
||||
y = _YReal+_HReal-h;
|
||||
|
@ -2767,7 +2767,7 @@ namespace NLGUI
|
|||
// Top Right
|
||||
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_TR, y+h-pLayer->H_TR, pLayer->W_TR, pLayer->H_TR, 0, false, pLayer->TxId_TR, col);
|
||||
|
||||
if ((!_Opened) || (_Opened && !bHasChild))
|
||||
if ((!_Opened) || (!bHasChild))
|
||||
{ // Not opened
|
||||
// Left
|
||||
if (pLayer->Tile_L == 0) // Tiling ?
|
||||
|
@ -2817,9 +2817,9 @@ namespace NLGUI
|
|||
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_BR_Open, y, pLayer->W_BR_Open, pLayer->H_BR_Open, 0, false, pLayer->TxId_BR_Open, col);
|
||||
// Content
|
||||
if (pLayer->Tile_Blank == 0) // Tiling ?
|
||||
rVR.drawRotFlipBitmap (rl, x+pLayer->W_L, y+pLayer->H_B, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, col);
|
||||
rVR.drawRotFlipBitmap (rl, x+pLayer->W_L, y+pLayer->H_B_Open, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, col);
|
||||
else
|
||||
rVR.drawRotFlipBitmapTiled (rl, x+pLayer->W_L, y+pLayer->H_B, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, pLayer->Tile_Blank-1, col);
|
||||
rVR.drawRotFlipBitmapTiled (rl, x+pLayer->W_L, y+pLayer->H_B_Open, w-(pLayer->W_R+pLayer->W_L), h-(pLayer->H_B_Open+pLayer->H_T), 0, false, pLayer->TxId_Blank, pLayer->Tile_Blank-1, col);
|
||||
// ScrollBar Placement
|
||||
if (pLayer->Tile_M_Open == 0) // Tiling ?
|
||||
rVR.drawRotFlipBitmap (rl, x, _YReal+pLayer->H_EL_Open, pLayer->W_M_Open, _HReal-h-pLayer->H_EL_Open, 0, false, pLayer->TxId_M_Open, col);
|
||||
|
@ -2848,7 +2848,7 @@ namespace NLGUI
|
|||
// Top Right
|
||||
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_TR, y+h-pLayer->H_TR, pLayer->W_TR, pLayer->H_TR, 0, false, pLayer->TxId_TR, col);
|
||||
|
||||
if ((!_Opened) || (_Opened && !bHasChild))
|
||||
if ((!_Opened) || (!bHasChild))
|
||||
{
|
||||
// Left
|
||||
if (pLayer->Tile_L == 0) // Tiling ?
|
||||
|
@ -2856,7 +2856,7 @@ namespace NLGUI
|
|||
else
|
||||
rVR.drawRotFlipBitmapTiled (rl, x, y+pLayer->H_BL, pLayer->W_L, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_L, pLayer->Tile_L-1, col);
|
||||
// Right
|
||||
if (pLayer->Tile_T == 0) // Tiling ?
|
||||
if (pLayer->Tile_R == 0) // Tiling ?
|
||||
rVR.drawRotFlipBitmap (rl, x+w-pLayer->W_R, y+pLayer->H_BR, pLayer->W_R, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_R, col);
|
||||
else
|
||||
rVR.drawRotFlipBitmapTiled (rl, x+w-pLayer->W_R, y+pLayer->H_BR, pLayer->W_R, h-(pLayer->H_BL+pLayer->H_TL), 0, false, pLayer->TxId_R, pLayer->Tile_R-1, col);
|
||||
|
@ -3003,18 +3003,16 @@ namespace NLGUI
|
|||
col.A = nInverted;
|
||||
else
|
||||
col.A = max(_HighLightedAlpha, nInverted);
|
||||
sint32 hw, hh; // size of highlight texture
|
||||
rVR.getTextureSizeFromId(pLayer->TxId_TL_HighLight, hw, hh);
|
||||
// corners
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x, y + h - hh, hw, hh, 0, false, pLayer->TxId_TL_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - hw, y + h - hh, hw, hh, 0, false, pLayer->TxId_TR_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal, hw, hh, 0, false, pLayer->TxId_BL_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - hw, _YReal, hw, hh, 0, false, pLayer->TxId_BR_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x, y + h - pLayer->H_T_HighLight, pLayer->W_TL_HighLight, pLayer->H_TL_HighLight, 0, false, pLayer->TxId_TL_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - pLayer->W_TR_HighLight, y + h - pLayer->H_T_HighLight, pLayer->W_TR_HighLight, pLayer->H_TR_HighLight, 0, false, pLayer->TxId_TR_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal, pLayer->W_BL_HighLight, pLayer->H_BL_HighLight, 0, false, pLayer->TxId_BL_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - pLayer->W_BR_HighLight, _YReal, pLayer->W_BR_HighLight, pLayer->H_BR_HighLight, 0, false, pLayer->TxId_BR_HighLight, col);
|
||||
// border
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + hw, y + h - hh, _WReal - 2 * hw, hh, 0, false, pLayer->TxId_T_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + hw, _YReal, _WReal - 2 * hw, hh, 0, false, pLayer->TxId_B_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal + hh, hw, _HReal - 2 * hh, 0, false, pLayer->TxId_L_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - hw, _YReal + hh, hw, _HReal - 2 * hh, 0, false, pLayer->TxId_R_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + pLayer->W_TL_HighLight, y + h - pLayer->H_T_HighLight, _WReal - pLayer->W_TL_HighLight - pLayer->W_TR_HighLight, pLayer->H_T_HighLight, 0, false, pLayer->TxId_T_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + pLayer->W_BL_HighLight, _YReal, _WReal - pLayer->W_BL_HighLight - pLayer->W_BR_HighLight, pLayer->H_B_HighLight, 0, false, pLayer->TxId_B_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x, _YReal + pLayer->H_B_HighLight, pLayer->W_L_HighLight, _HReal - pLayer->H_T_HighLight - pLayer->H_B_HighLight, 0, false, pLayer->TxId_L_HighLight, col);
|
||||
rVR.drawRotFlipBitmap (_RenderLayer, x + _WReal - pLayer->W_R_HighLight, _YReal + pLayer->H_B_HighLight, pLayer->W_R_HighLight, _HReal - pLayer->H_T_HighLight - pLayer->H_B_HighLight, 0, false, pLayer->TxId_R_HighLight, col);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3715,6 +3713,7 @@ namespace NLGUI
|
|||
_TitleOpened->setParentPosRef (Hotspot_TL);
|
||||
_TitleOpened->setPosRef (Hotspot_TL);
|
||||
_TitleOpened->setShadow (true);
|
||||
_TitleOpened->setShadowOutline (false);
|
||||
_TitleOpened->setColor (CRGBA(255,255,255,255));
|
||||
_TitleOpened->setModulateGlobalColor(getModulateGlobalColor());
|
||||
_TitleOpened->setOverExtendViewText(_TitleOverExtendViewText);
|
||||
|
@ -3766,6 +3765,7 @@ namespace NLGUI
|
|||
_TitleClosed->setParentPosRef (Hotspot_TL);
|
||||
_TitleClosed->setPosRef (Hotspot_TL);
|
||||
_TitleClosed->setShadow (true);
|
||||
_TitleClosed->setShadowOutline (false);
|
||||
_TitleClosed->setColor (CRGBA(255,255,255,255));
|
||||
_TitleClosed->setModulateGlobalColor(getModulateGlobalColor());
|
||||
_TitleClosed->setOverExtendViewText(_TitleOverExtendViewText);
|
||||
|
|
|
@ -1289,16 +1289,19 @@ namespace NLGUI
|
|||
string name;
|
||||
ucstring ucValue;
|
||||
uint size = 120;
|
||||
uint maxlength = 1024;
|
||||
if (present[MY_HTML_INPUT_NAME] && value[MY_HTML_INPUT_NAME])
|
||||
name = value[MY_HTML_INPUT_NAME];
|
||||
if (present[MY_HTML_INPUT_SIZE] && value[MY_HTML_INPUT_SIZE])
|
||||
fromString(value[MY_HTML_INPUT_SIZE], size);
|
||||
if (present[MY_HTML_INPUT_VALUE] && value[MY_HTML_INPUT_VALUE])
|
||||
ucValue.fromUtf8(value[MY_HTML_INPUT_VALUE]);
|
||||
if (present[MY_HTML_INPUT_MAXLENGTH] && value[MY_HTML_INPUT_MAXLENGTH])
|
||||
fromString(value[MY_HTML_INPUT_MAXLENGTH], maxlength);
|
||||
|
||||
string textTemplate(!templateName.empty() ? templateName : DefaultFormTextGroup);
|
||||
// Add the editbox
|
||||
CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue);
|
||||
CInterfaceGroup *textArea = addTextArea (textTemplate, name.c_str (), 1, size/12, false, ucValue, maxlength);
|
||||
if (textArea)
|
||||
{
|
||||
// Add the text area to the form
|
||||
|
@ -1553,12 +1556,15 @@ namespace NLGUI
|
|||
_TextAreaRow = 1;
|
||||
_TextAreaCols = 10;
|
||||
_TextAreaContent = "";
|
||||
if (present[HTML_TEXTAREA_NAME] && value[HTML_TEXTAREA_NAME])
|
||||
_TextAreaName = value[HTML_TEXTAREA_NAME];
|
||||
if (present[HTML_TEXTAREA_ROWS] && value[HTML_TEXTAREA_ROWS])
|
||||
fromString(value[HTML_TEXTAREA_ROWS], _TextAreaRow);
|
||||
if (present[HTML_TEXTAREA_COLS] && value[HTML_TEXTAREA_COLS])
|
||||
fromString(value[HTML_TEXTAREA_COLS], _TextAreaCols);
|
||||
_TextAreaMaxLength = 1024;
|
||||
if (present[MY_HTML_TEXTAREA_NAME] && value[MY_HTML_TEXTAREA_NAME])
|
||||
_TextAreaName = value[MY_HTML_TEXTAREA_NAME];
|
||||
if (present[MY_HTML_TEXTAREA_ROWS] && value[MY_HTML_TEXTAREA_ROWS])
|
||||
fromString(value[MY_HTML_TEXTAREA_ROWS], _TextAreaRow);
|
||||
if (present[MY_HTML_TEXTAREA_COLS] && value[MY_HTML_TEXTAREA_COLS])
|
||||
fromString(value[MY_HTML_TEXTAREA_COLS], _TextAreaCols);
|
||||
if (present[MY_HTML_TEXTAREA_MAXLENGTH] && value[MY_HTML_TEXTAREA_MAXLENGTH])
|
||||
fromString(value[MY_HTML_TEXTAREA_MAXLENGTH], _TextAreaMaxLength);
|
||||
|
||||
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
|
||||
_TextArea = true;
|
||||
|
@ -1680,7 +1686,7 @@ namespace NLGUI
|
|||
// nlinfo("textarea name '%s'", _TextAreaName.c_str());
|
||||
// nlinfo("textarea %d %d", _TextAreaRow, _TextAreaCols);
|
||||
// nlinfo("textarea content '%s'", _TextAreaContent.toUtf8().c_str());
|
||||
CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent);
|
||||
CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, _TextAreaContent, _TextAreaMaxLength);
|
||||
if (textArea)
|
||||
{
|
||||
// Add the text area to the form
|
||||
|
@ -3258,7 +3264,7 @@ namespace NLGUI
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
CInterfaceGroup *CGroupHTML::addTextArea(const std::string &templateName, const char *name, uint /* rows */, uint cols, bool multiLine, const ucstring &content)
|
||||
CInterfaceGroup *CGroupHTML::addTextArea(const std::string &templateName, const char *name, uint /* rows */, uint cols, bool multiLine, const ucstring &content, uint maxlength)
|
||||
{
|
||||
// In a paragraph ?
|
||||
if (!_Paragraph)
|
||||
|
@ -3280,7 +3286,8 @@ namespace NLGUI
|
|||
templateParams.push_back (std::pair<std::string,std::string> ("multiline", multiLine?"true":"false"));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false"));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("enter_recover_focus", "false"));
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", "1024"));
|
||||
if (maxlength > 0)
|
||||
templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", toString(maxlength)));
|
||||
CInterfaceGroup *textArea = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(),
|
||||
getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size());
|
||||
|
||||
|
|
|
@ -1203,6 +1203,7 @@ namespace NLGUI
|
|||
pV->setColor (_GroupMenu->_Color);
|
||||
pV->setFontSize (_GroupMenu->_FontSize);
|
||||
pV->setShadow (_GroupMenu->_Shadow);
|
||||
pV->setShadowOutline (_GroupMenu->_ShadowOutline);
|
||||
pV->setCheckable(checkable);
|
||||
pV->setChecked(checked);
|
||||
pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor);
|
||||
|
@ -1282,6 +1283,7 @@ namespace NLGUI
|
|||
pV->setColor (_GroupMenu->_Color);
|
||||
pV->setFontSize (_GroupMenu->_FontSize);
|
||||
pV->setShadow (_GroupMenu->_Shadow);
|
||||
pV->setShadowOutline (_GroupMenu->_ShadowOutline);
|
||||
pV->setCheckable(checkable);
|
||||
pV->setChecked(checked);
|
||||
pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor);
|
||||
|
@ -1922,6 +1924,7 @@ namespace NLGUI
|
|||
_HighLightOver.set(128, 0, 0, 255);
|
||||
_FontSize = 12;
|
||||
_Shadow = false;
|
||||
_ShadowOutline = false;
|
||||
_ResizeFromChildH = _ResizeFromChildW = true;
|
||||
_DisplayFrame = false;
|
||||
_RootMenu = NULL;
|
||||
|
@ -1998,6 +2001,11 @@ namespace NLGUI
|
|||
return toString( _Shadow );
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
return toString( _ShadowOutline );
|
||||
}
|
||||
else
|
||||
if( name == "formatted" )
|
||||
{
|
||||
return toString( _Formatted );
|
||||
|
@ -2110,6 +2118,14 @@ namespace NLGUI
|
|||
return;
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
bool b;
|
||||
if( fromString( value, b ) )
|
||||
_ShadowOutline = b;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "formatted" )
|
||||
{
|
||||
bool b;
|
||||
|
@ -2152,6 +2168,7 @@ namespace NLGUI
|
|||
xmlSetProp( node, BAD_CAST "space", BAD_CAST toString( _Space ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "fontsize", BAD_CAST toString( _FontSize ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "formatted", BAD_CAST toString( _Formatted ).c_str() );
|
||||
|
||||
if( _RootMenu == NULL )
|
||||
|
@ -2197,6 +2214,7 @@ namespace NLGUI
|
|||
_Color = gm->_Color;
|
||||
_ShadowColor = gm->_ShadowColor;
|
||||
_Shadow = gm->_Shadow;
|
||||
_ShadowOutline = gm->_ShadowOutline;
|
||||
_FontSize = gm->_FontSize;
|
||||
_ColorOver = gm->_ColorOver;
|
||||
_ShadowColorOver = gm->_ShadowColorOver;
|
||||
|
@ -2266,6 +2284,10 @@ namespace NLGUI
|
|||
if (prop)
|
||||
_Shadow = convertBool(prop);
|
||||
|
||||
prop = (char*) xmlGetProp( in, (xmlChar*)"shadow_outline" );
|
||||
if (prop)
|
||||
_ShadowOutline = convertBool(prop);
|
||||
|
||||
prop = (char*) xmlGetProp( in, (xmlChar*)"formatted" );
|
||||
if (prop)
|
||||
_Formatted = convertBool(prop);
|
||||
|
|
|
@ -271,16 +271,25 @@ namespace NLGUI
|
|||
//
|
||||
|
||||
TxId_TL_HighLight = rVR.getTextureIdFromName (getValStr("tx_tl_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_TL_HighLight, W_TL_HighLight, H_TL_HighLight);
|
||||
TxId_T_HighLight = rVR.getTextureIdFromName (getValStr("tx_t_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_T_HighLight, W_T_HighLight, H_T_HighLight);
|
||||
TxId_TR_HighLight = rVR.getTextureIdFromName (getValStr("tx_tr_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_TR_HighLight, W_TR_HighLight, H_TR_HighLight);
|
||||
TxId_L_HighLight = rVR.getTextureIdFromName (getValStr("tx_l_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_L_HighLight, W_L_HighLight, H_L_HighLight);
|
||||
TxId_R_HighLight = rVR.getTextureIdFromName (getValStr("tx_r_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_R_HighLight, W_R_HighLight, H_R_HighLight);
|
||||
TxId_BL_HighLight = rVR.getTextureIdFromName (getValStr("tx_bl_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_BL_HighLight, W_BL_HighLight, H_BL_HighLight);
|
||||
TxId_B_HighLight = rVR.getTextureIdFromName (getValStr("tx_b_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_B_HighLight, W_B_HighLight, H_B_HighLight);
|
||||
TxId_BR_HighLight = rVR.getTextureIdFromName (getValStr("tx_br_highlight"));
|
||||
rVR.getTextureSizeFromId(TxId_BR_HighLight, W_BR_HighLight, H_BR_HighLight);
|
||||
|
||||
//
|
||||
HeaderH = getValSInt32("header_h");
|
||||
InsetT = getValSInt32("inset_t");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -201,6 +201,7 @@ namespace NLGUI
|
|||
HTML_ATTR(TEXTAREA,DISABLED),
|
||||
HTML_ATTR(TEXTAREA,ID),
|
||||
HTML_ATTR(TEXTAREA,LANG),
|
||||
HTML_ATTR(TEXTAREA,MAXLENGTH),
|
||||
HTML_ATTR(TEXTAREA,NAME),
|
||||
HTML_ATTR(TEXTAREA,READONLY),
|
||||
HTML_ATTR(TEXTAREA,ROWS),
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace NLGUI
|
|||
CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
|
||||
_Color = CRGBA(255,255,255,255);
|
||||
_Shadow = false;
|
||||
_ShadowOutline = false;
|
||||
_ShadowColor = CRGBA(0,0,0,255);
|
||||
|
||||
_MultiLine = false;
|
||||
|
@ -111,7 +112,7 @@ namespace NLGUI
|
|||
///constructor
|
||||
// ***************************************************************************
|
||||
CViewText:: CViewText (const std::string& id, const std::string Text, sint FontSize,
|
||||
NLMISC::CRGBA Color, bool Shadow)
|
||||
NLMISC::CRGBA Color, bool Shadow, bool ShadowOutline)
|
||||
:CViewBase(TCtorParam())
|
||||
{
|
||||
_Id = id;
|
||||
|
@ -120,6 +121,7 @@ namespace NLGUI
|
|||
_FontSize = FontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
|
||||
_Color = Color;
|
||||
_Shadow = Shadow;
|
||||
_ShadowOutline = ShadowOutline;
|
||||
setText(Text);
|
||||
computeFontSize ();
|
||||
}
|
||||
|
@ -159,6 +161,7 @@ namespace NLGUI
|
|||
_FontSize = vt._FontSize;
|
||||
_Color = vt._Color;
|
||||
_Shadow = vt._Shadow;
|
||||
_ShadowOutline = vt._ShadowOutline;
|
||||
_ShadowColor = vt._ShadowColor;
|
||||
|
||||
_MultiLine = false;
|
||||
|
@ -225,6 +228,11 @@ namespace NLGUI
|
|||
return toString( _Shadow );
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
return toString( _ShadowOutline );
|
||||
}
|
||||
else
|
||||
if( name == "shadow_color" )
|
||||
{
|
||||
return toString( _ShadowColor );
|
||||
|
@ -360,6 +368,14 @@ namespace NLGUI
|
|||
return true;
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
bool b;
|
||||
if( fromString( value, b ) )
|
||||
_ShadowOutline = b;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if( name == "shadow_color" )
|
||||
{
|
||||
CRGBA c;
|
||||
|
@ -520,6 +536,7 @@ namespace NLGUI
|
|||
).c_str() );
|
||||
|
||||
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() );
|
||||
|
||||
|
@ -604,6 +621,11 @@ namespace NLGUI
|
|||
if (prop)
|
||||
_Shadow = convertBool(prop);
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"shadow_outline" );
|
||||
_ShadowOutline = false;
|
||||
if (prop)
|
||||
_ShadowOutline = convertBool(prop);
|
||||
|
||||
prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_color" );
|
||||
_ShadowColor = CRGBA(0,0,0,255);
|
||||
if (prop)
|
||||
|
@ -864,6 +886,7 @@ namespace NLGUI
|
|||
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setShadeColor (shcol);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
|
@ -978,6 +1001,7 @@ namespace NLGUI
|
|||
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setShadeColor (shcol);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
|
@ -1146,6 +1170,14 @@ namespace NLGUI
|
|||
invalidateContent();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CViewText::setShadowOutline (bool bShadowOutline)
|
||||
{
|
||||
_ShadowOutline = bShadowOutline;
|
||||
computeFontSize ();
|
||||
invalidateContent();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CViewText::setShadowColor(const NLMISC::CRGBA & color)
|
||||
{
|
||||
|
@ -1647,6 +1679,7 @@ namespace NLGUI
|
|||
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
// default state
|
||||
|
@ -1967,6 +2000,7 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||
height = getFontHeight();
|
||||
|
@ -2098,6 +2132,7 @@ namespace NLGUI
|
|||
// setup the text context
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
// find the line where the character is
|
||||
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||
|
@ -2372,6 +2407,7 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
TCharPos linePos = 0;
|
||||
|
@ -2456,6 +2492,7 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
// Current position in text
|
||||
|
@ -2507,12 +2544,13 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
// Letter size
|
||||
UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); // for now we can't now that directly from UTextContext
|
||||
_FontHeight = (uint) si.StringHeight + (_Shadow?1:0);
|
||||
_FontLegHeight = (uint) si.StringLine + (_Shadow?1:0);
|
||||
_FontHeight = (uint) si.StringHeight + (_Shadow?(_ShadowOutline?2:1):0);
|
||||
_FontLegHeight = (uint) si.StringLine + (_Shadow?(_ShadowOutline?2:1):0);
|
||||
|
||||
// Space width
|
||||
si = TextContext->getStringInfo(ucstring(" "));
|
||||
|
@ -2969,6 +3007,7 @@ namespace NLGUI
|
|||
f.serial(_SpaceWidth);
|
||||
f.serial(_Color);
|
||||
f.serial(_Shadow);
|
||||
f.serial(_ShadowOutline);
|
||||
f.serialEnum(_CaseMode);
|
||||
f.serial(_ShadowColor);
|
||||
f.serial(_LineMaxW);
|
||||
|
|
|
@ -1185,6 +1185,7 @@ namespace NLGUI
|
|||
vtDst->setColor (vtSrc->getColor());
|
||||
vtDst->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
|
||||
vtDst->setShadow(vtSrc->getShadow());
|
||||
vtDst->setShadowOutline(vtSrc->getShadowOutline());
|
||||
vtDst->setShadowColor(vtSrc->getShadowColor());
|
||||
vtDst->setCaseMode(vtSrc->getCaseMode());
|
||||
vtDst->setUnderlined(vtSrc->getUnderlined());
|
||||
|
|
|
@ -328,7 +328,7 @@ yynewstate:
|
|||
#endif
|
||||
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
int size = yyssp - yyss + 1;
|
||||
int size = (int)(yyssp - yyss + 1);
|
||||
|
||||
#ifdef yyoverflow
|
||||
/* Each stack pointer address is followed by the size of
|
||||
|
|
|
@ -1000,7 +1000,7 @@ int yyFlexLexer::yyinput()
|
|||
|
||||
else
|
||||
{ /* need more input */
|
||||
int offset = yy_c_buf_p - yytext_ptr;
|
||||
int offset = (int)(yy_c_buf_p - yytext_ptr);
|
||||
++yy_c_buf_p;
|
||||
|
||||
switch ( yy_get_next_buffer() )
|
||||
|
|
|
@ -2773,7 +2773,7 @@ static int input()
|
|||
|
||||
else
|
||||
{ /* need more input */
|
||||
int offset = yy_c_buf_p - yytext_ptr;
|
||||
int offset = (int)(yy_c_buf_p - yytext_ptr);
|
||||
++yy_c_buf_p;
|
||||
|
||||
switch ( yy_get_next_buffer() )
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/file.h"
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
|
|
|
@ -419,7 +419,7 @@ PrintfCommandsFreeTrial = {
|
|||
|
||||
DisplayMissingAnimFile = 0;
|
||||
|
||||
LoadingStringCount = 54;
|
||||
LoadingStringCount = 0;
|
||||
|
||||
|
||||
// Some R2 parameters ...
|
||||
|
|
|
@ -345,6 +345,7 @@ void displayStreamingDebug ()
|
|||
//----------------//
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(ClientCfg.DebugFontSize);
|
||||
// Set the text color
|
||||
|
@ -390,6 +391,7 @@ void displayStreamingDebug ()
|
|||
|
||||
// No more shadow when displaying a text.
|
||||
TextContext->setShaded(false);
|
||||
TextContext->setShadeOutline(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -567,6 +569,7 @@ void displayNetDebug ()
|
|||
//----------------//
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(ClientCfg.DebugFontSize);
|
||||
// Set the text color
|
||||
|
|
|
@ -134,6 +134,7 @@ void CGraph::renderGraph ()
|
|||
if (TextContext != NULL)
|
||||
{
|
||||
TextContext->setShaded (false);
|
||||
TextContext->setShadeOutline(false);
|
||||
TextContext->setHotSpot (UTextContext::MiddleLeft);
|
||||
TextContext->setColor (frontCol);
|
||||
TextContext->setFontSize (10);
|
||||
|
|
|
@ -807,6 +807,7 @@ void CTestGroundFX::displayFXBoxes() const
|
|||
Driver->setFrustum(fr);
|
||||
TextContext->setColor(CRGBA::Green);
|
||||
TextContext->setShaded(false);
|
||||
TextContext->setShadeOutline(false);
|
||||
TextContext->setFontSize(12);
|
||||
//
|
||||
float size = 0.4f;
|
||||
|
|
|
@ -157,6 +157,7 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
|
|||
CViewText *vt = new CViewText(CViewText::TCtorParam());
|
||||
// get parameters from config.xml
|
||||
vt->setShadow(isTextShadowed());
|
||||
vt->setShadowOutline(false);
|
||||
vt->setFontSize(getTextFontSize());
|
||||
vt->setMultiLine(true);
|
||||
vt->setTextMode(justified ? CViewText::Justified : CViewText::DontClipWord);
|
||||
|
|
|
@ -880,6 +880,7 @@ void CDBGroupListSheetText::setup()
|
|||
text->setFontSize(_TextTemplate.getFontSize());
|
||||
text->setColor(_TextTemplate.getColor());
|
||||
text->setShadow(_TextTemplate.getShadow());
|
||||
text->setShadowOutline(_TextTemplate.getShadowOutline());
|
||||
text->setLineMaxW(_TextTemplate.getLineMaxW());
|
||||
text->setMultiLine(_TextTemplate.getMultiLine());
|
||||
if(text->getMultiLine())
|
||||
|
|
|
@ -95,6 +95,7 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::init(CDBGroupListS
|
|||
text->setFontSize(compoList->getTextTemplate().getFontSize());
|
||||
text->setColor(compoList->getTextTemplate().getColor());
|
||||
text->setShadow(compoList->getTextTemplate().getShadow());
|
||||
text->setShadowOutline(compoList->getTextTemplate().getShadowOutline());
|
||||
text->setMultiLine(false);
|
||||
text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor());
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ void CDBGroupListSheetTextShare::CSheetChildShare::init(CDBGroupListSheetText *p
|
|||
text->setFontSize(compoList->getTextTemplate().getFontSize());
|
||||
text->setColor(compoList->getTextTemplate().getColor());
|
||||
text->setShadow(compoList->getTextTemplate().getShadow());
|
||||
text->setShadowOutline(compoList->getTextTemplate().getShadowOutline());
|
||||
text->setMultiLine(false);
|
||||
text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor());
|
||||
// Add it to the scrolled list.
|
||||
|
@ -139,6 +140,7 @@ void CDBGroupListSheetTextShare::CSheetChildShare::init(CDBGroupListSheetText *p
|
|||
text->setFontSize(compoList->getTextTemplate().getFontSize());
|
||||
text->setColor(compoList->getTextTemplate().getColor());
|
||||
text->setShadow(compoList->getTextTemplate().getShadow());
|
||||
text->setShadowOutline(compoList->getTextTemplate().getShadowOutline());
|
||||
text->setMultiLine(false);
|
||||
text->setModulateGlobalColor(compoList->getTextTemplate().getModulateGlobalColor());
|
||||
// Add it to the scrolled list.
|
||||
|
|
|
@ -2333,6 +2333,7 @@ void CGroupMap::createLMWidgets(const std::vector<CContLandMark> &lms)
|
|||
|
||||
pNewText->setColor(CRGBA(255,255,255,255));
|
||||
pNewText->setShadow(true);
|
||||
pNewText->setShadowOutline(false);
|
||||
pNewText->setShadowColor(CRGBA(0,0,0,255));
|
||||
pNewText->setModulateGlobalColor(false);
|
||||
pNewText->Type = rCLM.Type;
|
||||
|
|
|
@ -1924,6 +1924,7 @@ bool mainLoop()
|
|||
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(10);
|
||||
// Set the text color
|
||||
|
@ -2586,6 +2587,7 @@ void displaySpecialTextProgress(const char *text)
|
|||
{
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(12);
|
||||
// Set the text color
|
||||
|
|
|
@ -80,6 +80,7 @@ void displayDebug()
|
|||
//----------------//
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(ClientCfg.DebugFontSize);
|
||||
// Set the text color
|
||||
|
@ -470,6 +471,7 @@ void displayDebug()
|
|||
|
||||
// No more shadow when displaying a text.
|
||||
TextContext->setShaded(false);
|
||||
TextContext->setShadeOutline(false);
|
||||
}// displayDebug //
|
||||
|
||||
// ********************************************************************
|
||||
|
@ -491,6 +493,7 @@ void displayDebugFps()
|
|||
//----------------//
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(ClientCfg.DebugFontSize);
|
||||
// Set the text color
|
||||
|
@ -533,6 +536,7 @@ void displayDebugUIUnderMouse()
|
|||
//----------------//
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(ClientCfg.DebugFontSize);
|
||||
|
||||
|
@ -707,6 +711,7 @@ void displayHelp()
|
|||
|
||||
// Create a shadow when displaying a text.
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
// Set the font size.
|
||||
TextContext->setFontSize(ClientCfg.HelpFontSize);
|
||||
// Set the text color
|
||||
|
@ -763,6 +768,7 @@ void displayHelp()
|
|||
|
||||
// No more shadow when displaying a text.
|
||||
TextContext->setShaded(false);
|
||||
TextContext->setShadeOutline(false);
|
||||
}// displayHelp //
|
||||
|
||||
// ********************************************************************
|
||||
|
|
|
@ -1789,6 +1789,7 @@ void CEditor::waitScenarioScreen()
|
|||
if (!waitScreen)
|
||||
{
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
TextContext->setFontSize(40);
|
||||
TextContext->setColor(CRGBA::White);
|
||||
|
||||
|
|
|
@ -829,6 +829,7 @@ void CTimedFXManager::displayFXBoxes(TDebugDisplayMode displayMode) const
|
|||
Driver->setFrustum(fr);
|
||||
TextContext->setColor(CRGBA::Blue);
|
||||
TextContext->setShaded(false);
|
||||
TextContext->setShadeOutline(false);
|
||||
TextContext->setFontSize(10);
|
||||
//
|
||||
float size = 0.4f;
|
||||
|
|
|
@ -18,16 +18,15 @@
|
|||
|
||||
#include "crypt.h"
|
||||
|
||||
char * rz_crypt(register const char *key, register const char *setting);
|
||||
|
||||
char * rz_crypt(register const char *key, register const char *setting, char *buf);
|
||||
char *__crypt_sha512(const char *key, const char *setting, char *output);
|
||||
|
||||
|
||||
// Crypts password using salt
|
||||
std::string CCrypt::crypt(const std::string& password, const std::string& salt)
|
||||
{
|
||||
std::string result = ::rz_crypt(password.c_str(), salt.c_str());
|
||||
|
||||
return result;
|
||||
char buf[128];
|
||||
return ::rz_crypt(password.c_str(), salt.c_str(), buf);
|
||||
}
|
||||
|
||||
|
||||
|
@ -506,7 +505,7 @@ static char cryptresult[1+4+4+11+1]; /* encrypted result */
|
|||
* Return a pointer to static data consisting of the "setting"
|
||||
* followed by an encryption produced by the "key" and "setting".
|
||||
*/
|
||||
char * rz_crypt(register const char *key, register const char *setting) {
|
||||
char * rz_crypt(register const char *key, register const char *setting, char *buf) {
|
||||
register char *encp;
|
||||
register long i;
|
||||
register int t;
|
||||
|
@ -521,6 +520,10 @@ char * rz_crypt(register const char *key, register const char *setting) {
|
|||
return buff;
|
||||
#endif
|
||||
|
||||
if (setting[0] == '$' && setting[1] == '6') {
|
||||
return __crypt_sha512(key, setting, buf);
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((t = 2*(unsigned char)(*key)) != 0)
|
||||
key++;
|
||||
|
|
375
code/ryzom/common/src/game_share/crypt_sha512.cpp
Normal file
375
code/ryzom/common/src/game_share/crypt_sha512.cpp
Normal file
|
@ -0,0 +1,375 @@
|
|||
/*
|
||||
* public domain sha512 crypt implementation
|
||||
*
|
||||
* original sha crypt design: http://people.redhat.com/drepper/SHA-crypt.txt
|
||||
* in this implementation at least 32bit int is assumed,
|
||||
* key length is limited, the $6$ prefix is mandatory, '\n' and ':' is rejected
|
||||
* in the salt and rounds= setting must contain a valid iteration count,
|
||||
* on error "*" is returned.
|
||||
*/
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* public domain sha512 implementation based on fips180-3 */
|
||||
/* >=2^64 bits messages are not supported (about 2000 peta bytes) */
|
||||
|
||||
struct sha512 {
|
||||
uint64 len; /* processed message length */
|
||||
uint64 h[8]; /* hash state */
|
||||
uint8 buf[128]; /* message block buffer */
|
||||
};
|
||||
|
||||
static uint64 ror(uint64 n, int k) { return (n >> k) | (n << (64-k)); }
|
||||
#define Ch(x,y,z) (z ^ (x & (y ^ z)))
|
||||
#define Maj(x,y,z) ((x & y) | (z & (x | y)))
|
||||
#define S0(x) (ror(x,28) ^ ror(x,34) ^ ror(x,39))
|
||||
#define S1(x) (ror(x,14) ^ ror(x,18) ^ ror(x,41))
|
||||
#define R0(x) (ror(x,1) ^ ror(x,8) ^ (x>>7))
|
||||
#define R1(x) (ror(x,19) ^ ror(x,61) ^ (x>>6))
|
||||
|
||||
static const uint64 K[80] = {
|
||||
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
|
||||
0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
|
||||
0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
|
||||
0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
|
||||
0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL,
|
||||
0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
|
||||
0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL,
|
||||
0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
|
||||
0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
|
||||
0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
|
||||
0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL,
|
||||
0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
|
||||
0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL,
|
||||
0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
|
||||
0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
|
||||
0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
|
||||
0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL,
|
||||
0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
|
||||
0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL,
|
||||
0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
|
||||
};
|
||||
|
||||
static void processblock(struct sha512 *s, const uint8 *buf)
|
||||
{
|
||||
uint64 W[80], t1, t2, a, b, c, d, e, f, g, h;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
W[i] = (uint64)buf[8*i]<<56;
|
||||
W[i] |= (uint64)buf[8*i+1]<<48;
|
||||
W[i] |= (uint64)buf[8*i+2]<<40;
|
||||
W[i] |= (uint64)buf[8*i+3]<<32;
|
||||
W[i] |= (uint64)buf[8*i+4]<<24;
|
||||
W[i] |= (uint64)buf[8*i+5]<<16;
|
||||
W[i] |= (uint64)buf[8*i+6]<<8;
|
||||
W[i] |= buf[8*i+7];
|
||||
}
|
||||
for (; i < 80; i++)
|
||||
W[i] = R1(W[i-2]) + W[i-7] + R0(W[i-15]) + W[i-16];
|
||||
a = s->h[0];
|
||||
b = s->h[1];
|
||||
c = s->h[2];
|
||||
d = s->h[3];
|
||||
e = s->h[4];
|
||||
f = s->h[5];
|
||||
g = s->h[6];
|
||||
h = s->h[7];
|
||||
for (i = 0; i < 80; i++) {
|
||||
t1 = h + S1(e) + Ch(e,f,g) + K[i] + W[i];
|
||||
t2 = S0(a) + Maj(a,b,c);
|
||||
h = g;
|
||||
g = f;
|
||||
f = e;
|
||||
e = d + t1;
|
||||
d = c;
|
||||
c = b;
|
||||
b = a;
|
||||
a = t1 + t2;
|
||||
}
|
||||
s->h[0] += a;
|
||||
s->h[1] += b;
|
||||
s->h[2] += c;
|
||||
s->h[3] += d;
|
||||
s->h[4] += e;
|
||||
s->h[5] += f;
|
||||
s->h[6] += g;
|
||||
s->h[7] += h;
|
||||
}
|
||||
|
||||
static void pad(struct sha512 *s)
|
||||
{
|
||||
unsigned r = s->len % 128;
|
||||
|
||||
s->buf[r++] = 0x80;
|
||||
if (r > 112) {
|
||||
memset(s->buf + r, 0, 128 - r);
|
||||
r = 0;
|
||||
processblock(s, s->buf);
|
||||
}
|
||||
memset(s->buf + r, 0, 120 - r);
|
||||
s->len *= 8;
|
||||
s->buf[120] = s->len >> 56;
|
||||
s->buf[121] = s->len >> 48;
|
||||
s->buf[122] = s->len >> 40;
|
||||
s->buf[123] = s->len >> 32;
|
||||
s->buf[124] = s->len >> 24;
|
||||
s->buf[125] = s->len >> 16;
|
||||
s->buf[126] = s->len >> 8;
|
||||
s->buf[127] = s->len;
|
||||
processblock(s, s->buf);
|
||||
}
|
||||
|
||||
static void sha512_init(struct sha512 *s)
|
||||
{
|
||||
s->len = 0;
|
||||
s->h[0] = 0x6a09e667f3bcc908ULL;
|
||||
s->h[1] = 0xbb67ae8584caa73bULL;
|
||||
s->h[2] = 0x3c6ef372fe94f82bULL;
|
||||
s->h[3] = 0xa54ff53a5f1d36f1ULL;
|
||||
s->h[4] = 0x510e527fade682d1ULL;
|
||||
s->h[5] = 0x9b05688c2b3e6c1fULL;
|
||||
s->h[6] = 0x1f83d9abfb41bd6bULL;
|
||||
s->h[7] = 0x5be0cd19137e2179ULL;
|
||||
}
|
||||
|
||||
static void sha512_sum(struct sha512 *s, uint8 *md)
|
||||
{
|
||||
int i;
|
||||
|
||||
pad(s);
|
||||
for (i = 0; i < 8; i++) {
|
||||
md[8*i] = s->h[i] >> 56;
|
||||
md[8*i+1] = s->h[i] >> 48;
|
||||
md[8*i+2] = s->h[i] >> 40;
|
||||
md[8*i+3] = s->h[i] >> 32;
|
||||
md[8*i+4] = s->h[i] >> 24;
|
||||
md[8*i+5] = s->h[i] >> 16;
|
||||
md[8*i+6] = s->h[i] >> 8;
|
||||
md[8*i+7] = s->h[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void sha512_update(struct sha512 *s, const void *m, unsigned long len)
|
||||
{
|
||||
const uint8 *p = (uint8 *)m;
|
||||
unsigned r = s->len % 128;
|
||||
|
||||
s->len += len;
|
||||
if (r) {
|
||||
if (len < 128 - r) {
|
||||
memcpy(s->buf + r, p, len);
|
||||
return;
|
||||
}
|
||||
memcpy(s->buf + r, p, 128 - r);
|
||||
len -= 128 - r;
|
||||
p += 128 - r;
|
||||
processblock(s, s->buf);
|
||||
}
|
||||
for (; len >= 128; len -= 128, p += 128)
|
||||
processblock(s, p);
|
||||
memcpy(s->buf, p, len);
|
||||
}
|
||||
|
||||
static const unsigned char b64[] =
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
static char *to64(char *s, unsigned int u, int n)
|
||||
{
|
||||
while (--n >= 0) {
|
||||
*s++ = b64[u % 64];
|
||||
u /= 64;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/* key limit is not part of the original design, added for DoS protection.
|
||||
* rounds limit has been lowered (versus the reference/spec), also for DoS
|
||||
* protection. runtime is O(klen^2 + klen*rounds) */
|
||||
#define KEY_MAX 256
|
||||
#define SALT_MAX 16
|
||||
#define ROUNDS_DEFAULT 5000
|
||||
#define ROUNDS_MIN 1000
|
||||
#define ROUNDS_MAX 9999999
|
||||
|
||||
/* hash n bytes of the repeated md message digest */
|
||||
static void hashmd(struct sha512 *s, unsigned int n, const void *md)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = n; i > 64; i -= 64)
|
||||
sha512_update(s, md, 64);
|
||||
sha512_update(s, md, i);
|
||||
}
|
||||
|
||||
static char *sha512crypt(const char *key, const char *setting, char *output)
|
||||
{
|
||||
struct sha512 ctx;
|
||||
unsigned char md[64], kmd[64], smd[64];
|
||||
unsigned int i, r, klen, slen;
|
||||
char rounds[20] = "";
|
||||
const char *salt;
|
||||
char *p;
|
||||
|
||||
/* reject large keys */
|
||||
for (i = 0; i <= KEY_MAX && key[i]; i++);
|
||||
if (i > KEY_MAX)
|
||||
return 0;
|
||||
klen = i;
|
||||
|
||||
/* setting: $6$rounds=n$salt$ (rounds=n$ and closing $ are optional) */
|
||||
if (strncmp(setting, "$6$", 3) != 0)
|
||||
return 0;
|
||||
salt = setting + 3;
|
||||
|
||||
r = ROUNDS_DEFAULT;
|
||||
if (strncmp(salt, "rounds=", sizeof "rounds=" - 1) == 0) {
|
||||
unsigned long u;
|
||||
char *end;
|
||||
|
||||
/*
|
||||
* this is a deviation from the reference:
|
||||
* bad rounds setting is rejected if it is
|
||||
* - empty
|
||||
* - unterminated (missing '$')
|
||||
* - begins with anything but a decimal digit
|
||||
* the reference implementation treats these bad
|
||||
* rounds as part of the salt or parse them with
|
||||
* strtoul semantics which may cause problems
|
||||
* including non-portable hashes that depend on
|
||||
* the host's value of ULONG_MAX.
|
||||
*/
|
||||
salt += sizeof "rounds=" - 1;
|
||||
if (!isdigit(*salt))
|
||||
return 0;
|
||||
u = strtoul(salt, &end, 10);
|
||||
if (*end != '$')
|
||||
return 0;
|
||||
salt = end+1;
|
||||
if (u < ROUNDS_MIN)
|
||||
r = ROUNDS_MIN;
|
||||
else if (u > ROUNDS_MAX)
|
||||
r = ROUNDS_MAX;
|
||||
else
|
||||
r = u;
|
||||
/* needed when rounds is zero prefixed or out of bounds */
|
||||
sprintf(rounds, "rounds=%u$", r);
|
||||
}
|
||||
|
||||
for (i = 0; i < SALT_MAX && salt[i] && salt[i] != '$'; i++)
|
||||
/* reject characters that interfere with /etc/shadow parsing */
|
||||
if (salt[i] == '\n' || salt[i] == ':')
|
||||
return 0;
|
||||
slen = i;
|
||||
|
||||
/* B = sha(key salt key) */
|
||||
sha512_init(&ctx);
|
||||
sha512_update(&ctx, key, klen);
|
||||
sha512_update(&ctx, salt, slen);
|
||||
sha512_update(&ctx, key, klen);
|
||||
sha512_sum(&ctx, md);
|
||||
|
||||
/* A = sha(key salt repeat-B alternate-B-key) */
|
||||
sha512_init(&ctx);
|
||||
sha512_update(&ctx, key, klen);
|
||||
sha512_update(&ctx, salt, slen);
|
||||
hashmd(&ctx, klen, md);
|
||||
for (i = klen; i > 0; i >>= 1)
|
||||
if (i & 1)
|
||||
sha512_update(&ctx, md, sizeof md);
|
||||
else
|
||||
sha512_update(&ctx, key, klen);
|
||||
sha512_sum(&ctx, md);
|
||||
|
||||
/* DP = sha(repeat-key), this step takes O(klen^2) time */
|
||||
sha512_init(&ctx);
|
||||
for (i = 0; i < klen; i++)
|
||||
sha512_update(&ctx, key, klen);
|
||||
sha512_sum(&ctx, kmd);
|
||||
|
||||
/* DS = sha(repeat-salt) */
|
||||
sha512_init(&ctx);
|
||||
for (i = 0; i < 16 + md[0]; i++)
|
||||
sha512_update(&ctx, salt, slen);
|
||||
sha512_sum(&ctx, smd);
|
||||
|
||||
/* iterate A = f(A,DP,DS), this step takes O(rounds*klen) time */
|
||||
for (i = 0; i < r; i++) {
|
||||
sha512_init(&ctx);
|
||||
if (i % 2)
|
||||
hashmd(&ctx, klen, kmd);
|
||||
else
|
||||
sha512_update(&ctx, md, sizeof md);
|
||||
if (i % 3)
|
||||
sha512_update(&ctx, smd, slen);
|
||||
if (i % 7)
|
||||
hashmd(&ctx, klen, kmd);
|
||||
if (i % 2)
|
||||
sha512_update(&ctx, md, sizeof md);
|
||||
else
|
||||
hashmd(&ctx, klen, kmd);
|
||||
sha512_sum(&ctx, md);
|
||||
}
|
||||
|
||||
/* output is $6$rounds=n$salt$hash */
|
||||
p = output;
|
||||
p += sprintf(p, "$6$%s%.*s$", rounds, slen, salt);
|
||||
#if 1
|
||||
static const unsigned char perm[][3] = {
|
||||
0,21,42,22,43,1,44,2,23,3,24,45,25,46,4,
|
||||
47,5,26,6,27,48,28,49,7,50,8,29,9,30,51,
|
||||
31,52,10,53,11,32,12,33,54,34,55,13,56,14,35,
|
||||
15,36,57,37,58,16,59,17,38,18,39,60,40,61,19,
|
||||
62,20,41 };
|
||||
for (i=0; i<21; i++) p = to64(p,
|
||||
(md[perm[i][0]]<<16)|(md[perm[i][1]]<<8)|md[perm[i][2]], 4);
|
||||
#else
|
||||
p = to64(p, (md[0]<<16)|(md[21]<<8)|md[42], 4);
|
||||
p = to64(p, (md[22]<<16)|(md[43]<<8)|md[1], 4);
|
||||
p = to64(p, (md[44]<<16)|(md[2]<<8)|md[23], 4);
|
||||
p = to64(p, (md[3]<<16)|(md[24]<<8)|md[45], 4);
|
||||
p = to64(p, (md[25]<<16)|(md[46]<<8)|md[4], 4);
|
||||
p = to64(p, (md[47]<<16)|(md[5]<<8)|md[26], 4);
|
||||
p = to64(p, (md[6]<<16)|(md[27]<<8)|md[48], 4);
|
||||
p = to64(p, (md[28]<<16)|(md[49]<<8)|md[7], 4);
|
||||
p = to64(p, (md[50]<<16)|(md[8]<<8)|md[29], 4);
|
||||
p = to64(p, (md[9]<<16)|(md[30]<<8)|md[51], 4);
|
||||
p = to64(p, (md[31]<<16)|(md[52]<<8)|md[10], 4);
|
||||
p = to64(p, (md[53]<<16)|(md[11]<<8)|md[32], 4);
|
||||
p = to64(p, (md[12]<<16)|(md[33]<<8)|md[54], 4);
|
||||
p = to64(p, (md[34]<<16)|(md[55]<<8)|md[13], 4);
|
||||
p = to64(p, (md[56]<<16)|(md[14]<<8)|md[35], 4);
|
||||
p = to64(p, (md[15]<<16)|(md[36]<<8)|md[57], 4);
|
||||
p = to64(p, (md[37]<<16)|(md[58]<<8)|md[16], 4);
|
||||
p = to64(p, (md[59]<<16)|(md[17]<<8)|md[38], 4);
|
||||
p = to64(p, (md[18]<<16)|(md[39]<<8)|md[60], 4);
|
||||
p = to64(p, (md[40]<<16)|(md[61]<<8)|md[19], 4);
|
||||
p = to64(p, (md[62]<<16)|(md[20]<<8)|md[41], 4);
|
||||
#endif
|
||||
p = to64(p, md[63], 2);
|
||||
*p = 0;
|
||||
return output;
|
||||
}
|
||||
|
||||
char *__crypt_sha512(const char *key, const char *setting, char *output)
|
||||
{
|
||||
static const char testkey[] = "Xy01@#\x01\x02\x80\x7f\xff\r\n\x81\t !";
|
||||
static const char testsetting[] = "$6$rounds=1234$abc0123456789$";
|
||||
static const char testhash[] = "$6$rounds=1234$abc0123456789$BCpt8zLrc/RcyuXmCDOE1ALqMXB2MH6n1g891HhFj8.w7LxGv.FTkqq6Vxc/km3Y0jE0j24jY5PIv/oOu6reg1";
|
||||
char testbuf[128];
|
||||
char *p, *q;
|
||||
|
||||
p = sha512crypt(key, setting, output);
|
||||
|
||||
/* self test and stack cleanup */
|
||||
q = sha512crypt(testkey, testsetting, testbuf);
|
||||
if (!p || q != testbuf || memcmp(testbuf, testhash, sizeof(testhash)))
|
||||
return "*";
|
||||
|
||||
return p;
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef RYZOM_VERSION_H
|
||||
#define RYZOM_VERSION_H
|
||||
|
||||
#define RYZOM_VERSION "RYZOM CORE"
|
||||
#define RYZOM_VERSION "ryzomcore/v0.10.0-dev"
|
||||
|
||||
#endif // RYZOM_VERSION_H
|
||||
|
||||
|
|
|
@ -392,7 +392,15 @@ void clientAuthentication(CMessage &msgin, TSockId from, CCallbackNetBase &netba
|
|||
{
|
||||
if (strlen(row[0]) > 2)
|
||||
{
|
||||
std::string salt = std::string(row[0], row[0] + 2);
|
||||
std::string salt;
|
||||
if (row[0][0] == '$')
|
||||
{
|
||||
salt = std::string(row[0], row[0] + 19);
|
||||
}
|
||||
else
|
||||
{
|
||||
salt = std::string(row[0], row[0] + 2);
|
||||
}
|
||||
std::string cryptedVersion = CCrypt::crypt(password, salt);
|
||||
if (cryptedVersion == row[0])
|
||||
{
|
||||
|
|
|
@ -309,6 +309,7 @@ void CDisplay::init (CMainFrame *pMF)
|
|||
_TextContext->setFontGenerator(NLMISC::CPath::getWindowsDirectory() + "Fonts\\arial.ttf");
|
||||
_TextContext->setKeep800x600Ratio(true);
|
||||
_TextContext->setShaded(true);
|
||||
_TextContext->setShadeOutline(false);
|
||||
_TextContext->setShadeColor(NLMISC::CRGBA::Black);
|
||||
}
|
||||
catch(...)
|
||||
|
|
|
@ -327,6 +327,7 @@ void initCore()
|
|||
ConfigFile->getVar("ScreenFull").asInt()==0));
|
||||
TextContext = Driver->createTextContext(CPath::lookup(ConfigFile->getVar("FontName").asString()));
|
||||
TextContext->setShaded(true);
|
||||
TextContext->setShadeOutline(false);
|
||||
TextContext->setKeep800x600Ratio(false);
|
||||
// You can't call displayLoadingState() before init the loading state system
|
||||
displayLoadingState("Initialize Loading");
|
||||
|
|
|
@ -252,7 +252,7 @@ class Users{
|
|||
* @param $length the length of the SALT which is by default 2
|
||||
* @return a random salt of 2 chars
|
||||
*/
|
||||
public static function generateSALT( $length = 2 )
|
||||
public static function generateSALT( $length = 16 )
|
||||
{
|
||||
// start with a blank salt
|
||||
$salt = "";
|
||||
|
@ -282,6 +282,10 @@ class Users{
|
|||
}
|
||||
}
|
||||
// done!
|
||||
if ($length > 2)
|
||||
{
|
||||
$salt = '$6$'.$salt;
|
||||
}
|
||||
return $salt;
|
||||
}
|
||||
|
||||
|
|
1
code/web/private_php/setup/sql/nel_00004.sql
Normal file
1
code/web/private_php/setup/sql/nel_00004.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `user` MODIFY `Password` VARCHAR(106);
|
1
code/web/private_php/setup/sql/nel_ams_00002.sql
Normal file
1
code/web/private_php/setup/sql/nel_ams_00002.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `ams_user` MODIFY `Password` VARCHAR(106);
|
|
@ -80,7 +80,14 @@ class WebUsers extends Users{
|
|||
$dbw = new DBLayer("web");
|
||||
$statement = $dbw->select("ams_user", array('value' => $value),"Login=:value OR Email=:value");
|
||||
$row = $statement->fetch();
|
||||
if ($row['Password'][0] == '$')
|
||||
{
|
||||
$salt = substr($row['Password'], 0, 19);
|
||||
}
|
||||
else
|
||||
{
|
||||
$salt = substr($row['Password'], 0, 2);
|
||||
}
|
||||
$hashed_input_pass = crypt($password, $salt);
|
||||
if($hashed_input_pass == $row['Password']){
|
||||
return $row;
|
||||
|
|
|
@ -14,6 +14,19 @@
|
|||
include_once('../ring/join_shard.php');
|
||||
|
||||
|
||||
function get_salt($password)
|
||||
{
|
||||
if ($password[0] == '$')
|
||||
{
|
||||
$salt = substr($password, 0, 19);
|
||||
}
|
||||
else
|
||||
{
|
||||
$salt = substr($password, 0, 2);
|
||||
}
|
||||
return $salt;
|
||||
}
|
||||
|
||||
// see errorMsg
|
||||
function errorMsgBlock($errNum=GENERIC_ERROR_NUM) // $mixedArgs
|
||||
{
|
||||
|
@ -331,7 +344,7 @@
|
|||
else
|
||||
{
|
||||
$row = mysqli_fetch_assoc ($result);
|
||||
$salt = substr($row["Password"],0,2);
|
||||
$salt = get_salt($row["Password"]);
|
||||
if (($cp && $row["Password"] == $password) || (!$cp && $row["Password"] == crypt($password, $salt)))
|
||||
{
|
||||
// Store the real login (with correct case)
|
||||
|
@ -488,7 +501,7 @@
|
|||
else
|
||||
{
|
||||
$res_array = mysqli_fetch_assoc($result);
|
||||
$salt = substr($res_array['Password'], 0, 2);
|
||||
$salt = get_salt($res_array['Password']);
|
||||
}
|
||||
|
||||
echo "1:".$salt;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
// Service
|
||||
$db_nel = 3;
|
||||
$db_nel = 4;
|
||||
$db_nel_tool = 2;
|
||||
|
||||
// Support
|
||||
$db_nel_ams = 1;
|
||||
$db_nel_ams = 2;
|
||||
$db_nel_ams_lib = 6;
|
||||
|
||||
// Domain
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
// Increment whenever a web upgrade is required.
|
||||
$NEL_SETUP_VERSION = 6;
|
||||
$NEL_SETUP_VERSION = 8;
|
||||
|
||||
/* end of file */
|
||||
|
|
Loading…
Reference in a new issue