Inconvenience for windows

This commit is contained in:
Learath 2019-04-26 22:36:49 +03:00
parent 1b668916f2
commit 93d14a1eca
37 changed files with 218 additions and 218 deletions

View file

@ -14,8 +14,8 @@
*/
inline float RgbToHue(vec3 rgb)
{
float h_min = min(rgb.r, rgb.g, rgb.b);
float h_max = max(rgb.r, rgb.g, rgb.b);
float h_min = minimum(rgb.r, rgb.g, rgb.b);
float h_max = maximum(rgb.r, rgb.g, rgb.b);
float hue = 0.0f;
if(h_max != h_min)
@ -122,8 +122,8 @@ template <typename T, typename F> T color_cast(const F &f) = delete;
template <>
inline ColorHSLA color_cast(const ColorRGBA &rgb)
{
float Min = min(rgb.r, rgb.g, rgb.b);
float Max = max(rgb.r, rgb.g, rgb.b);
float Min = minimum(rgb.r, rgb.g, rgb.b);
float Max = maximum(rgb.r, rgb.g, rgb.b);
float c = Max - Min;
float h = RgbToHue(rgb);
@ -172,13 +172,13 @@ template <>
inline ColorHSLA color_cast(const ColorHSVA &hsv)
{
float l = hsv.v * (1 - hsv.s * 0.5f);
return ColorHSLA(hsv.h, (l == 0.0f || l == 1.0f) ? 0 : (hsv.v - l)/min(l, 1 - l), l);
return ColorHSLA(hsv.h, (l == 0.0f || l == 1.0f) ? 0 : (hsv.v - l)/minimum(l, 1 - l), l);
}
template <>
inline ColorHSVA color_cast(const ColorHSLA &hsl)
{
float v = hsl.l + hsl.s * min(hsl.l, 1 - hsl.l);
float v = hsl.l + hsl.s * minimum(hsl.l, 1 - hsl.l);
return ColorHSVA(hsl.h, v == 0.0f ? 0 : 2 - (2 * hsl.l / v), v);
}

View file

@ -68,10 +68,10 @@ public:
const float pi = 3.1415926535897932384626433f;
template <typename T> inline T min(T a, T b) { return a<b?a:b; }
template <typename T> inline T min(T a, T b, T c) { return min(min(a, b), c); }
template <typename T> inline T max(T a, T b) { return a>b?a:b; }
template <typename T> inline T max(T a, T b, T c) { return max(max(a, b), c); }
template <typename T> inline T minimum(T a, T b) { return a<b?a:b; }
template <typename T> inline T minimum(T a, T b, T c) { return minimum(minimum(a, b), c); }
template <typename T> inline T maximum(T a, T b) { return a>b?a:b; }
template <typename T> inline T maximum(T a, T b, T c) { return maximum(maximum(a, b), c); }
template <typename T> inline T absolute(T a) { return a<T(0)?-a:a; }
template <typename T> inline T in_range(T a, T lower, T upper) { return lower <= a && a <= upper; }

View file

@ -62,7 +62,7 @@ void CFriends::Init(bool Foes)
const CFriendInfo *CFriends::GetFriend(int Index) const
{
return &m_aFriends[max(0, Index%m_NumFriends)];
return &m_aFriends[maximum(0, Index%m_NumFriends)];
}
int CFriends::GetFriendState(const char *pName, const char *pClan) const
@ -126,7 +126,7 @@ void CFriends::RemoveFriend(const char *pName, const char *pClan)
unsigned ClanHash = str_quickhash(pClan);
for(int i = 0; i < m_NumFriends; ++i)
{
if((m_aFriends[i].m_NameHash == NameHash && !str_comp(m_aFriends[i].m_aName, pName)) &&
if((m_aFriends[i].m_NameHash == NameHash && !str_comp(m_aFriends[i].m_aName, pName)) &&
((g_Config.m_ClFriendsIgnoreClan && m_aFriends[i].m_aName[0]) || (m_aFriends[i].m_ClanHash == ClanHash && !str_comp(m_aFriends[i].m_aClan, pClan))))
{
RemoveFriend(i);

View file

@ -303,7 +303,7 @@ void CServerBrowser::Filter()
{
m_ppServerlist[i]->m_Info.m_aClients[p].m_FriendState = m_pFriends->GetFriendState(m_ppServerlist[i]->m_Info.m_aClients[p].m_aName,
m_ppServerlist[i]->m_Info.m_aClients[p].m_aClan);
m_ppServerlist[i]->m_Info.m_FriendState = max(m_ppServerlist[i]->m_Info.m_FriendState, m_ppServerlist[i]->m_Info.m_aClients[p].m_FriendState);
m_ppServerlist[i]->m_Info.m_FriendState = maximum(m_ppServerlist[i]->m_Info.m_FriendState, m_ppServerlist[i]->m_Info.m_aClients[p].m_FriendState);
}
if(!g_Config.m_BrFilterFriends || m_ppServerlist[i]->m_Info.m_FriendState != IFriends::FRIEND_NO)
@ -618,10 +618,10 @@ void CServerBrowser::Set(const NETADDR &Addr, int Type, int Token, const CServer
}
SetInfo(pEntry, *pInfo);
if (m_ServerlistType == IServerBrowser::TYPE_LAN)
pEntry->m_Info.m_Latency = min(static_cast<int>((time_get()-m_BroadcastTime)*1000/time_freq()), 999);
pEntry->m_Info.m_Latency = minimum(static_cast<int>((time_get()-m_BroadcastTime)*1000/time_freq()), 999);
else if (pEntry->m_RequestTime > 0)
{
pEntry->m_Info.m_Latency = min(static_cast<int>((time_get()-pEntry->m_RequestTime)*1000/time_freq()), 999);
pEntry->m_Info.m_Latency = minimum(static_cast<int>((time_get()-pEntry->m_RequestTime)*1000/time_freq()), 999);
pEntry->m_RequestTime = -1; // Request has been answered
}
RemoveRequest(pEntry);

View file

@ -105,7 +105,7 @@ static void Mix(short *pFinalOut, unsigned Frames)
{
int MasterVol;
mem_zero(m_pMixBuffer, m_MaxFrames*2*sizeof(int));
Frames = min(Frames, m_MaxFrames);
Frames = minimum(Frames, m_MaxFrames);
// acquire lock while we are mixing
lock_wait(m_SoundLock);
@ -463,7 +463,7 @@ int CSound::DecodeOpus(int SampleID, const void *pData, unsigned DataSize)
static int ReadDataOld(void *pBuffer, int Size)
{
int ChunkSize = min(Size, s_WVBufferSize - s_WVBufferPosition);
int ChunkSize = minimum(Size, s_WVBufferSize - s_WVBufferPosition);
mem_copy(pBuffer, (const char *)s_pWVBuffer + s_WVBufferPosition, ChunkSize);
s_WVBufferPosition += ChunkSize;
return ChunkSize;
@ -815,11 +815,11 @@ void CSound::SetVoiceTimeOffset(CVoiceHandle Voice, float offset)
Tick = clamp(TickOffset, (uint64_t)0, (uint64_t)m_aVoices[VoiceID].m_pSample->m_NumFrames);
// at least 200msec off, else depend on buffer size
float Threshold = max(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames);
float Threshold = maximum(0.2f * m_aVoices[VoiceID].m_pSample->m_Rate, (float)m_MaxFrames);
if(abs(m_aVoices[VoiceID].m_Tick-Tick) > Threshold)
{
// take care of looping (modulo!)
if( !(IsLooping && (min(m_aVoices[VoiceID].m_Tick, Tick) + m_aVoices[VoiceID].m_pSample->m_NumFrames - max(m_aVoices[VoiceID].m_Tick, Tick)) <= Threshold))
if( !(IsLooping && (minimum(m_aVoices[VoiceID].m_Tick, Tick) + m_aVoices[VoiceID].m_pSample->m_NumFrames - maximum(m_aVoices[VoiceID].m_Tick, Tick)) <= Threshold))
{
m_aVoices[VoiceID].m_Tick = Tick;
}
@ -840,7 +840,7 @@ void CSound::SetVoiceCircle(CVoiceHandle Voice, float Radius)
return;
m_aVoices[VoiceID].m_Shape = ISound::SHAPE_CIRCLE;
m_aVoices[VoiceID].m_Circle.m_Radius = max(0.0f, Radius);
m_aVoices[VoiceID].m_Circle.m_Radius = maximum(0.0f, Radius);
}
void CSound::SetVoiceRectangle(CVoiceHandle Voice, float Width, float Height)
@ -854,8 +854,8 @@ void CSound::SetVoiceRectangle(CVoiceHandle Voice, float Width, float Height)
return;
m_aVoices[VoiceID].m_Shape = ISound::SHAPE_RECTANGLE;
m_aVoices[VoiceID].m_Rectangle.m_Width = max(0.0f, Width);
m_aVoices[VoiceID].m_Rectangle.m_Height = max(0.0f, Height);
m_aVoices[VoiceID].m_Rectangle.m_Width = maximum(0.0f, Width);
m_aVoices[VoiceID].m_Rectangle.m_Height = maximum(0.0f, Height);
}
void CSound::SetChannel(int ChannelID, float Vol, float Pan)

View file

@ -69,9 +69,9 @@ struct CFontSizeData
{
int m_FontSize;
FT_Face *m_pFace;
std::map<int, SFontSizeChar> m_Chars;
};
#define MIN_FONT_SIZE 6
@ -90,7 +90,7 @@ public:
m_aFontSizes[i].m_Chars.clear();
}
}
CFontSizeData *GetFontSize(int Pixelsize)
{
int FontSize = (Pixelsize >= MIN_FONT_SIZE ? (Pixelsize > MAX_FONT_SIZE ? MAX_FONT_SIZE : Pixelsize) : MIN_FONT_SIZE);
@ -101,7 +101,7 @@ public:
char m_aFilename[512];
FT_Face m_FtFace;
CFontSizeData m_aFontSizes[NUM_FONT_SIZES];
int m_aTextures[2];
// keep the full texture, because opengl doesn't provide texture copying
unsigned char *m_TextureData[2];
@ -181,7 +181,7 @@ class CTextRender : public IEngineTextRender
int m_FirstFreeTextContainerIndex;
SBufferContainerInfo m_DefaultTextContainerInfo;
std::vector<CFont*> m_Fonts;
CFont *m_pCurFont;
@ -210,7 +210,7 @@ class CTextRender : public IEngineTextRender
STextContainer& GetTextContainer(int Index)
{
if(Index >= (int)m_TextContainers.size())
if(Index >= (int)m_TextContainers.size())
{
int Size = (int)m_TextContainers.size();
for(int i = 0; i < (Index + 1) - Size; ++i)
@ -249,16 +249,16 @@ class CTextRender : public IEngineTextRender
float m_TextOutlineG;
float m_TextOutlineB;
float m_TextOutlineA;
CFont *m_pDefaultFont;
FT_Library m_FTLibrary;
virtual void SetRenderFlags(unsigned int Flags)
{
m_RenderFlags = Flags;
}
void Grow(unsigned char *pIn, unsigned char *pOut, int w, int h)
{
for(int y = 0; y < h; y++)
@ -284,7 +284,7 @@ class CTextRender : public IEngineTextRender
}
int InitTexture(int Width, int Height, void *pUploadData = NULL)
{
{
void *pMem = NULL;
if(pUploadData)
{
@ -324,7 +324,7 @@ class CTextRender : public IEngineTextRender
}
UnloadTexture(pFont->m_aTextures[TextureIndex]);
pFont->m_aTextures[TextureIndex] = InitTexture(NewDimensions, NewDimensions, pTmpTexBuffer);
delete[] pFont->m_TextureData[TextureIndex];
pFont->m_TextureData[TextureIndex] = pTmpTexBuffer;
pFont->m_CurTextureDimensions[TextureIndex] = NewDimensions;
@ -466,7 +466,7 @@ class CTextRender : public IEngineTextRender
}
pBitmap = &pFont->m_FtFace->glyph->bitmap; // ignore_convention
// adjust spacing
int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize);
x += OutlineThickness;
@ -481,7 +481,7 @@ class CTextRender : public IEngineTextRender
for(py = 0; py < pBitmap->rows; py++) // ignore_convention
for(px = 0; px < pBitmap->width; px++) // ignore_convention
ms_aGlyphData[(py+y)*Width+px+x] = pBitmap->buffer[py*pBitmap->width+px]; // ignore_convention
// upload the glyph
int X = 0;
int Y = 0;
@ -542,9 +542,9 @@ class CTextRender : public IEngineTextRender
{
// render and add character
SFontSizeChar& FontSizeChr = pSizeData->m_Chars[Chr];
RenderGlyph(pFont, pSizeData, Chr);
return &FontSizeChr;
}
else
@ -552,7 +552,7 @@ class CTextRender : public IEngineTextRender
return &it->second;
}
}
// must only be called from the rendering function as the pFont must be set to the correct size
void RenderSetup(CFont *pFont, int size)
{
@ -645,7 +645,7 @@ public:
LoadFont(aFilename);
}
}
virtual CFont *LoadFont(const char *pFilename)
{
CFont *pFont = new CFont();
@ -672,14 +672,14 @@ public:
pFont->m_TextureSkyline[0].m_CurHeightOfPixelColumn.resize(pFont->m_CurTextureDimensions[0], 0);
pFont->m_TextureSkyline[1].m_CurHeightOfPixelColumn.resize(pFont->m_CurTextureDimensions[1], 0);
pFont->InitFontSizes();
m_Fonts.push_back(pFont);
return pFont;
};
virtual CFont *GetFont(int FontIndex)
{
if(FontIndex >= 0 && FontIndex < (int)m_Fonts.size())
@ -742,7 +742,7 @@ public:
pCursor->m_Flags = Flags;
pCursor->m_CharCount = 0;
}
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, int MaxWidth)
{
CTextCursor Cursor;
@ -827,11 +827,11 @@ public:
return;
pSizeData = pFont->GetFontSize(ActualSize);
// set length
if(Length < 0)
Length = str_length(pText);
float Scale = 1.0f / pSizeData->m_FontSize;
//the outlined texture is always the same size as the current
@ -857,7 +857,7 @@ public:
{
// make sure there are no vertices
Graphics()->FlushVertices();
if(Graphics()->IsBufferingEnabled())
{
Graphics()->TextureSet(-1);
@ -881,7 +881,7 @@ public:
const char *pBatchEnd = pEnd;
if(pCursor->m_LineWidth > 0 && !(pCursor->m_Flags&TEXTFLAG_STOP_AT_END))
{
int Wlen = min(WordLength((char *)pCurrent), (int)(pEnd-pCurrent));
int Wlen = minimum(WordLength((char *)pCurrent), (int)(pEnd-pCurrent));
CTextCursor Compare = *pCursor;
Compare.m_X = DrawX;
Compare.m_Y = DrawY;
@ -946,7 +946,7 @@ public:
{
bool ApplyBearingX = !(((m_RenderFlags&TEXT_RENDER_FLAG_NO_X_BEARING) != 0) || (CharacterCounter == 0 && (m_RenderFlags&TEXT_RENDER_FLAG_NO_FIRST_CHARACTER_X_BEARING) != 0));
float Advance = ((((m_RenderFlags&TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH) != 0) ? (pChr->m_Width) : (pChr->m_AdvanceX + ((!ApplyBearingX) ? (-pChr->m_OffsetX) : 0.f)))) * Scale;
float CharKerning = 0.f;
if((m_RenderFlags&TEXT_RENDER_FLAG_KERNING) != 0)
CharKerning = Kerning(pFont, LastCharGlyphIndex, pChr->m_GlyphIndex)*Scale*Size;
@ -961,7 +961,7 @@ public:
float BearingX = (!ApplyBearingX ? 0.f : pChr->m_OffsetX)*Scale*Size;
float CharWidth = pChr->m_Width*Scale*Size;
if(pCursor->m_Flags&TEXTFLAG_RENDER && m_TextA != 0.f)
{
if(Graphics()->IsBufferingEnabled())
@ -1079,9 +1079,9 @@ public:
ActualSize = (int)(Size * FakeToScreenY);
pSizeData = pFont->GetFontSize(ActualSize);
TextContainer.m_FontSize = pSizeData->m_FontSize;
AppendTextContainer(pCursor, ContainerIndex, pText);
if(TextContainer.m_StringInfo.m_CharacterQuads.size() == 0)
@ -1105,7 +1105,7 @@ public:
TextContainer.m_StringInfo.m_QuadBufferContainerIndex = Graphics()->CreateBufferContainer(&m_DefaultTextContainerInfo);
Graphics()->IndicesNumRequiredNotify(TextContainer.m_StringInfo.m_QuadNum * 6);
}
TextContainer.m_LineCount = pCursor->m_LineCount;
TextContainer.m_CharCount = pCursor->m_CharCount;
TextContainer.m_MaxLines = pCursor->m_MaxLines;
@ -1176,7 +1176,7 @@ public:
}
LineCount = pCursor->m_LineCount;
FT_UInt LastCharGlyphIndex = 0;
size_t CharacterCounter = 0;
@ -1186,7 +1186,7 @@ public:
const char *pBatchEnd = pEnd;
if(pCursor->m_LineWidth > 0 && !(pCursor->m_Flags&TEXTFLAG_STOP_AT_END))
{
int Wlen = min(WordLength((char *)pCurrent), (int)(pEnd - pCurrent));
int Wlen = minimum(WordLength((char *)pCurrent), (int)(pEnd - pCurrent));
CTextCursor Compare = *pCursor;
Compare.m_X = DrawX;
Compare.m_Y = DrawY;
@ -1251,7 +1251,7 @@ public:
{
bool ApplyBearingX = !(((RenderFlags&TEXT_RENDER_FLAG_NO_X_BEARING) != 0) || (CharacterCounter == 0 && (RenderFlags&TEXT_RENDER_FLAG_NO_FIRST_CHARACTER_X_BEARING) != 0));
float Advance = ((((RenderFlags&TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH) != 0) ? (pChr->m_Width) : (pChr->m_AdvanceX + ((!ApplyBearingX) ? (-pChr->m_OffsetX) : 0.f)))) * Scale;
float CharKerning = 0.f;
if((RenderFlags&TEXT_RENDER_FLAG_KERNING) != 0)
CharKerning = Kerning(TextContainer.m_pFont, LastCharGlyphIndex, pChr->m_GlyphIndex)*Scale*Size;
@ -1266,7 +1266,7 @@ public:
float BearingX = (!ApplyBearingX ? 0.f : pChr->m_OffsetX)*Scale*Size;
float CharWidth = pChr->m_Width*Scale*Size;
// don't add text that isn't drawn, the color overwrite is used for that
if(m_TextA != 0.f)
{
@ -1467,7 +1467,7 @@ public:
FakeCursor.m_LineWidth = TextContainer.m_LineWidth;
FakeCursor.m_pFont = TextContainer.m_pFont;
int Wlen = min(WordLength((char *)pCurrent), (int)(pEnd - pCurrent));
int Wlen = minimum(WordLength((char *)pCurrent), (int)(pEnd - pCurrent));
CTextCursor Compare = FakeCursor;
Compare.m_X = DrawX;
Compare.m_Y = DrawY;
@ -1500,7 +1500,7 @@ public:
pBatchEnd = pCurrent + Wlen;
}
pCurrentLast = pCurrent;
const char *pTmp = pCurrent;
int NextCharacter = str_utf8_decode(&pTmp);
@ -1560,7 +1560,7 @@ public:
float BearingX = (!ApplyBearingX ? 0.f : pChr->m_OffsetX)*Scale*Size;
float CharWidth = pChr->m_Width*Scale*Size;
if(NextCharacter == 0 && (RenderFlags&TEXT_RENDER_FLAG_NO_LAST_CHARACTER_ADVANCE) != 0)
DrawX += BearingX + CharKerning + CharWidth;
else
@ -1643,7 +1643,7 @@ public:
Graphics()->FlushVertices();
Graphics()->TextureSet(pFont->m_aTextures[1]);
Graphics()->QuadsBegin();
for(size_t i = 0; i < TextContainer.m_StringInfo.m_QuadNum; ++i)
@ -1651,18 +1651,18 @@ public:
STextCharQuad& TextCharQuad = TextContainer.m_StringInfo.m_CharacterQuads[i];
Graphics()->SetColor(TextCharQuad.m_Vertices[0].m_Color.m_R / 255.f * pTextOutlineColor->m_R, TextCharQuad.m_Vertices[0].m_Color.m_G / 255.f * pTextOutlineColor->m_G, TextCharQuad.m_Vertices[0].m_Color.m_B / 255.f * pTextOutlineColor->m_B, TextCharQuad.m_Vertices[0].m_Color.m_A / 255.f * pTextOutlineColor->m_A);
Graphics()->QuadsSetSubset(TextCharQuad.m_Vertices[0].m_U * UVScale, TextCharQuad.m_Vertices[0].m_V * UVScale, TextCharQuad.m_Vertices[2].m_U * UVScale, TextCharQuad.m_Vertices[2].m_V * UVScale);
IGraphics::CQuadItem QuadItem(TextCharQuad.m_Vertices[0].m_X, TextCharQuad.m_Vertices[0].m_Y, TextCharQuad.m_Vertices[1].m_X - TextCharQuad.m_Vertices[0].m_X, TextCharQuad.m_Vertices[2].m_Y - TextCharQuad.m_Vertices[0].m_Y);
Graphics()->QuadsDrawTL(&QuadItem, 1);
}
if(pTextColor->m_A != 0)
{
Graphics()->QuadsEndKeepVertices();
Graphics()->TextureSet(pFont->m_aTextures[0]);
for(size_t i = 0; i < TextContainer.m_StringInfo.m_QuadNum; ++i)
{
STextCharQuad& TextCharQuad = TextContainer.m_StringInfo.m_CharacterQuads[i];
@ -1672,7 +1672,7 @@ public:
unsigned char CA = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.m_A) * pTextColor->m_A);
Graphics()->ChangeColorOfQuadVertices((int)i, CR, CG, CB, CA);
}
// render non outlined
Graphics()->QuadsDrawCurrentVertices(false);
}
@ -1691,8 +1691,8 @@ public:
// remap the current screen, after render revert the change again
float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
if((TextContainer.m_RenderFlags&TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT) == 0)
{
float FakeToScreenX = (Graphics()->ScreenWidth() / (ScreenX1 - ScreenX0));
@ -1704,7 +1704,7 @@ public:
X = AlignedX - TextContainer.m_AlignedStartX;
Y = AlignedY - TextContainer.m_AlignedStartY;
}
Graphics()->MapScreen(ScreenX0 - X, ScreenY0 - Y, ScreenX1 - X, ScreenY1 - Y);
RenderTextContainer(TextContainerIndex, pTextColor, pTextOutlineColor);
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
@ -1717,18 +1717,18 @@ public:
if(!pFont)
return;
// set length
if(Length < 0)
Length = str_length(pText);
const char *pCurrent = (char *)pText;
const char *pEnd = pCurrent+Length;
int WidthLastChars = 0;
int FontSize = Size;
//adjust font size by the full space
if(Size == -1)
{
@ -1766,17 +1766,17 @@ public:
pCurrent = (char *)pText;
pEnd = pCurrent + Length;
}
while(pCurrent < pEnd)
{
{
const char *pTmp = pCurrent;
int NextCharacter = str_utf8_decode(&pTmp);
if(NextCharacter)
{
unsigned int px, py;
FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, FontSize-1);
if(FT_Load_Char(pFont->m_FtFace, NextCharacter, FT_LOAD_RENDER|FT_LOAD_NO_BITMAP))
@ -1785,16 +1785,16 @@ public:
pCurrent = pTmp;
continue;
}
pBitmap = &pFont->m_FtFace->glyph->bitmap; // ignore_convention
int MaxSizeWidth = (MaxWidth - WidthLastChars);
if(MaxSizeWidth > 0)
{
int SlotW = ((((unsigned int)MaxSizeWidth) < pBitmap->width) ? MaxSizeWidth : pBitmap->width);
int SlotH = pBitmap->rows;
int SlotSize = SlotW*SlotH;
// prepare glyph data
mem_zero(ms_aGlyphData, SlotSize);
@ -1806,7 +1806,7 @@ public:
ms_aGlyphData[(py)*SlotW + px] = pBitmap->buffer[py*pBitmap->width + px]; // ignore_convention
}
}
Graphics()->LoadTextureRawSub(TextureID, x + WidthLastChars, y, SlotW, SlotH, CImageInfo::FORMAT_ALPHA, ms_aGlyphData);
WidthLastChars += (SlotW + 1);
}

View file

@ -220,7 +220,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
m_pDataFile = pTmpDataFile;
#if defined(CONF_ARCH_ENDIAN_BIG)
swap_endian(m_pDataFile->m_pData, sizeof(int), min(static_cast<unsigned>(Header.m_Swaplen), Size) / sizeof(int));
swap_endian(m_pDataFile->m_pData, sizeof(int), minimum(static_cast<unsigned>(Header.m_Swaplen), Size) / sizeof(int));
#endif
//if(DEBUG)

View file

@ -738,7 +738,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
// get timeline markers
int Num = ((m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[0]<<24)&0xFF000000) | ((m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[1]<<16)&0xFF0000) |
((m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[2]<<8)&0xFF00) | (m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[3]&0xFF);
m_Info.m_Info.m_NumTimelineMarkers = min(Num, (int)MAX_TIMELINE_MARKERS);
m_Info.m_Info.m_NumTimelineMarkers = minimum(Num, (int)MAX_TIMELINE_MARKERS);
for(int i = 0; i < m_Info.m_Info.m_NumTimelineMarkers; i++)
{
char *pTimelineMarker = m_Info.m_TimelineMarkers.m_aTimelineMarkers[i];
@ -917,7 +917,7 @@ void CDemoPlayer::GetDemoName(char *pBuffer, int BufferSize) const
pEnd = pFileName;
}
int Length = pEnd > pExtractedName ? min(BufferSize, (int)(pEnd-pExtractedName+1)) : BufferSize;
int Length = pEnd > pExtractedName ? minimum(BufferSize, (int)(pEnd-pExtractedName+1)) : BufferSize;
str_copy(pBuffer, pExtractedName, Length);
}

View file

@ -519,7 +519,7 @@ void IStorage::StripPathAndExtension(const char *pFilename, char *pBuffer, int B
}
}
int Length = min(BufferSize, (int)(pEnd - pExtractedName + 1));
int Length = minimum(BufferSize, (int)(pEnd - pExtractedName + 1));
str_copy(pBuffer, pExtractedName, Length);
}

View file

@ -22,7 +22,7 @@ static void AnimSeqEval(CAnimSequence *pSeq, float Time, CAnimKeyframe *pFrame)
}
else
{
//time = max(0.0f, min(1.0f, time / duration)); // TODO: use clamp
//time = maximum(0.0f, minimum(1.0f, time / duration)); // TODO: use clamp
CAnimKeyframe *pFrame1 = 0;
CAnimKeyframe *pFrame2 = 0;
float Blend = 0.0f;

View file

@ -69,7 +69,7 @@ void CCamera::OnRender()
{
float DeadZone = g_Config.m_ClDyncam ? g_Config.m_ClDyncamDeadzone : g_Config.m_ClMouseDeadzone;
float FollowFactor = (g_Config.m_ClDyncam ? g_Config.m_ClDyncamFollowFactor : g_Config.m_ClMouseFollowfactor) / 100.0f;
float OffsetAmount = max(l-DeadZone, 0.0f) * FollowFactor;
float OffsetAmount = maximum(l-DeadZone, 0.0f) * FollowFactor;
CameraOffset = normalize(m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy])*OffsetAmount;
}

View file

@ -168,14 +168,14 @@ bool CChat::OnInput(IInput::CEvent Event)
{
if(Text[i] == '\n')
{
int max = min(i - Begin + 1, (int)sizeof(Line));
int max = minimum(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
SayChat(Line);
while(Text[i] == '\n') i++;
}
}
int max = min(i - Begin + 1, (int)sizeof(Line));
int max = minimum(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
m_Input.Add(Line);
@ -302,7 +302,7 @@ bool CChat::OnInput(IInput::CEvent Event)
for(m_PlaceholderLength = 0; *pCursor && *pCursor != ' '; ++pCursor)
++m_PlaceholderLength;
str_copy(m_aCompletionBuffer, m_Input.GetString()+m_PlaceholderOffset, min(static_cast<int>(sizeof(m_aCompletionBuffer)), m_PlaceholderLength+1));
str_copy(m_aCompletionBuffer, m_Input.GetString()+m_PlaceholderOffset, minimum(static_cast<int>(sizeof(m_aCompletionBuffer)), m_PlaceholderLength+1));
}
if(m_aCompletionBuffer[0] == '/')
@ -348,7 +348,7 @@ bool CChat::OnInput(IInput::CEvent Event)
{
char aBuf[256];
// add part before the name
str_copy(aBuf, m_Input.GetString(), min(static_cast<int>(sizeof(aBuf)), m_PlaceholderOffset+1));
str_copy(aBuf, m_Input.GetString(), minimum(static_cast<int>(sizeof(aBuf)), m_PlaceholderOffset+1));
// add the command
str_append(aBuf, "/", sizeof(aBuf));
@ -425,7 +425,7 @@ bool CChat::OnInput(IInput::CEvent Event)
{
char aBuf[256];
// add part before the name
str_copy(aBuf, m_Input.GetString(), min(static_cast<int>(sizeof(aBuf)), m_PlaceholderOffset+1));
str_copy(aBuf, m_Input.GetString(), minimum(static_cast<int>(sizeof(aBuf)), m_PlaceholderOffset+1));
// add the name
str_append(aBuf, pCompletionString, sizeof(aBuf));
@ -934,7 +934,7 @@ void CChat::OnRender()
if(m_InputUpdate)
{
if(m_ChatStringOffset > 0 && m_Input.GetLength(Editing) < m_OldChatStringLength)
m_ChatStringOffset = max(0, m_ChatStringOffset-(m_OldChatStringLength-m_Input.GetLength(Editing)));
m_ChatStringOffset = maximum(0, m_ChatStringOffset-(m_OldChatStringLength-m_Input.GetLength(Editing)));
if(m_ChatStringOffset > m_Input.GetCursorOffset(Editing))
m_ChatStringOffset -= m_ChatStringOffset-m_Input.GetCursorOffset(Editing);

View file

@ -125,13 +125,13 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
Begin++;
continue;
}
int max = min(i - Begin + 1, (int)sizeof(Line));
int max = minimum(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
ExecuteLine(Line);
}
}
int max = min(i - Begin + 1, (int)sizeof(Line));
int max = minimum(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
m_Input.Add(Line);

View file

@ -292,7 +292,7 @@ int CControls::SnapInput(int *pData)
m_InputData[!g_Config.m_ClDummy] = *pDummyInput;
}
if(g_Config.m_ClDummyControl){
CNetObj_PlayerInput *pDummyInput = &m_pClient->m_DummyInput;
pDummyInput->m_Jump = g_Config.m_ClDummyJump;
@ -521,9 +521,9 @@ void CControls::ClampMousePos()
float FollowFactor = (g_Config.m_ClDyncam ? g_Config.m_ClDyncamFollowFactor : g_Config.m_ClMouseFollowfactor) / 100.0f;
float DeadZone = g_Config.m_ClDyncam ? g_Config.m_ClDyncamDeadzone : g_Config.m_ClMouseDeadzone;
float MaxDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMaxDistance : g_Config.m_ClMouseMaxDistance;
float MouseMax = min(CameraMaxDistance/FollowFactor + DeadZone, MaxDistance);
float MouseMax = minimum(CameraMaxDistance/FollowFactor + DeadZone, MaxDistance);
float MinDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMinDistance : g_Config.m_ClMouseMinDistance;
float MouseMin = min(CameraMinDistance/FollowFactor + DeadZone, MinDistance);
float MouseMin = minimum(CameraMinDistance/FollowFactor + DeadZone, MinDistance);
if(length(m_MousePos[g_Config.m_ClDummy]) > MouseMax)
m_MousePos[g_Config.m_ClDummy] = normalize(m_MousePos[g_Config.m_ClDummy])*MouseMax;

View file

@ -108,7 +108,7 @@ void CCountryFlags::LoadCountryflagsIndexfile()
else
mem_zero(m_CodeIndexLUT, sizeof(m_CodeIndexLUT));
for(int i = 0; i < m_aCountryFlags.size(); ++i)
m_CodeIndexLUT[max(0, (m_aCountryFlags[i].m_CountryCode-CODE_LB)%CODE_RANGE)] = i;
m_CodeIndexLUT[maximum(0, (m_aCountryFlags[i].m_CountryCode-CODE_LB)%CODE_RANGE)] = i;
}
void CCountryFlags::OnInit()
@ -134,12 +134,12 @@ int CCountryFlags::Num() const
const CCountryFlags::CCountryFlag *CCountryFlags::GetByCountryCode(int CountryCode) const
{
return GetByIndex(m_CodeIndexLUT[max(0, (CountryCode-CODE_LB)%CODE_RANGE)]);
return GetByIndex(m_CodeIndexLUT[maximum(0, (CountryCode-CODE_LB)%CODE_RANGE)]);
}
const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(int Index) const
{
return &m_aCountryFlags[max(0, Index%m_aCountryFlags.size())];
return &m_aCountryFlags[maximum(0, Index%m_aCountryFlags.size())];
}
void CCountryFlags::Render(int CountryCode, const vec4 *pColor, float x, float y, float w, float h)

View file

@ -330,7 +330,7 @@ void CGhost::OnRender()
continue;
int CurPos = pGhost->m_PlaybackPos;
int PrevPos = max(0, CurPos - 1);
int PrevPos = maximum(0, CurPos - 1);
if(pGhost->m_Path.Get(PrevPos)->m_Tick > GhostTick)
continue;

View file

@ -213,7 +213,7 @@ void CHud::RenderScoreHud()
}
static float s_TextWidth100 = TextRender()->TextWidth(0, 14.0f, "100", -1);
float ScoreWidthMax = max(max(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth100);
float ScoreWidthMax = maximum(maximum(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth100);
float Split = 3.0f;
float ImageSize = GameFlags & GAMEFLAG_FLAGS ? 16.0f : Split;
for(int t = 0; t < 2; t++)
@ -280,7 +280,7 @@ void CHud::RenderScoreHud()
float w = TextRender()->TextWidth(0, 8.0f, pName, -1);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, min(Whole - w - 1.0f, Whole - ScoreWidthMax - ImageSize - 2 * Split), StartY + (t + 1)*20.0f - 2.0f, 8.0f, TEXTFLAG_RENDER);
TextRender()->SetCursor(&Cursor, minimum(Whole - w - 1.0f, Whole - ScoreWidthMax - ImageSize - 2 * Split), StartY + (t + 1)*20.0f - 2.0f, 8.0f, TEXTFLAG_RENDER);
Cursor.m_LineWidth = -1;
m_aScoreInfo[t].m_OptionalNameTextContainerIndex = TextRender()->CreateTextContainer(&Cursor, pName);
}
@ -389,7 +389,7 @@ void CHud::RenderScoreHud()
}
static float s_TextWidth10 = TextRender()->TextWidth(0, 14.0f, "10", -1);
float ScoreWidthMax = max(max(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth10);
float ScoreWidthMax = maximum(maximum(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth10);
float Split = 3.0f, ImageSize = 16.0f, PosSize = 16.0f;
for(int t = 0; t < 2; t++)
@ -446,7 +446,7 @@ void CHud::RenderScoreHud()
float w = TextRender()->TextWidth(0, 8.0f, pName, -1);
CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, min(Whole - w - 1.0f, Whole - ScoreWidthMax - ImageSize - 2 * Split - PosSize), StartY + (t + 1)*20.0f - 2.0f, 8.0f, TEXTFLAG_RENDER);
TextRender()->SetCursor(&Cursor, minimum(Whole - w - 1.0f, Whole - ScoreWidthMax - ImageSize - 2 * Split - PosSize), StartY + (t + 1)*20.0f - 2.0f, 8.0f, TEXTFLAG_RENDER);
Cursor.m_LineWidth = -1;
m_aScoreInfo[t].m_OptionalNameTextContainerIndex = TextRender()->CreateTextContainer(&Cursor, pName);
}
@ -714,21 +714,21 @@ void CHud::RenderHealthAndAmmo(const CNetObj_Character *pCharacter)
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GAME].m_Id);
int QuadOffset = pCharacter->m_Weapon%NUM_WEAPONS * 10;
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, min(pCharacter->m_AmmoCount, 10));
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, minimum(pCharacter->m_AmmoCount, 10));
QuadOffset = NUM_WEAPONS * 10;
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, min(pCharacter->m_Health, 10));
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, minimum(pCharacter->m_Health, 10));
QuadOffset += 10 + min(pCharacter->m_Health, 10);
if(min(pCharacter->m_Health, 10) < 10)
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, 10 - min(pCharacter->m_Health, 10));
QuadOffset += 10 + minimum(pCharacter->m_Health, 10);
if(minimum(pCharacter->m_Health, 10) < 10)
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, 10 - minimum(pCharacter->m_Health, 10));
QuadOffset = NUM_WEAPONS * 10 + 20;
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, min(pCharacter->m_Armor, 10));
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, minimum(pCharacter->m_Armor, 10));
QuadOffset += 10 + min(pCharacter->m_Armor, 10);
if(min(pCharacter->m_Armor, 10) < 10)
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, 10 - min(pCharacter->m_Armor, 10));
QuadOffset += 10 + minimum(pCharacter->m_Armor, 10);
if(minimum(pCharacter->m_Armor, 10) < 10)
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, QuadOffset, 10 - minimum(pCharacter->m_Armor, 10));
}
void CHud::RenderSpectatorHud()

