Revert "Project modernization (#630)"

This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.

This reverts commit a9be52c41a.
This commit is contained in:
Loki Rautio
2026-03-07 21:12:22 -06:00
parent a9be52c41a
commit 087b7e7abf
1373 changed files with 19449 additions and 19903 deletions

View File

@@ -53,8 +53,8 @@ XUI_Font::~XUI_Font()
VOID XUI_Font::GetTextExtent( const WCHAR* strText, FLOAT* pWidth,
FLOAT* pHeight, BOOL bFirstLineOnly ) const
{
assert( pWidth != nullptr );
assert( pHeight != nullptr );
assert( pWidth != NULL );
assert( pHeight != NULL );
// Set default text extent in output parameters
int iWidth = 0;
@@ -146,8 +146,8 @@ VOID XUI_Font::Begin()
//m_pFontTexture->GetLevelDesc( 0, &TextureDesc ); // Get the description
// Set render state
assert(m_fontData->m_pFontTexture != nullptr || m_fontData->m_iFontTexture > 0);
if(m_fontData->m_pFontTexture != nullptr)
assert(m_fontData->m_pFontTexture != NULL || m_fontData->m_iFontTexture > 0);
if(m_fontData->m_pFontTexture != NULL)
{
pD3dDevice->SetTexture( 0, m_fontData->m_pFontTexture );
}
@@ -236,7 +236,7 @@ VOID XUI_Font::DrawShadowText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor, DW
VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor,
const WCHAR* strText, DWORD dwFlags, FLOAT fMaxPixelWidth, bool darken /*= false*/ )
{
if( nullptr == strText ) return;
if( NULL == strText ) return;
if( L'\0' == strText[0] ) return;
// 4J-PB - if we're in 480 widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple
@@ -244,21 +244,21 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor,
{
if(RenderManager.IsWidescreen())
{
int iScaleX=static_cast<int>(m_fXScaleFactor);
int iScaleX=(int)m_fXScaleFactor;
int iOriginX;
if(iScaleX%2==0)
{
iOriginX=static_cast<int>(fOriginX);
iOriginX=(int)fOriginX;
if(iOriginX%2==1)
{
fOriginX+=1.0f;
}
}
int iScaleY=static_cast<int>(m_fYScaleFactor);
int iScaleY=(int)m_fYScaleFactor;
int iOriginY;
if(iScaleY%2==0)
{
iOriginY=static_cast<int>(fOriginY);
iOriginY=(int)fOriginY;
if(iOriginY%2==1)
{
fOriginY+=1.0f;
@@ -268,7 +268,7 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor,
else
{
// 480 SD mode - y needs to be on a pixel boundary when multiplied by 1.5, so if it's an odd number, subtract 1/3 from it
int iOriginY=static_cast<int>(fOriginY);
int iOriginY=(int)fOriginY;
if(iOriginY%2==1)
{
fOriginY-=1.0f/3.0f;
@@ -415,8 +415,8 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor,
// Translate unprintable characters
XUI_FontData::SChar sChar = m_fontData->getChar( letter );
FLOAT fOffset = m_fXScaleFactor * static_cast<FLOAT>(sChar.getOffset());
FLOAT fAdvance = m_fXScaleFactor * static_cast<FLOAT>(sChar.getWAdvance());
FLOAT fOffset = m_fXScaleFactor * ( FLOAT )sChar.getOffset();
FLOAT fAdvance = m_fXScaleFactor * ( FLOAT )sChar.getWAdvance();
// 4J Use the font max width otherwise scaling doesnt look right
FLOAT fWidth = m_fXScaleFactor * (sChar.tu2() - sChar.tu1());//( FLOAT )pGlyph->wWidth;
FLOAT fHeight = m_fYScaleFactor * m_fontData->getFontHeight();
@@ -450,10 +450,10 @@ VOID XUI_Font::DrawText( FLOAT fOriginX, FLOAT fOriginY, DWORD dwColor,
// Add the vertices to draw this glyph
FLOAT tu1 = sChar.tu1() / static_cast<float>(m_fontData->getImageWidth());
FLOAT tv1 = sChar.tv1() / static_cast<float>(m_fontData->getImageHeight());
FLOAT tu2 = sChar.tu2() / static_cast<float>(m_fontData->getImageWidth());
FLOAT tv2 = sChar.tv2() / static_cast<float>(m_fontData->getImageHeight());
FLOAT tu1 = sChar.tu1() / (float)m_fontData->getImageWidth();
FLOAT tv1 = sChar.tv1() / (float)m_fontData->getImageHeight();
FLOAT tu2 = sChar.tu2() / (float)m_fontData->getImageWidth();
FLOAT tv2 = sChar.tv2() / (float)m_fontData->getImageHeight();
Tesselator *t = Tesselator::getInstance();
t->begin();

View File

@@ -68,7 +68,7 @@ float XUI_FontData::SChar::getMinX()
float XUI_FontData::SChar::getMaxX()
{
return static_cast<float>(m_parent->m_fontData->getFontData()->m_uiGlyphWidth);
return (float) m_parent->m_fontData->getFontData()->m_uiGlyphWidth;
}
float XUI_FontData::SChar::getMinY()
@@ -83,7 +83,7 @@ float XUI_FontData::SChar::getMaxY()
float XUI_FontData::SChar::getAdvance()
{
return static_cast<float>(m_parent->m_fontData->getWidth(m_glyphId));
return (float) m_parent->m_fontData->getWidth(m_glyphId);
}
int XUI_FontData::SChar::getGlyphId()
@@ -157,11 +157,11 @@ XUI_FontData::SChar XUI_FontData::getChar(const wchar_t strChar)
//--------------------------------------------------------------------------------------
XUI_FontData::XUI_FontData()
{
m_pFontTexture = nullptr;
m_pFontTexture = NULL;
m_iFontTexture = -1;
m_dwNumGlyphs = 0L;
m_Glyphs = nullptr;
m_Glyphs = NULL;
m_cMaxGlyph = 0;
@@ -201,12 +201,12 @@ HRESULT XUI_FontData::Create( SFontData &sfontdata )
m_fontData = new CFontData( sfontdata, rawPixels.data );
if (rawPixels.data != nullptr) delete [] rawPixels.data;
if (rawPixels.data != NULL) delete [] rawPixels.data;
#if 0
{ // 4J-JEV: Load in FontData (ABC) file, and initialize member variables from it.
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
//wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/font/Mojangles_10.abc");
wsprintfW(szResourceLocator,L"section://%X,%s#%s%s%s",c_ModuleHandle,L"media", L"media/font/",strFontFileName.c_str(),L".abc");
@@ -349,7 +349,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData )
//--------------------------------------------------------------------------------------
VOID XUI_FontData::Destroy()
{
if(m_pFontTexture!=nullptr)
if(m_pFontTexture!=NULL)
{
m_pFontTexture->Release();
delete m_pFontTexture;
@@ -357,7 +357,7 @@ VOID XUI_FontData::Destroy()
m_fontData->release();
m_pFontTexture = nullptr;
m_pFontTexture = NULL;
m_dwNumGlyphs = 0L;
m_cMaxGlyph = 0;

View File

@@ -36,7 +36,7 @@ VOID XUI_FontRenderer::Term()
HRESULT XUI_FontRenderer::GetCaps( DWORD * pdwCaps )
{
if( pdwCaps != nullptr )
if( pdwCaps != NULL )
{
// setting this means XUI calls the DrawCharsToDevice method
*pdwCaps = XUI_FONT_RENDERER_CAP_INTERNAL_GLYPH_CACHE | XUI_FONT_RENDERER_CAP_POINT_SIZE_RESPECTED | XUI_FONT_RENDERER_STYLE_DROPSHADOW;
@@ -50,7 +50,7 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
//float fXuiSize = fPointSize * ( 16.0f / 16.0f );
fXuiSize /= 4.0f;
fXuiSize = floor( fXuiSize );
int xuiSize = static_cast<int>(fXuiSize * 4.0f);
int xuiSize = (int)(fXuiSize * 4.0f);
if( xuiSize < 1 ) xuiSize = 8;
// 4J Stu - We have fonts based on multiples of 8 or 12
@@ -60,8 +60,8 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
//app.DebugPrintf("point size is: %f, xuiSize is: %d\n", fPointSize, xuiSize);
XUI_Font *font = nullptr;
XUI_FontData *fontData = nullptr;
XUI_Font *font = NULL;
XUI_FontData *fontData = NULL;
FLOAT scale = 1;
eFontData efontdata;
@@ -77,17 +77,17 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
}
font = m_loadedFonts[efontdata][scale];
if (font == nullptr)
if (font == NULL)
{
fontData = m_loadedFontData[efontdata];
if (fontData == nullptr)
if (fontData == NULL)
{
SFontData *sfontdata;
switch (efontdata)
{
case eFontData_Mojangles_7: sfontdata = &SFontData::Mojangles_7; break;
case eFontData_Mojangles_11: sfontdata = &SFontData::Mojangles_11; break;
default: sfontdata = nullptr; break;
default: sfontdata = NULL; break;
}
fontData = new XUI_FontData();
@@ -101,14 +101,14 @@ HRESULT XUI_FontRenderer::CreateFont( const TypefaceDescriptor * pTypefaceDescri
}
font->IncRefCount();
*phFont = static_cast<HFONTOBJ>(font);
*phFont = (HFONTOBJ)font;
return S_OK;
}
VOID XUI_FontRenderer::ReleaseFont( HFONTOBJ hFont )
{
XUI_Font *xuiFont = static_cast<XUI_Font *>(hFont);
if (xuiFont != nullptr)
XUI_Font *xuiFont = (XUI_Font*) hFont;
if (xuiFont != NULL)
{
xuiFont->DecRefCount();
if (xuiFont->refCount <= 0)
@@ -125,7 +125,7 @@ HRESULT XUI_FontRenderer::GetFontMetrics( HFONTOBJ hFont, XUIFontMetrics *pFontM
{
if( hFont == 0 || pFontMetrics == 0 ) return E_INVALIDARG;
XUI_Font *font = static_cast<XUI_Font *>(hFont);
XUI_Font *font = (XUI_Font *)hFont;
pFontMetrics->fLineHeight = (font->m_fontData->getFontYAdvance() + 1) * font->m_fYScaleFactor;
pFontMetrics->fMaxAscent = font->m_fontData->getMaxAscent() * font->m_fYScaleFactor;
@@ -142,7 +142,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr
{
if (hFont == 0 || pCharMetrics == 0) return E_INVALIDARG;
XUI_Font *font = static_cast<XUI_Font *>(hFont);
XUI_Font *font = (XUI_Font *)hFont;
XUI_FontData::SChar sChar = font->m_fontData->getChar(wch);
pCharMetrics->fMinX = sChar.getMinX() * font->m_fYScaleFactor;
@@ -156,7 +156,7 @@ HRESULT XUI_FontRenderer::GetCharMetrics( HFONTOBJ hFont, WCHAR wch, XUICharMetr
HRESULT XUI_FontRenderer::DrawCharToTexture( HFONTOBJ hFont, WCHAR wch, HXUIDC hDC, IXuiTexture * pTexture, UINT x, UINT y, UINT width, UINT height, UINT insetX, UINT insetY )
{
if( hFont==0 || pTexture==nullptr ) return E_INVALIDARG;
if( hFont==0 || pTexture==NULL ) return E_INVALIDARG;
return( S_OK );
}
@@ -169,7 +169,7 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat
DWORD SamplerStateA[5];
XMVECTOR vconsts[20];
XMVECTOR pconsts[20];
XUI_Font *font = static_cast<XUI_Font *>(hFont);
XUI_Font *font = (XUI_Font *)hFont;
// 4J-PB - if we're in 480 Widescreen mode, we need to ensure that the font characters are aligned on an even boundary if they are a 2x multiple
if(!RenderManager.IsHiDef())
@@ -184,19 +184,19 @@ HRESULT XUI_FontRenderer::DrawCharsToDevice( HFONTOBJ hFont, CharData * pCharDat
if(iScaleX%2==0)
{
int iWorldX=pWorldViewProj->_41;
pWorldViewProj->_41 = static_cast<float>(iWorldX & -2);
pWorldViewProj->_41 = (float)(iWorldX & -2);
}
if(iScaleY%2==0)
{
int iWorldY=pWorldViewProj->_42;
pWorldViewProj->_42 = static_cast<float>(iWorldY & -2);
pWorldViewProj->_42 = (float)(iWorldY & -2);
}
}
else
{
// make x an even number for 480 4:3
int iWorldX=pWorldViewProj->_41;
pWorldViewProj->_41 = static_cast<float>(iWorldX & -2);
pWorldViewProj->_41 = (float)(iWorldX & -2);
// 480 SD mode - y needs to be on a pixel boundary when multiplied by 1.5, so if it's an odd number, subtract 1/3 from it
int iWorldY=pWorldViewProj->_42;