View file

@ -476,11 +476,11 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
float T = Pt;
if(DestroyTick >= 0)
T = min(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick())/(float)SERVER_TICK_SPEED);
T = min(T, LifeSpan/(float)SERVER_TICK_SPEED);
T = minimum(Pt, ((float)(DestroyTick - 1 - pCurrent->m_StartTick) + Client()->PredIntraGameTick())/(float)SERVER_TICK_SPEED);
T = minimum(T, LifeSpan/(float)SERVER_TICK_SPEED);
float MinTrailSpan = 0.4f * ((pCurrent->m_Type == WEAPON_GRENADE) ? 0.5f : 0.25f);
float Step = max(Client()->FrameTimeAvg(), (pCurrent->m_Type == WEAPON_GRENADE) ? 0.02f : 0.01f);
float Step = maximum(Client()->FrameTimeAvg(), (pCurrent->m_Type == WEAPON_GRENADE) ? 0.02f : 0.01f);
for(int i = 1+(int)(Gt/Step); i < (int)(T/Step); i++)
{
float t = Step * (float)i + 0.4f * Step * (frandom() - 0.5f);
@ -489,7 +489,7 @@ void CItems::ReconstructSmokeTrail(const CNetObj_Projectile *pCurrent, int ItemI
vec2 Vel = Pos-PrevPos;
float TimePassed = Pt-t;
if(Pt - MinTrailSpan > 0.01f)
TimePassed = min(TimePassed, (TimePassed-MinTrailSpan)/(Pt - MinTrailSpan)*(MinTrailSpan * 0.5f) + MinTrailSpan);
TimePassed = minimum(TimePassed, (TimePassed-MinTrailSpan)/(Pt - MinTrailSpan)*(MinTrailSpan * 0.5f) + MinTrailSpan);
// add particle for this projectile
if(pCurrent->m_Type == WEAPON_GRENADE)
m_pClient->m_pEffects->SmokeTrail(Pos, Vel*-1, TimePassed);

View file

@ -1105,8 +1105,8 @@ void CMapLayers::RenderTileBorderCornerTiles(int WidthOffsetToOrigin, int Height
// if border is still in range of the original corner, it doesn't needs to be redrawn
bool CornerVisible = (WidthOffsetToOrigin - 1 < TileCountWidth) && (HeightOffsetToOrigin - 1 < TileCountHeight);
int CountX = min(WidthOffsetToOrigin, TileCountWidth);
int CountY = min(HeightOffsetToOrigin, TileCountHeight);
int CountX = minimum(WidthOffsetToOrigin, TileCountWidth);
int CountY = minimum(HeightOffsetToOrigin, TileCountHeight);
int Count = (CountX * CountY) - (CornerVisible ? 1 : 0); // Don't draw the corner again
@ -1179,7 +1179,7 @@ void CMapLayers::RenderTileBorder(int LayerIndex, vec4* pColor, CMapItemLayerTil
vec2 Dir;
Dir.x = 32.f;
Dir.y = 0.f;
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, min(absolute(BorderX0), CountWidth));
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, minimum(absolute(BorderX0), CountWidth));
}
}
@ -1228,7 +1228,7 @@ void CMapLayers::RenderTileBorder(int LayerIndex, vec4* pColor, CMapItemLayerTil
vec2 Dir;
Dir.x = -32.f;
Dir.y = 0.f;
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, min((BorderX1 - (pTileLayer->m_Width - 1)), CountWidth));
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, minimum((BorderX1 - (pTileLayer->m_Width - 1)), CountWidth));
}
}
if(BorderY0 < 0)
@ -1244,7 +1244,7 @@ void CMapLayers::RenderTileBorder(int LayerIndex, vec4* pColor, CMapItemLayerTil
vec2 Dir;
Dir.x = 0.f;
Dir.y = 32.f;
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, min(absolute(BorderY0), CountHeight));
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, minimum(absolute(BorderY0), CountHeight));
}
}
if(BorderY1 >= pTileLayer->m_Height)
@ -1260,7 +1260,7 @@ void CMapLayers::RenderTileBorder(int LayerIndex, vec4* pColor, CMapItemLayerTil
vec2 Dir;
Dir.x = 0.f;
Dir.y = -32.f;
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, min((BorderY1 - (pTileLayer->m_Height - 1)), CountHeight));
Graphics()->RenderBorderTileLines(Visuals.m_BufferContainerIndex, (float*)pColor, pOffset, (float*)&Offset, (float*)&Dir, DrawNum, minimum((BorderY1 - (pTileLayer->m_Height - 1)), CountHeight));
}
}
}

View file

@ -289,13 +289,13 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
// do scrolling
if(UI()->MouseX() < pRect->x && s_ScrollStart-UI()->MouseX() > 10.0f)
{
s_AtIndex = max(0, s_AtIndex-1);
s_AtIndex = maximum(0, s_AtIndex-1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
else if(UI()->MouseX() > pRect->x+pRect->w && UI()->MouseX()-s_ScrollStart > 10.0f)
{
s_AtIndex = min(Len, s_AtIndex+1);
s_AtIndex = minimum(Len, s_AtIndex+1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
@ -315,7 +315,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
{
if(!UI()->MouseButton(0))
{
s_AtIndex = min(s_AtIndex, str_length(pStr));
s_AtIndex = minimum(s_AtIndex, str_length(pStr));
s_DoScroll = false;
UI()->SetActiveItem(0);
}
@ -369,7 +369,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
{
int NewTextLen = str_length(Text);
int CharsLeft = StrSize - str_length(aInputing) - 1;
int FillCharLen = min(NewTextLen, CharsLeft);
int FillCharLen = minimum(NewTextLen, CharsLeft);
//Push Char Backward
for(int i = str_length(aInputing); i >= s_AtIndex ; i--)
aInputing[i+FillCharLen] = aInputing[i];
@ -395,7 +395,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1);
do
{
*Offset += min(wt-*Offset-Textbox.w, Textbox.w/3);
*Offset += minimum(wt-*Offset-Textbox.w, Textbox.w/3);
}
while(w-*Offset > Textbox.w);
}
@ -404,7 +404,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
// move to the right
do
{
*Offset = max(0.0f, *Offset-Textbox.w/3);
*Offset = maximum(0.0f, *Offset-Textbox.w/3);
}
while(w-*Offset < 0.0f);
}
@ -1327,7 +1327,7 @@ int CMenus::Render()
UI()->DoLabel(&Part, aBuf, 20.f, 0, -1);
// time left
int TimeLeft = max(1, m_DownloadSpeed > 0.0f ? static_cast<int>((Client()->MapDownloadTotalsize()-Client()->MapDownloadAmount())/m_DownloadSpeed) : 1);
int TimeLeft = maximum(1, m_DownloadSpeed > 0.0f ? static_cast<int>((Client()->MapDownloadTotalsize()-Client()->MapDownloadAmount())/m_DownloadSpeed) : 1);
if(TimeLeft >= 60)
{
TimeLeft /= 60;
@ -1346,7 +1346,7 @@ int CMenus::Render()
Box.HSplitTop(24.f, &Part, &Box);
Part.VMargin(40.0f, &Part);
RenderTools()->DrawUIRect(&Part, vec4(1.0f, 1.0f, 1.0f, 0.25f), CUI::CORNER_ALL, 5.0f);
Part.w = max(10.0f, (Part.w*Client()->MapDownloadAmount())/Client()->MapDownloadTotalsize());
Part.w = maximum(10.0f, (Part.w*Client()->MapDownloadAmount())/Client()->MapDownloadTotalsize());
RenderTools()->DrawUIRect(&Part, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 5.0f);
}
}

View file

@ -184,8 +184,8 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
{
if(m_aInputEvents[i].m_Key == KEY_DOWN) NewIndex = m_SelectedIndex + 1;
else if(m_aInputEvents[i].m_Key == KEY_UP) NewIndex = m_SelectedIndex - 1;
else if(m_aInputEvents[i].m_Key == KEY_PAGEUP) NewIndex = max(m_SelectedIndex - 25, 0);
else if(m_aInputEvents[i].m_Key == KEY_PAGEDOWN) NewIndex = min(m_SelectedIndex + 25, NumServers - 1);
else if(m_aInputEvents[i].m_Key == KEY_PAGEUP) NewIndex = maximum(m_SelectedIndex - 25, 0);
else if(m_aInputEvents[i].m_Key == KEY_PAGEDOWN) NewIndex = minimum(m_SelectedIndex + 25, NumServers - 1);
else if(m_aInputEvents[i].m_Key == KEY_HOME) NewIndex = 0;
else if(m_aInputEvents[i].m_Key == KEY_END) NewIndex = NumServers - 1;
}

View file

@ -659,8 +659,8 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected,
{
if(m_aInputEvents[i].m_Key == KEY_DOWN) NewIndex = gs_ListBoxNewSelected + 1;
else if(m_aInputEvents[i].m_Key == KEY_UP) NewIndex = gs_ListBoxNewSelected - 1;
else if(m_aInputEvents[i].m_Key == KEY_PAGEUP) NewIndex = max(gs_ListBoxNewSelected - 20, 0);
else if(m_aInputEvents[i].m_Key == KEY_PAGEDOWN) NewIndex = min(gs_ListBoxNewSelected + 20, gs_ListBoxNumItems - 1);
else if(m_aInputEvents[i].m_Key == KEY_PAGEUP) NewIndex = maximum(gs_ListBoxNewSelected - 20, 0);
else if(m_aInputEvents[i].m_Key == KEY_PAGEDOWN) NewIndex = minimum(gs_ListBoxNewSelected + 20, gs_ListBoxNumItems - 1);
else if(m_aInputEvents[i].m_Key == KEY_HOME) NewIndex = 0;
else if(m_aInputEvents[i].m_Key == KEY_END) NewIndex = gs_ListBoxNumItems - 1;
}
@ -736,7 +736,7 @@ int CMenus::DemolistFetchCallback(const char *pName, time_t Date, int IsDir, int
}
else
{
str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), str_length(pName) - 4));
str_copy(Item.m_aName, pName, minimum(static_cast<int>(sizeof(Item.m_aName)), str_length(pName) - 4));
Item.m_InfosLoaded = false;
Item.m_Date = Date;
}
@ -1057,8 +1057,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
{
if(m_aInputEvents[i].m_Key == KEY_DOWN) NewIndex = m_DemolistSelectedIndex + 1;
else if(m_aInputEvents[i].m_Key == KEY_UP) NewIndex = m_DemolistSelectedIndex - 1;
else if(m_aInputEvents[i].m_Key == KEY_PAGEUP) NewIndex = max(m_DemolistSelectedIndex - 20, 0);
else if(m_aInputEvents[i].m_Key == KEY_PAGEDOWN) NewIndex = min(m_DemolistSelectedIndex + 20, m_lDemos.size() - 1);
else if(m_aInputEvents[i].m_Key == KEY_PAGEUP) NewIndex = maximum(m_DemolistSelectedIndex - 20, 0);
else if(m_aInputEvents[i].m_Key == KEY_PAGEDOWN) NewIndex = minimum(m_DemolistSelectedIndex + 20, m_lDemos.size() - 1);
else if(m_aInputEvents[i].m_Key == KEY_HOME) NewIndex = 0;
else if(m_aInputEvents[i].m_Key == KEY_END) NewIndex = m_lDemos.size() - 1;
}

View file

@ -801,9 +801,9 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Mouse sens."), g_Config.m_InpMousesens);
UI()->DoLabel(&Label, aBuf, 14.0f*UI()->Scale(), -1);
Button.HMargin(2.0f, &Button);
int NewValue = (int)(DoScrollbarH(&g_Config.m_InpMousesens, &Button, (min(g_Config.m_InpMousesens, 500)-1)/500.0f)*500.0f)+1;
int NewValue = (int)(DoScrollbarH(&g_Config.m_InpMousesens, &Button, (minimum(g_Config.m_InpMousesens, 500)-1)/500.0f)*500.0f)+1;
if(g_Config.m_InpMousesens < 500 || NewValue < 500)
g_Config.m_InpMousesens = min(NewValue, 500);
g_Config.m_InpMousesens = minimum(NewValue, 500);
MovementSettings.HSplitTop(20.0f, 0, &MovementSettings);
}
@ -814,9 +814,9 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("UI mouse s."), g_Config.m_UiMousesens);
UI()->DoLabel(&Label, aBuf, 14.0f*UI()->Scale(), -1);
Button.HMargin(2.0f, &Button);
int NewValue = (int)(DoScrollbarH(&g_Config.m_UiMousesens, &Button, (min(g_Config.m_UiMousesens, 500)-1)/500.0f)*500.0f)+1;
int NewValue = (int)(DoScrollbarH(&g_Config.m_UiMousesens, &Button, (minimum(g_Config.m_UiMousesens, 500)-1)/500.0f)*500.0f)+1;
if(g_Config.m_UiMousesens < 500 || NewValue < 500)
g_Config.m_UiMousesens = min(NewValue, 500);
g_Config.m_UiMousesens = minimum(NewValue, 500);
MovementSettings.HSplitTop(20.0f, 0, &MovementSettings);
}
@ -1082,7 +1082,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), "");
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
Button.HMargin(2.0f, &Button);
int NewRefreshRate = static_cast<int>(DoScrollbarH(&g_Config.m_GfxRefreshRate, &Button, (min(g_Config.m_GfxRefreshRate, 1000))/1000.0f)*1000.0f+0.1f);
int NewRefreshRate = static_cast<int>(DoScrollbarH(&g_Config.m_GfxRefreshRate, &Button, (minimum(g_Config.m_GfxRefreshRate, 1000))/1000.0f)*1000.0f+0.1f);
if(g_Config.m_GfxRefreshRate <= 1000 || NewRefreshRate < 1000)
g_Config.m_GfxRefreshRate = NewRefreshRate;
@ -1196,7 +1196,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
Button.VSplitLeft(190.0f, 0, &Button);
static float Offset = 0.0f;
DoEditBox(&g_Config.m_SndRate, &Button, aBuf, sizeof(aBuf), 14.0f, &Offset);
g_Config.m_SndRate = max(1, str_toint(aBuf));
g_Config.m_SndRate = maximum(1, str_toint(aBuf));
m_NeedRestartSound = !s_SndEnable || s_SndRate != g_Config.m_SndRate;
}

View file

@ -480,7 +480,7 @@ void CPlayers::RenderPlayer(
if(Phase1Tick < (g_pData->m_Weapons.m_aId[iw].m_Muzzleduration + 3))
{
float t = (((float)Phase1Tick) + IntraTick)/g_pData->m_Weapons.m_aId[iw].m_Muzzleduration;
Alpha = mix(2.0f, 0.0f, min(1.0f,max(0.0f,t)));
Alpha = mix(2.0f, 0.0f, minimum(1.0f,maximum(0.0f,t)));
}
int IteX = rand() % g_pData->m_Weapons.m_aId[iw].m_NumSpriteMuzzles;

View file

@ -182,7 +182,7 @@ int CRaceDemo::RaceDemolistFetchCallback(const char *pName, time_t Date, int IsD
return 0;
CDemoItem Item;
str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), Length - 4));
str_copy(Item.m_aName, pName, minimum(static_cast<int>(sizeof(Item.m_aName)), Length - 4));
const char *pTime = Item.m_aName + MapLen + 1;
const char *pTEnd = pTime;

View file

@ -1282,8 +1282,8 @@ void CGameClient::OnNewSnapshot()
return static_cast<bool>(p1);
if (!p1)
return false;
return (((IsGameTypeRace && p1->m_Score == -9999) ? std::numeric_limits<int>::min() : p1->m_Score) >
((IsGameTypeRace && p2->m_Score == -9999) ? std::numeric_limits<int>::min() : p2->m_Score));
return (((IsGameTypeRace && p1->m_Score == -9999) ? std::numeric_limits<int>::minimum() : p1->m_Score) >
((IsGameTypeRace && p2->m_Score == -9999) ? std::numeric_limits<int>::minimum() : p2->m_Score));
});
// sort player infos by DDRace Team (and score between)
@ -1492,7 +1492,7 @@ void CGameClient::OnPredict()
if(!m_Snap.m_aCharacters[i].m_Active || i == m_Snap.m_LocalClientID || !s_aLastActive[i])
continue;
vec2 NewPos = (m_PredictedTick == Client()->PredGameTick()) ? m_aClients[i].m_Predicted.m_Pos : m_aClients[i].m_PrevPredicted.m_Pos;
vec2 PredErr = (s_aLastPos[i] - NewPos)/(float)min(Client()->GetPredictionTime(), 200);
vec2 PredErr = (s_aLastPos[i] - NewPos)/(float)minimum(Client()->GetPredictionTime(), 200);
if(in_range(length(PredErr), 0.05f, 5.f))
{
vec2 PredPos = mix(m_aClients[i].m_PrevPredicted.m_Pos, m_aClients[i].m_Predicted.m_Pos, Client()->PredIntraGameTick());
@ -1518,7 +1518,7 @@ void CGameClient::OnPredict()
}
int64 TimePassed = time_get() - m_aClients[i].m_SmoothStart[j];
if(in_range(TimePassed, (int64)0, Len-1))
MixAmount[j] = min(MixAmount[j], (float)(TimePassed/(double)Len));
MixAmount[j] = minimum(MixAmount[j], (float)(TimePassed/(double)Len));
}
for(int j = 0; j < 2; j++)
@ -1526,7 +1526,7 @@ void CGameClient::OnPredict()
MixAmount[j] = MixAmount[j^1];
for(int j = 0; j < 2; j++)
{
int64 Remaining = min((1.f-MixAmount[j])*Len, min(time_freq()*0.700f, (1.f-MixAmount[j^1])*Len + time_freq()*0.300f)); // don't smooth for longer than 700ms, or more than 300ms longer along one axis than the other axis
int64 Remaining = minimum((1.f-MixAmount[j])*Len, minimum(time_freq()*0.700f, (1.f-MixAmount[j^1])*Len + time_freq()*0.300f)); // don't smooth for longer than 700ms, or more than 300ms longer along one axis than the other axis
int64 Start = time_get() - (Len - Remaining);
if(!in_range(Start + Len, m_aClients[i].m_SmoothStart[j], m_aClients[i].m_SmoothStart[j] + Len))
{
@ -2008,7 +2008,7 @@ void CGameClient::DetectStrongHook()
int ToPlayer = m_Snap.m_aCharacters[FromPlayer].m_Prev.m_HookedPlayer;
if(ToPlayer < 0 || ToPlayer >= MAX_CLIENTS || !m_Snap.m_aCharacters[ToPlayer].m_Active || ToPlayer != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_HookedPlayer)
continue;
if(abs(min(s_LastUpdateTick[ToPlayer], s_LastUpdateTick[FromPlayer]) - Client()->GameTick()) < SERVER_TICK_SPEED/4)
if(abs(minimum(s_LastUpdateTick[ToPlayer], s_LastUpdateTick[FromPlayer]) - Client()->GameTick()) < SERVER_TICK_SPEED/4)
continue;
if(m_Snap.m_aCharacters[FromPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_Direction
|| m_Snap.m_aCharacters[ToPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[ToPlayer].m_Cur.m_Direction)

View file

@ -490,7 +490,7 @@ bool CCharacter::GiveWeapon(int Weapon, int Ammo)
{
m_aWeapons[Weapon].m_Got = true;
if(!m_FreezeTime)
m_aWeapons[Weapon].m_Ammo = min(g_pData->m_Weapons.m_aId[Weapon].m_Maxammo, Ammo);
m_aWeapons[Weapon].m_Ammo = minimum(g_pData->m_Weapons.m_aId[Weapon].m_Maxammo, Ammo);
return true;
}
return false;

View file

@ -109,7 +109,7 @@ void CAutoMapper::Load(const char* pTileName)
NewIndexRule.m_Flag = 0;
NewIndexRule.m_RandomProbability = 1.0;
NewIndexRule.m_DefaultRule = true;
NewIndexRule.m_SkipEmpty = false;
NewIndexRule.m_SkipEmpty = false;
NewIndexRule.m_SkipFull = false;
if(str_length(aOrientation1) > 0)
@ -258,19 +258,19 @@ void CAutoMapper::Load(const char* pTileName)
CPosRule NewPosRule = {x, y, Value, NewIndexList};
pCurrentIndex->m_aRules.add(NewPosRule);
pCurrentConf->m_StartX = min(pCurrentConf->m_StartX, NewPosRule.m_X);
pCurrentConf->m_StartY = min(pCurrentConf->m_StartY, NewPosRule.m_Y);
pCurrentConf->m_EndX = max(pCurrentConf->m_EndX, NewPosRule.m_X);
pCurrentConf->m_EndY = max(pCurrentConf->m_EndY, NewPosRule.m_Y);
pCurrentConf->m_StartX = minimum(pCurrentConf->m_StartX, NewPosRule.m_X);
pCurrentConf->m_StartY = minimum(pCurrentConf->m_StartY, NewPosRule.m_Y);
pCurrentConf->m_EndX = maximum(pCurrentConf->m_EndX, NewPosRule.m_X);
pCurrentConf->m_EndY = maximum(pCurrentConf->m_EndY, NewPosRule.m_Y);
if(x == 0 && y == 0) {
for(int i = 0; i < NewIndexList.size(); ++i)
{
if(Value == CPosRule::INDEX && NewIndexList[i].m_ID == 0)
pCurrentIndex->m_SkipFull = true;
else
pCurrentIndex->m_SkipEmpty = true;
}
if(x == 0 && y == 0) {
for(int i = 0; i < NewIndexList.size(); ++i)
{
if(Value == CPosRule::INDEX && NewIndexList[i].m_ID == 0)
pCurrentIndex->m_SkipFull = true;
else
pCurrentIndex->m_SkipEmpty = true;
}
}
}
}
@ -323,13 +323,13 @@ void CAutoMapper::Load(const char* pTileName)
CIndexInfo NewIndexInfo = {0, 0, false};
NewIndexList.add(NewIndexInfo);
CPosRule NewPosRule = {0, 0, CPosRule::NOTINDEX, NewIndexList};
pIndexRule->m_aRules.add(NewPosRule);
pIndexRule->m_SkipEmpty = true;
pIndexRule->m_SkipFull = false;
}
if(pIndexRule->m_SkipEmpty && pIndexRule->m_SkipFull)
{
pIndexRule->m_aRules.add(NewPosRule);
pIndexRule->m_SkipEmpty = true;
pIndexRule->m_SkipFull = false;
}
if(pIndexRule->m_SkipEmpty && pIndexRule->m_SkipFull)
{
pIndexRule->m_SkipFull = false;
}
}
@ -452,10 +452,10 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedO
for(int i = 0; i < pRun->m_aIndexRules.size(); ++i)
{
CIndexRule *pIndexRule = &pRun->m_aIndexRules[i];
if(pIndexRule->m_SkipEmpty && pTile->m_Index == 0) // skip empty tiles
continue;
if(pIndexRule->m_SkipFull && pTile->m_Index != 0) // skip full tiles
CIndexRule *pIndexRule = &pRun->m_aIndexRules[i];
if(pIndexRule->m_SkipEmpty && pTile->m_Index == 0) // skip empty tiles
continue;
if(pIndexRule->m_SkipFull && pTile->m_Index != 0) // skip full tiles
continue;
bool RespectRules = true;
@ -501,7 +501,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedO
if(RespectRules &&
(pIndexRule->m_RandomProbability >= 1.0 || HashLocation(Seed, h, i, x + SeedOffsetX, y + SeedOffsetY) < HASH_MAX * pIndexRule->m_RandomProbability))
{
pTile->m_Index = pIndexRule->m_ID;
pTile->m_Index = pIndexRule->m_ID;
pTile->m_Flags = pIndexRule->m_Flag;
}
}

View file

@ -258,8 +258,8 @@ void CLayerGroup::GetSize(float *w, float *h)
{
float lw, lh;
m_lLayers[i]->GetSize(&lw, &lh);
*w = max(*w, lw);
*h = max(*h, lh);
*w = maximum(*w, lw);
*h = maximum(*h, lh);
}
}
@ -374,13 +374,13 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
// do scrolling
if(UI()->MouseX() < pRect->x && s_ScrollStart-UI()->MouseX() > 10.0f)
{
s_AtIndex = max(0, s_AtIndex-1);
s_AtIndex = maximum(0, s_AtIndex-1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
else if(UI()->MouseX() > pRect->x+pRect->w && UI()->MouseX()-s_ScrollStart > 10.0f)
{
s_AtIndex = min(Len, s_AtIndex+1);
s_AtIndex = minimum(Len, s_AtIndex+1);
s_ScrollStart = UI()->MouseX();
UpdateOffset = true;
}
@ -417,7 +417,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
{
if(!UI()->MouseButton(0))
{
s_AtIndex = min(s_AtIndex, str_length(pStr));
s_AtIndex = minimum(s_AtIndex, str_length(pStr));
s_DoScroll = false;
UI()->SetActiveItem(0);
}
@ -463,7 +463,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1);
do
{
*Offset += min(wt-*Offset-Textbox.w, Textbox.w/3);
*Offset += minimum(wt-*Offset-Textbox.w, Textbox.w/3);
}
while(w-*Offset > Textbox.w);
}
@ -472,7 +472,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
// move to the right
do
{
*Offset = max(0.0f, *Offset-Textbox.w/3);
*Offset = maximum(0.0f, *Offset-Textbox.w/3);
}
while(w-*Offset < 0.0f);
}
@ -1278,7 +1278,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
if(m_Brush.m_lLayers[i]->m_Type == LAYERTYPE_TILES)
{
TileLayer = true;
s_RotationAmount = max(90, (s_RotationAmount/90)*90);
s_RotationAmount = maximum(90, (s_RotationAmount/90)*90);
break;
}
s_RotationAmount = UiDoValueSelector(&s_RotationAmount, &Button, "", s_RotationAmount, TileLayer?90:1, 359, TileLayer?90:1, TileLayer?10.0f:2.0f, "Rotation of the brush in degrees. Use left mouse button to drag and change the value. Hold shift to be more precise.", true);
@ -2386,7 +2386,7 @@ void CEditor::DoMapEditor(CUIRect View)
else
{
// fix aspect ratio of the image in the picker
float Max = min(View.w, View.h);
float Max = minimum(View.w, View.h);
View.w = View.h = Max;
}
@ -3956,7 +3956,7 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect View)
r.w = r.h;
else
r.h = r.w;
float Max = (float)(max(m_Map.m_lImages[i]->m_Width, m_Map.m_lImages[i]->m_Height));
float Max = (float)(maximum(m_Map.m_lImages[i]->m_Width, m_Map.m_lImages[i]->m_Height));
r.w *= m_Map.m_lImages[i]->m_Width/Max;
r.h *= m_Map.m_lImages[i]->m_Height/Max;
Graphics()->TextureSet(m_Map.m_lImages[i]->m_TexID);
@ -4129,9 +4129,9 @@ static int EditorListdirCallback(const char *pName, int IsDir, int StorageType,
else
{
if(pEditor->m_FileDialogFileType == CEditor::FILETYPE_SOUND)
str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), Length-4));
str_copy(Item.m_aName, pName, minimum(static_cast<int>(sizeof(Item.m_aName)), Length-4));
else
str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), Length-3));
str_copy(Item.m_aName, pName, minimum(static_cast<int>(sizeof(Item.m_aName)), Length-3));
}
Item.m_IsDir = IsDir != 0;
Item.m_IsLink = false;

View file

@ -224,8 +224,8 @@ void CLayerQuads::GetSize(float *w, float *h)
{
for(int p = 0; p < 5; p++)
{
*w = max(*w, fx2f(m_lQuads[i].m_aPoints[p].x));
*h = max(*h, fx2f(m_lQuads[i].m_aPoints[p].y));
*w = maximum(*w, fx2f(m_lQuads[i].m_aPoints[p].x));
*h = maximum(*h, fx2f(m_lQuads[i].m_aPoints[p].y));
}
}
}

View file

@ -589,8 +589,8 @@ void CLayerTiles::Resize(int NewW, int NewH)
mem_zero(pNewData, NewW*NewH*sizeof(CTile));
// copy old data
for(int y = 0; y < min(NewH, m_Height); y++)
mem_copy(&pNewData[y*NewW], &m_pTiles[y*m_Width], min(m_Width, NewW)*sizeof(CTile));
for(int y = 0; y < minimum(NewH, m_Height); y++)
mem_copy(&pNewData[y*NewW], &m_pTiles[y*m_Width], minimum(m_Width, NewW)*sizeof(CTile));
// replace old
delete [] m_pTiles;
@ -674,10 +674,10 @@ void CLayerTiles::ShowInfo()
Graphics()->TextureSet(m_pEditor->Client()->GetDebugFont());
Graphics()->QuadsBegin();
int StartY = max(0, (int)(ScreenY0/32.0f)-1);
int StartX = max(0, (int)(ScreenX0/32.0f)-1);
int EndY = min((int)(ScreenY1/32.0f)+1, m_Height);
int EndX = min((int)(ScreenX1/32.0f)+1, m_Width);
int StartY = maximum(0, (int)(ScreenY0/32.0f)-1);
int StartX = maximum(0, (int)(ScreenX0/32.0f)-1);
int EndY = minimum((int)(ScreenY1/32.0f)+1, m_Height);
int EndX = minimum((int)(ScreenX1/32.0f)+1, m_Width);
for(int y = StartY; y < EndY; y++)
for(int x = StartX; x < EndX; x++)
@ -1001,8 +1001,8 @@ void CLayerTele::Resize(int NewW, int NewH)
mem_zero(pNewTeleData, NewW*NewH*sizeof(CTeleTile));
// copy old data
for(int y = 0; y < min(NewH, m_Height); y++)
mem_copy(&pNewTeleData[y*NewW], &m_pTeleTile[y*m_Width], min(m_Width, NewW)*sizeof(CTeleTile));
for(int y = 0; y < minimum(NewH, m_Height); y++)
mem_copy(&pNewTeleData[y*NewW], &m_pTeleTile[y*m_Width], minimum(m_Width, NewW)*sizeof(CTeleTile));
// replace old
delete [] m_pTeleTile;
@ -1273,8 +1273,8 @@ void CLayerSpeedup::Resize(int NewW, int NewH)
mem_zero(pNewSpeedupData, NewW*NewH*sizeof(CSpeedupTile));
// copy old data
for(int y = 0; y < min(NewH, m_Height); y++)
mem_copy(&pNewSpeedupData[y*NewW], &m_pSpeedupTile[y*m_Width], min(m_Width, NewW)*sizeof(CSpeedupTile));
for(int y = 0; y < minimum(NewH, m_Height); y++)
mem_copy(&pNewSpeedupData[y*NewW], &m_pSpeedupTile[y*m_Width], minimum(m_Width, NewW)*sizeof(CSpeedupTile));
// replace old
delete [] m_pSpeedupTile;
@ -1608,8 +1608,8 @@ void CLayerSwitch::Resize(int NewW, int NewH)
mem_zero(pNewSwitchData, NewW*NewH*sizeof(CSwitchTile));
// copy old data
for(int y = 0; y < min(NewH, m_Height); y++)
mem_copy(&pNewSwitchData[y*NewW], &m_pSwitchTile[y*m_Width], min(m_Width, NewW)*sizeof(CSwitchTile));
for(int y = 0; y < minimum(NewH, m_Height); y++)
mem_copy(&pNewSwitchData[y*NewW], &m_pSwitchTile[y*m_Width], minimum(m_Width, NewW)*sizeof(CSwitchTile));
// replace old
delete [] m_pSwitchTile;
@ -1901,8 +1901,8 @@ void CLayerTune::Resize(int NewW, int NewH)
mem_zero(pNewTuneData, NewW*NewH*sizeof(CTuneTile));
// copy old data
for(int y = 0; y < min(NewH, m_Height); y++)
mem_copy(&pNewTuneData[y*NewW], &m_pTuneTile[y*m_Width], min(m_Width, NewW)*sizeof(CTuneTile));
for(int y = 0; y < minimum(NewH, m_Height); y++)
mem_copy(&pNewTuneData[y*NewW], &m_pTuneTile[y*m_Width], minimum(m_Width, NewW)*sizeof(CTuneTile));
// replace old
delete [] m_pTuneTile;

View file

@ -112,7 +112,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
if(pEditor->DoButton_Editor(&s_DeleteButton, "Delete group", 0, &Button, 0, "Delete group"))
{
pEditor->m_Map.DeleteGroup(pEditor->m_SelectedGroup);
pEditor->m_SelectedGroup = max(0, pEditor->m_SelectedGroup-1);
pEditor->m_SelectedGroup = maximum(0, pEditor->m_SelectedGroup-1);
return 1;
}
}
@ -1212,7 +1212,7 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View)
ImageView.w = ImageView.h;
else
ImageView.h = ImageView.w;
float Max = (float)(max(pEditor->m_Map.m_lImages[ShowImage]->m_Width, pEditor->m_Map.m_lImages[ShowImage]->m_Height));
float Max = (float)(maximum(pEditor->m_Map.m_lImages[ShowImage]->m_Width, pEditor->m_Map.m_lImages[ShowImage]->m_Height));
ImageView.w *= pEditor->m_Map.m_lImages[ShowImage]->m_Width/Max;
ImageView.h *= pEditor->m_Map.m_lImages[ShowImage]->m_Height/Max;
pEditor->Graphics()->TextureSet(pEditor->m_Map.m_lImages[ShowImage]->m_TexID);

View file

@ -642,7 +642,7 @@ void CCharacter::HandleWeapons()
if ((Server()->Tick() - m_aWeapons[m_Core.m_ActiveWeapon].m_AmmoRegenStart) >= AmmoRegenTime * Server()->TickSpeed() / 1000)
{
// Add some ammo
m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo = min(m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo + 1, 10);
m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo = minimum(m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo + 1, 10);
m_aWeapons[m_Core.m_ActiveWeapon].m_AmmoRegenStart = -1;
}
}
@ -923,7 +923,7 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
// m_pPlayer only inflicts half damage on self
if(From == m_pPlayer->GetCID())
Dmg = max(1, Dmg/2);
Dmg = maximum(1, Dmg/2);
m_DamageTaken++;

View file

@ -962,7 +962,7 @@ void CGameContext::ProgressVoteOptions(int ClientID)
return; // shouldn't happen / fail silently
int VotesLeft = m_NumVoteOptions - pPl->m_SendVoteIndex;
int NumVotesToSend = min(g_Config.m_SvSendVotesPerTick, VotesLeft);
int NumVotesToSend = minimum(g_Config.m_SvSendVotesPerTick, VotesLeft);
if (!VotesLeft)
{

View file

@ -171,8 +171,8 @@ void CPlayer::Tick()
if(Server()->GetClientInfo(m_ClientID, &Info))
{
m_Latency.m_Accum += Info.m_Latency;
m_Latency.m_AccumMax = max(m_Latency.m_AccumMax, Info.m_Latency);
m_Latency.m_AccumMin = min(m_Latency.m_AccumMin, Info.m_Latency);
m_Latency.m_AccumMax = maximum(m_Latency.m_AccumMax, Info.m_Latency);
m_Latency.m_AccumMin = minimum(m_Latency.m_AccumMin, Info.m_Latency);
}
// each second
if(Server()->Tick()%Server()->TickSpeed() == 0)

View file

@ -247,7 +247,7 @@ void CFileScore::ShowTop5(IConsole::IResult *pResult, int ClientID,
{
CGameContext *pSelf = (CGameContext *) pUserData;
char aBuf[512];
Debut = max(1, Debut < 0 ? m_Top.size() + Debut - 3 : Debut);
Debut = maximum(1, Debut < 0 ? m_Top.size() + Debut - 3 : Debut);
pSelf->SendChatTarget(ClientID, "----------- Top 5 -----------");
for (int i = 0; i < 5; i++)
{

View file

@ -896,7 +896,7 @@ bool CSqlScore::ShowTop5Thread(CSqlServer* pSqlServer, const CSqlData *pGameData
if (HandleFailure)
return true;
int LimitStart = max(abs(pData->m_Num)-1, 0);
int LimitStart = maximum(abs(pData->m_Num)-1, 0);
const char *pOrder = pData->m_Num >= 0 ? "ASC" : "DESC";
try
@ -956,7 +956,7 @@ bool CSqlScore::ShowTeamTop5Thread(CSqlServer* pSqlServer, const CSqlData *pGame
if (HandleFailure)
return true;
int LimitStart = max(abs(pData->m_Num)-1, 0);
int LimitStart = maximum(abs(pData->m_Num)-1, 0);
const char *pOrder = pData->m_Num >= 0 ? "ASC" : "DESC";
try
@ -1075,7 +1075,7 @@ bool CSqlScore::ShowTimesThread(CSqlServer* pSqlServer, const CSqlData *pGameDat
if (HandleFailure)
return true;
int LimitStart = max(abs(pData->m_Num)-1, 0);
int LimitStart = maximum(abs(pData->m_Num)-1, 0);
const char *pOrder = pData->m_Num >= 0 ? "DESC" : "ASC";
try
@ -1219,7 +1219,7 @@ bool CSqlScore::ShowTopPointsThread(CSqlServer* pSqlServer, const CSqlData *pGam
if (HandleFailure)
return true;
int LimitStart = max(abs(pData->m_Num)-1, 0);
int LimitStart = maximum(abs(pData->m_Num)-1, 0);
const char *pOrder = pData->m_Num >= 0 ? "ASC" : "DESC";
try