mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-17 13:38:18 +00:00
Remove most clang-tidy parameter name exceptions
- `maxModes` --> `MaxModesAvailable` (`MaxModes` is already used differently) - `numModes` --> `NumModesInserted` (`NumModes` is already used differently) - `mode` --> `Mode` - `rgb` --> `Color` - `png_ptr` --> `pPngStruct` - `error_msg` --> `pErrorMessage` - `warning_msg` --> `pWarningMessage` - `sw` --> `SubWidth` - `sh` --> `SubHeight` - `lhs` --> `Lhs` - `rhs` --> `Rhs` - `object` --> `pObject` - `index` --> `pIndex`/`Index` - `array` --> `pArray` - `string` --> `pString` - `integer` --> `pInteger` - `boolean` --> `pBoolean` - `p` --> `pObj` - `id` --> `Id`/`Index` - `width` --> `Width` - `height` --> `Height` - `ownId` --> `OwnId` - `xoff` --> `OffsetX` - `yoff` --> `OffsetY` - `pos0` --> `Pos0` - `pos1` --> `Pos1` - `fnMatchCallback` --> `pfnMatchCallback` - `dx` --> `DeltaX` - `dy` --> `DeltaY` - `wx`, `wy` --> `WorldPos` (`vec2` instead of two `float`s)
This commit is contained in:
parent
ec768b2269
commit
fd33f0fc1a
|
@ -136,7 +136,7 @@ CheckOptions:
|
|||
- key: readability-identifier-naming.ParameterCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ParameterIgnoredRegexp
|
||||
value: '^(p|a|v|[a-z]$|s[hw]$|warning_msg$|error_msg$|string$|integer$|boolean$|object$|index$|rhs$|lhs$|[xy]off$|id$|mode$|rgb$|[xy][0123]$|width$|height$|[sdw][xy]$|ownId$|fnMatchCallback$).*'
|
||||
value: '^(p|a|v|[a-z]$|[xy][0123]$).*'
|
||||
- key: readability-identifier-naming.ClassMethodIgnoredRegexp
|
||||
value: '^(Con_).*'
|
||||
- key: readability-identifier-naming.ClassMemberIgnoredRegexp
|
||||
|
@ -144,5 +144,5 @@ CheckOptions:
|
|||
- key: readability-identifier-naming.LocalConstantIgnoredRegexp
|
||||
value: '^(p|a|v|s_|MAX_ANIM_SPEED$|DATA_OFFSET$|HEADER_LEN$|MIN_ANIM_SPEED$|[hwdcbqstf]$|[xt][0123]$|result$|sub$|it$|len$|d[xy]$).*'
|
||||
- key: readability-identifier-naming.LocalVariableIgnoredRegexp
|
||||
value: '^(p|a|s_|FT_|TB_|s_|ul_|v|[xy]i$|[zijklxyhmrgbacwestnduvqf]$|[dmpwsitcf][xy]$|(ch|skel)[0-2]?$|it$|tw$|dt$|th$|ls$|func$|res$|shader$|len$|maxLength$|length$|offset$|offpos$|result$|bg$|sp$|url$|index$|ctxt$|key$|null$|logger$|LAST_MODIFIED$|teleNr$|target$|id$|hit$|hsl[0-2]?$|rgb[0-2]?$|dir$|tmp$|sub$|ret$|rendered$|(lower|upper)(16|26|24|32)|size$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_matches$|matches$|nohook$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|mode$|maxModes$|numModes$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*'
|
||||
value: '^(p|a|s_|FT_|TB_|s_|ul_|v|[xy]i$|[zijklxyhmrgbacwestnduvqf]$|[dmpwsitcf][xy]$|(ch|skel)[0-2]?$|it$|tw$|dt$|th$|ls$|func$|res$|shader$|len$|maxLength$|length$|offset$|offpos$|result$|bg$|sp$|url$|index$|ctxt$|key$|null$|logger$|LAST_MODIFIED$|teleNr$|target$|id$|hit$|hsl[0-2]?$|rgb[0-2]?$|dir$|tmp$|sub$|ret$|rendered$|size$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_matches$|matches$|nohook$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*'
|
||||
|
||||
|
|
|
@ -905,8 +905,7 @@ static void DisplayToVideoMode(CVideoMode *pVMode, SDL_DisplayMode *pMode, int H
|
|||
void CGraphicsBackend_SDL_GL::GetVideoModes(CVideoMode *pModes, int MaxModes, int *pNumModes, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int ScreenId)
|
||||
{
|
||||
SDL_DisplayMode DesktopMode;
|
||||
int maxModes = SDL_GetNumDisplayModes(ScreenId);
|
||||
int numModes = 0;
|
||||
int MaxModesAvailable = SDL_GetNumDisplayModes(ScreenId);
|
||||
|
||||
// Only collect fullscreen modes when requested, that makes sure in windowed mode no refresh rates are shown that aren't supported without
|
||||
// fullscreen anyway(except fullscreen desktop)
|
||||
|
@ -921,49 +920,50 @@ void CGraphicsBackend_SDL_GL::GetVideoModes(CVideoMode *pModes, int MaxModes, in
|
|||
constexpr int ModeCount = 256;
|
||||
SDL_DisplayMode aModes[ModeCount];
|
||||
int NumModes = 0;
|
||||
for(int i = 0; i < maxModes && NumModes < ModeCount; i++)
|
||||
for(int i = 0; i < MaxModesAvailable && NumModes < ModeCount; i++)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
if(SDL_GetDisplayMode(ScreenId, i, &mode) < 0)
|
||||
SDL_DisplayMode Mode;
|
||||
if(SDL_GetDisplayMode(ScreenId, i, &Mode) < 0)
|
||||
{
|
||||
dbg_msg("gfx", "unable to get display mode: %s", SDL_GetError());
|
||||
continue;
|
||||
}
|
||||
|
||||
aModes[NumModes] = mode;
|
||||
aModes[NumModes] = Mode;
|
||||
++NumModes;
|
||||
}
|
||||
|
||||
auto &&ModeInsert = [&](SDL_DisplayMode &mode) {
|
||||
if(numModes < MaxModes)
|
||||
int NumModesInserted = 0;
|
||||
auto &&ModeInsert = [&](SDL_DisplayMode &Mode) {
|
||||
if(NumModesInserted < MaxModes)
|
||||
{
|
||||
// if last mode was equal, ignore this one --- in fullscreen this can really only happen if the screen
|
||||
// supports different color modes
|
||||
// in non fullscren these are the modes that show different refresh rate, but are basically the same
|
||||
if(numModes > 0 && pModes[numModes - 1].m_WindowWidth == mode.w && pModes[numModes - 1].m_WindowHeight == mode.h && (pModes[numModes - 1].m_RefreshRate == mode.refresh_rate || (mode.refresh_rate != DesktopMode.refresh_rate && !CollectFullscreenModes)))
|
||||
if(NumModesInserted > 0 && pModes[NumModesInserted - 1].m_WindowWidth == Mode.w && pModes[NumModesInserted - 1].m_WindowHeight == Mode.h && (pModes[NumModesInserted - 1].m_RefreshRate == Mode.refresh_rate || (Mode.refresh_rate != DesktopMode.refresh_rate && !CollectFullscreenModes)))
|
||||
return;
|
||||
|
||||
DisplayToVideoMode(&pModes[numModes], &mode, HiDPIScale, !CollectFullscreenModes ? DesktopMode.refresh_rate : mode.refresh_rate);
|
||||
numModes++;
|
||||
DisplayToVideoMode(&pModes[NumModesInserted], &Mode, HiDPIScale, !CollectFullscreenModes ? DesktopMode.refresh_rate : Mode.refresh_rate);
|
||||
NumModesInserted++;
|
||||
}
|
||||
};
|
||||
|
||||
for(int i = 0; i < NumModes; i++)
|
||||
{
|
||||
SDL_DisplayMode &mode = aModes[i];
|
||||
SDL_DisplayMode &Mode = aModes[i];
|
||||
|
||||
if(mode.w > MaxWindowWidth || mode.h > MaxWindowHeight)
|
||||
if(Mode.w > MaxWindowWidth || Mode.h > MaxWindowHeight)
|
||||
continue;
|
||||
|
||||
ModeInsert(mode);
|
||||
ModeInsert(Mode);
|
||||
|
||||
if(IsFullscreenDestkop)
|
||||
break;
|
||||
|
||||
if(numModes >= MaxModes)
|
||||
if(NumModesInserted >= MaxModes)
|
||||
break;
|
||||
}
|
||||
*pNumModes = numModes;
|
||||
*pNumModes = NumModesInserted;
|
||||
}
|
||||
|
||||
void CGraphicsBackend_SDL_GL::GetCurrentVideoMode(CVideoMode &CurMode, int HiDPIScale, int MaxWindowWidth, int MaxWindowHeight, int ScreenId)
|
||||
|
|
|
@ -1353,9 +1353,9 @@ public:
|
|||
m_Color.a = a;
|
||||
}
|
||||
|
||||
void TextColor(ColorRGBA rgb) override
|
||||
void TextColor(ColorRGBA Color) override
|
||||
{
|
||||
m_Color = rgb;
|
||||
m_Color = Color;
|
||||
}
|
||||
|
||||
void TextOutlineColor(float r, float g, float b, float a) override
|
||||
|
@ -1366,9 +1366,9 @@ public:
|
|||
m_OutlineColor.a = a;
|
||||
}
|
||||
|
||||
void TextOutlineColor(ColorRGBA rgb) override
|
||||
void TextOutlineColor(ColorRGBA Color) override
|
||||
{
|
||||
m_OutlineColor = rgb;
|
||||
m_OutlineColor = Color;
|
||||
}
|
||||
|
||||
void TextSelectionColor(float r, float g, float b, float a) override
|
||||
|
@ -1379,9 +1379,9 @@ public:
|
|||
m_SelectionColor.a = a;
|
||||
}
|
||||
|
||||
void TextSelectionColor(ColorRGBA rgb) override
|
||||
void TextSelectionColor(ColorRGBA Color) override
|
||||
{
|
||||
m_SelectionColor = rgb;
|
||||
m_SelectionColor = Color;
|
||||
}
|
||||
|
||||
ColorRGBA GetTextColor() const override
|
||||
|
|
|
@ -44,17 +44,17 @@ public:
|
|||
std::jmp_buf m_JmpBuf;
|
||||
};
|
||||
|
||||
[[noreturn]] static void PngErrorCallback(png_structp png_ptr, png_const_charp error_msg)
|
||||
[[noreturn]] static void PngErrorCallback(png_structp pPngStruct, png_const_charp pErrorMessage)
|
||||
{
|
||||
CUserErrorStruct *pUserStruct = static_cast<CUserErrorStruct *>(png_get_error_ptr(png_ptr));
|
||||
log_error("png", "error for file \"%s\": %s", pUserStruct->m_pContextName, error_msg);
|
||||
CUserErrorStruct *pUserStruct = static_cast<CUserErrorStruct *>(png_get_error_ptr(pPngStruct));
|
||||
log_error("png", "error for file \"%s\": %s", pUserStruct->m_pContextName, pErrorMessage);
|
||||
std::longjmp(pUserStruct->m_JmpBuf, 1);
|
||||
}
|
||||
|
||||
static void PngWarningCallback(png_structp png_ptr, png_const_charp warning_msg)
|
||||
static void PngWarningCallback(png_structp pPngStruct, png_const_charp pWarningMessage)
|
||||
{
|
||||
CUserErrorStruct *pUserStruct = static_cast<CUserErrorStruct *>(png_get_error_ptr(png_ptr));
|
||||
log_warn("png", "warning for file \"%s\": %s", pUserStruct->m_pContextName, warning_msg);
|
||||
CUserErrorStruct *pUserStruct = static_cast<CUserErrorStruct *>(png_get_error_ptr(pPngStruct));
|
||||
log_warn("png", "warning for file \"%s\": %s", pUserStruct->m_pContextName, pWarningMessage);
|
||||
}
|
||||
|
||||
static void PngReadDataCallback(png_structp pPngStruct, png_bytep pOutBytes, png_size_t ByteCountToRead)
|
||||
|
@ -307,7 +307,7 @@ static void PngWriteDataCallback(png_structp pPngStruct, png_bytep pOutBytes, pn
|
|||
pWriter->Write(pOutBytes, ByteCountToWrite);
|
||||
}
|
||||
|
||||
static void PngOutputFlushCallback(png_structp png_ptr)
|
||||
static void PngOutputFlushCallback(png_structp pPngStruct)
|
||||
{
|
||||
// no need to flush memory buffer
|
||||
}
|
||||
|
|
|
@ -157,41 +157,41 @@ void DilateImage(const CImageInfo &Image)
|
|||
DilateImage(Image.m_pData, Image.m_Width, Image.m_Height);
|
||||
}
|
||||
|
||||
void DilateImageSub(uint8_t *pImageBuff, int w, int h, int x, int y, int sw, int sh)
|
||||
void DilateImageSub(uint8_t *pImageBuff, int w, int h, int x, int y, int SubWidth, int SubHeight)
|
||||
{
|
||||
uint8_t *apBuffer[2] = {nullptr, nullptr};
|
||||
|
||||
const size_t ImageSize = (size_t)sw * sh * sizeof(uint8_t) * DILATE_BPP;
|
||||
const size_t ImageSize = (size_t)SubWidth * SubHeight * sizeof(uint8_t) * DILATE_BPP;
|
||||
apBuffer[0] = (uint8_t *)malloc(ImageSize);
|
||||
apBuffer[1] = (uint8_t *)malloc(ImageSize);
|
||||
uint8_t *pBufferOriginal = (uint8_t *)malloc(ImageSize);
|
||||
|
||||
for(int Y = 0; Y < sh; ++Y)
|
||||
for(int Y = 0; Y < SubHeight; ++Y)
|
||||
{
|
||||
int SrcImgOffset = ((y + Y) * w * DILATE_BPP) + (x * DILATE_BPP);
|
||||
int DstImgOffset = (Y * sw * DILATE_BPP);
|
||||
int CopySize = sw * DILATE_BPP;
|
||||
int DstImgOffset = (Y * SubWidth * DILATE_BPP);
|
||||
int CopySize = SubWidth * DILATE_BPP;
|
||||
mem_copy(&pBufferOriginal[DstImgOffset], &pImageBuff[SrcImgOffset], CopySize);
|
||||
}
|
||||
|
||||
Dilate(sw, sh, pBufferOriginal, apBuffer[0]);
|
||||
Dilate(SubWidth, SubHeight, pBufferOriginal, apBuffer[0]);
|
||||
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
Dilate(sw, sh, apBuffer[0], apBuffer[1]);
|
||||
Dilate(sw, sh, apBuffer[1], apBuffer[0]);
|
||||
Dilate(SubWidth, SubHeight, apBuffer[0], apBuffer[1]);
|
||||
Dilate(SubWidth, SubHeight, apBuffer[1], apBuffer[0]);
|
||||
}
|
||||
|
||||
CopyColorValues(sw, sh, apBuffer[0], pBufferOriginal);
|
||||
CopyColorValues(SubWidth, SubHeight, apBuffer[0], pBufferOriginal);
|
||||
|
||||
free(apBuffer[0]);
|
||||
free(apBuffer[1]);
|
||||
|
||||
for(int Y = 0; Y < sh; ++Y)
|
||||
for(int Y = 0; Y < SubHeight; ++Y)
|
||||
{
|
||||
int SrcImgOffset = ((y + Y) * w * DILATE_BPP) + (x * DILATE_BPP);
|
||||
int DstImgOffset = (Y * sw * DILATE_BPP);
|
||||
int CopySize = sw * DILATE_BPP;
|
||||
int DstImgOffset = (Y * SubWidth * DILATE_BPP);
|
||||
int CopySize = SubWidth * DILATE_BPP;
|
||||
mem_copy(&pImageBuff[SrcImgOffset], &pBufferOriginal[DstImgOffset], CopySize);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ void ConvertToGrayscale(const CImageInfo &Image);
|
|||
// These functions assume that the image data is 4 bytes per pixel RGBA
|
||||
void DilateImage(uint8_t *pImageBuff, int w, int h);
|
||||
void DilateImage(const CImageInfo &Image);
|
||||
void DilateImageSub(uint8_t *pImageBuff, int w, int h, int x, int y, int sw, int sh);
|
||||
void DilateImageSub(uint8_t *pImageBuff, int w, int h, int x, int y, int SubWidth, int SubHeight);
|
||||
|
||||
// Returned buffer is allocated with malloc, must be freed by caller
|
||||
uint8_t *ResizeImage(const uint8_t *pImageData, int Width, int Height, int NewWidth, int NewHeight, int BPP);
|
||||
|
|
|
@ -19,7 +19,7 @@ void CFileCollection::Init(IStorage *pStorage, const char *pPath, const char *pF
|
|||
m_pStorage = pStorage;
|
||||
|
||||
m_pStorage->ListDirectory(IStorage::TYPE_SAVE, m_aPath, FilelistCallback, this);
|
||||
std::sort(m_vFileEntries.begin(), m_vFileEntries.end(), [](const CFileEntry &lhs, const CFileEntry &rhs) { return lhs.m_Timestamp < rhs.m_Timestamp; });
|
||||
std::sort(m_vFileEntries.begin(), m_vFileEntries.end(), [](const CFileEntry &Lhs, const CFileEntry &Rhs) { return Lhs.m_Timestamp < Rhs.m_Timestamp; });
|
||||
|
||||
int FilesDeleted = 0;
|
||||
for(auto FileEntry : m_vFileEntries)
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
#include <base/system.h>
|
||||
#include <engine/shared/json.h>
|
||||
|
||||
const struct _json_value *json_object_get(const json_value *object, const char *index)
|
||||
const struct _json_value *json_object_get(const json_value *pObject, const char *pIndex)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if(object->type != json_object)
|
||||
if(pObject->type != json_object)
|
||||
return &json_value_none;
|
||||
|
||||
for(i = 0; i < object->u.object.length; ++i)
|
||||
if(!str_comp(object->u.object.values[i].name, index))
|
||||
return object->u.object.values[i].value;
|
||||
for(i = 0; i < pObject->u.object.length; ++i)
|
||||
if(!str_comp(pObject->u.object.values[i].name, pIndex))
|
||||
return pObject->u.object.values[i].value;
|
||||
|
||||
return &json_value_none;
|
||||
}
|
||||
|
||||
const struct _json_value *json_array_get(const json_value *array, int index)
|
||||
const struct _json_value *json_array_get(const json_value *pArray, int Index)
|
||||
{
|
||||
if(array->type != json_array || index >= (int)array->u.array.length)
|
||||
if(pArray->type != json_array || Index >= (int)pArray->u.array.length)
|
||||
return &json_value_none;
|
||||
|
||||
return array->u.array.values[index];
|
||||
return pArray->u.array.values[Index];
|
||||
}
|
||||
|
||||
int json_array_length(const json_value *array)
|
||||
int json_array_length(const json_value *pArray)
|
||||
{
|
||||
return array->u.array.length;
|
||||
return pArray->u.array.length;
|
||||
}
|
||||
|
||||
const char *json_string_get(const json_value *string)
|
||||
const char *json_string_get(const json_value *pString)
|
||||
{
|
||||
return string->u.string.ptr;
|
||||
return pString->u.string.ptr;
|
||||
}
|
||||
|
||||
int json_int_get(const json_value *integer)
|
||||
int json_int_get(const json_value *pInteger)
|
||||
{
|
||||
return integer->u.integer;
|
||||
return pInteger->u.integer;
|
||||
}
|
||||
|
||||
int json_boolean_get(const json_value *boolean)
|
||||
int json_boolean_get(const json_value *pBoolean)
|
||||
{
|
||||
return boolean->u.boolean != 0;
|
||||
return pBoolean->u.boolean != 0;
|
||||
}
|
||||
|
||||
static char EscapeJsonChar(char c)
|
||||
|
|
|
@ -352,11 +352,11 @@ public:
|
|||
|
||||
// old foolish interface
|
||||
virtual void TextColor(float r, float g, float b, float a) = 0;
|
||||
virtual void TextColor(ColorRGBA rgb) = 0;
|
||||
virtual void TextColor(ColorRGBA Color) = 0;
|
||||
virtual void TextOutlineColor(float r, float g, float b, float a) = 0;
|
||||
virtual void TextOutlineColor(ColorRGBA rgb) = 0;
|
||||
virtual void TextOutlineColor(ColorRGBA Color) = 0;
|
||||
virtual void TextSelectionColor(float r, float g, float b, float a) = 0;
|
||||
virtual void TextSelectionColor(ColorRGBA rgb) = 0;
|
||||
virtual void TextSelectionColor(ColorRGBA Color) = 0;
|
||||
virtual void Text(float x, float y, float Size, const char *pText, float LineWidth = -1.0f) = 0;
|
||||
virtual float TextWidth(float Size, const char *pText, int StrLength = -1, float LineWidth = -1.0f, int Flags = 0, const STextSizeProperties &TextSizeProps = {}) = 0;
|
||||
virtual STextBoundingBox TextBoundingBox(float Size, const char *pText, int StrLength = -1, float LineWidth = -1.0f, float LineSpacing = 0.0f, int Flags = 0) = 0;
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
public: \
|
||||
void *operator new(size_t Size) \
|
||||
{ \
|
||||
void *p = malloc(Size); \
|
||||
mem_zero(p, Size); \
|
||||
return p; \
|
||||
void *pObj = malloc(Size); \
|
||||
mem_zero(pObj, Size); \
|
||||
return pObj; \
|
||||
} \
|
||||
void operator delete(void *pPtr) \
|
||||
{ \
|
||||
|
@ -35,9 +35,9 @@ private:
|
|||
|
||||
#define MACRO_ALLOC_POOL_ID() \
|
||||
public: \
|
||||
void *operator new(size_t Size, int id); \
|
||||
void operator delete(void *p, int id); \
|
||||
void operator delete(void *p); /* NOLINT(misc-new-delete-overloads) */ \
|
||||
void *operator new(size_t Size, int Id); \
|
||||
void operator delete(void *pObj, int Id); \
|
||||
void operator delete(void *pObj); /* NOLINT(misc-new-delete-overloads) */ \
|
||||
\
|
||||
private:
|
||||
|
||||
|
@ -51,30 +51,30 @@ private:
|
|||
static char gs_PoolData##POOLTYPE[PoolSize][MACRO_ALLOC_GET_SIZE(POOLTYPE)] = {{0}}; \
|
||||
static int gs_PoolUsed##POOLTYPE[PoolSize] = {0}; \
|
||||
MAYBE_UNUSED static int gs_PoolDummy##POOLTYPE = (ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE, sizeof(gs_PoolData##POOLTYPE)), 0); \
|
||||
void *POOLTYPE::operator new(size_t Size, int id) \
|
||||
void *POOLTYPE::operator new(size_t Size, int Id) \
|
||||
{ \
|
||||
dbg_assert(sizeof(POOLTYPE) >= Size, "size error"); \
|
||||
dbg_assert(!gs_PoolUsed##POOLTYPE[id], "already used"); \
|
||||
ASAN_UNPOISON_MEMORY_REGION(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
gs_PoolUsed##POOLTYPE[id] = 1; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
return gs_PoolData##POOLTYPE[id]; \
|
||||
dbg_assert(!gs_PoolUsed##POOLTYPE[Id], "already used"); \
|
||||
ASAN_UNPOISON_MEMORY_REGION(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
|
||||
gs_PoolUsed##POOLTYPE[Id] = 1; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
|
||||
return gs_PoolData##POOLTYPE[Id]; \
|
||||
} \
|
||||
void POOLTYPE::operator delete(void *p, int id) \
|
||||
void POOLTYPE::operator delete(void *pObj, int Id) \
|
||||
{ \
|
||||
dbg_assert(gs_PoolUsed##POOLTYPE[id], "not used"); \
|
||||
dbg_assert(id == (POOLTYPE *)p - (POOLTYPE *)gs_PoolData##POOLTYPE, "invalid id"); \
|
||||
gs_PoolUsed##POOLTYPE[id] = 0; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
dbg_assert(gs_PoolUsed##POOLTYPE[Id], "not used"); \
|
||||
dbg_assert(Id == (POOLTYPE *)pObj - (POOLTYPE *)gs_PoolData##POOLTYPE, "invalid id"); \
|
||||
gs_PoolUsed##POOLTYPE[Id] = 0; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
|
||||
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
|
||||
} \
|
||||
void POOLTYPE::operator delete(void *p) /* NOLINT(misc-new-delete-overloads) */ \
|
||||
void POOLTYPE::operator delete(void *pObj) /* NOLINT(misc-new-delete-overloads) */ \
|
||||
{ \
|
||||
int id = (POOLTYPE *)p - (POOLTYPE *)gs_PoolData##POOLTYPE; \
|
||||
dbg_assert(gs_PoolUsed##POOLTYPE[id], "not used"); \
|
||||
gs_PoolUsed##POOLTYPE[id] = 0; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
int Id = (POOLTYPE *)pObj - (POOLTYPE *)gs_PoolData##POOLTYPE; \
|
||||
dbg_assert(gs_PoolUsed##POOLTYPE[Id], "not used"); \
|
||||
gs_PoolUsed##POOLTYPE[Id] = 0; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
|
||||
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[Id], sizeof(gs_PoolData##POOLTYPE[Id])); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,7 @@ void CFreezeBars::RenderFreezeBar(const int ClientId)
|
|||
RenderFreezeBarPos(Position.x, Position.y, FreezeBarWidth, FreezeBarHight, FreezeProgress, Alpha);
|
||||
}
|
||||
|
||||
void CFreezeBars::RenderFreezeBarPos(float x, const float y, const float width, const float height, float Progress, const float Alpha)
|
||||
void CFreezeBars::RenderFreezeBarPos(float x, const float y, const float Width, const float Height, float Progress, const float Alpha)
|
||||
{
|
||||
Progress = clamp(Progress, 0.0f, 1.0f);
|
||||
|
||||
|
@ -45,9 +45,9 @@ void CFreezeBars::RenderFreezeBarPos(float x, const float y, const float width,
|
|||
const float RestPct = 0.5f;
|
||||
const float ProgPct = 0.5f;
|
||||
|
||||
const float EndWidth = height; // to keep the correct scale - the height of the sprite is as long as the width
|
||||
const float BarHeight = height;
|
||||
const float WholeBarWidth = width;
|
||||
const float EndWidth = Height; // to keep the correct scale - the height of the sprite is as long as the width
|
||||
const float BarHeight = Height;
|
||||
const float WholeBarWidth = Width;
|
||||
const float MiddleBarWidth = WholeBarWidth - (EndWidth * 2.0f);
|
||||
const float EndProgressWidth = EndWidth * ProgPct;
|
||||
const float EndRestWidth = EndWidth * RestPct;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
class CFreezeBars : public CComponent
|
||||
{
|
||||
void RenderFreezeBar(const int ClientId);
|
||||
void RenderFreezeBarPos(float x, const float y, const float width, const float height, float Progress, float Alpha = 1.0f);
|
||||
void RenderFreezeBarPos(float x, const float y, const float Width, const float Height, float Progress, float Alpha = 1.0f);
|
||||
bool IsPlayerInfoAvailable(int ClientId) const;
|
||||
|
||||
public:
|
||||
|
|
|
@ -1040,7 +1040,7 @@ void CHud::RenderPlayerState(const int ClientId)
|
|||
}
|
||||
}
|
||||
|
||||
void CHud::RenderNinjaBarPos(const float x, float y, const float width, const float height, float Progress, const float Alpha)
|
||||
void CHud::RenderNinjaBarPos(const float x, float y, const float Width, const float Height, float Progress, const float Alpha)
|
||||
{
|
||||
Progress = clamp(Progress, 0.0f, 1.0f);
|
||||
|
||||
|
@ -1049,9 +1049,9 @@ void CHud::RenderNinjaBarPos(const float x, float y, const float width, const fl
|
|||
const float RestPct = 0.5f;
|
||||
const float ProgPct = 0.5f;
|
||||
|
||||
const float EndHeight = width; // to keep the correct scale - the width of the sprite is as long as the height
|
||||
const float BarWidth = width;
|
||||
const float WholeBarHeight = height;
|
||||
const float EndHeight = Width; // to keep the correct scale - the width of the sprite is as long as the height
|
||||
const float BarWidth = Width;
|
||||
const float WholeBarHeight = Height;
|
||||
const float MiddleBarHeight = WholeBarHeight - (EndHeight * 2.0f);
|
||||
const float EndProgressHeight = EndHeight * ProgPct;
|
||||
const float EndRestHeight = EndHeight * RestPct;
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
// DDRace
|
||||
|
||||
virtual void OnMessage(int MsgType, void *pRawMsg) override;
|
||||
void RenderNinjaBarPos(float x, const float y, const float width, const float height, float Progress, float Alpha = 1.0f);
|
||||
void RenderNinjaBarPos(float x, const float y, const float Width, const float Height, float Progress, float Alpha = 1.0f);
|
||||
|
||||
private:
|
||||
void RenderRecord();
|
||||
|
|
|
@ -2772,16 +2772,16 @@ IGameClient *CreateGameClient()
|
|||
return new CGameClient();
|
||||
}
|
||||
|
||||
int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, int ownId)
|
||||
int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, int OwnId)
|
||||
{
|
||||
float Distance = 0.0f;
|
||||
int ClosestId = -1;
|
||||
|
||||
const CClientData &OwnClientData = m_aClients[ownId];
|
||||
const CClientData &OwnClientData = m_aClients[OwnId];
|
||||
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(i == ownId)
|
||||
if(i == OwnId)
|
||||
continue;
|
||||
|
||||
const CClientData &Data = m_aClients[i];
|
||||
|
@ -2797,7 +2797,7 @@ int CGameClient::IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, in
|
|||
bool IsOneSuper = Data.m_Super || OwnClientData.m_Super;
|
||||
bool IsOneSolo = Data.m_Solo || OwnClientData.m_Solo;
|
||||
|
||||
if(!IsOneSuper && (!m_Teams.SameTeam(i, ownId) || IsOneSolo || OwnClientData.m_HookHitDisabled))
|
||||
if(!IsOneSuper && (!m_Teams.SameTeam(i, OwnId) || IsOneSolo || OwnClientData.m_HookHitDisabled))
|
||||
continue;
|
||||
|
||||
vec2 ClosestPoint;
|
||||
|
@ -3904,9 +3904,9 @@ void CGameClient::SnapCollectEntities()
|
|||
class CEntComparer
|
||||
{
|
||||
public:
|
||||
bool operator()(const CSnapEntities &lhs, const CSnapEntities &rhs) const
|
||||
bool operator()(const CSnapEntities &Lhs, const CSnapEntities &Rhs) const
|
||||
{
|
||||
return lhs.m_Item.m_Id < rhs.m_Item.m_Id;
|
||||
return Lhs.m_Item.m_Id < Rhs.m_Item.m_Id;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@ public:
|
|||
|
||||
class CTeamsCore m_Teams;
|
||||
|
||||
int IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, int ownId);
|
||||
int IntersectCharacter(vec2 HookPos, vec2 NewPos, vec2 &NewPos2, int OwnId);
|
||||
|
||||
int GetLastRaceTick() const override;
|
||||
|
||||
|
|
|
@ -602,28 +602,28 @@ int CCollision::IsSolid(int x, int y) const
|
|||
return index == TILE_SOLID || index == TILE_NOHOOK;
|
||||
}
|
||||
|
||||
bool CCollision::IsThrough(int x, int y, int xoff, int yoff, vec2 pos0, vec2 pos1) const
|
||||
bool CCollision::IsThrough(int x, int y, int OffsetX, int OffsetY, vec2 Pos0, vec2 Pos1) const
|
||||
{
|
||||
int pos = GetPureMapIndex(x, y);
|
||||
if(m_pFront && (m_pFront[pos].m_Index == TILE_THROUGH_ALL || m_pFront[pos].m_Index == TILE_THROUGH_CUT))
|
||||
return true;
|
||||
if(m_pFront && m_pFront[pos].m_Index == TILE_THROUGH_DIR && ((m_pFront[pos].m_Flags == ROTATION_0 && pos0.y > pos1.y) || (m_pFront[pos].m_Flags == ROTATION_90 && pos0.x < pos1.x) || (m_pFront[pos].m_Flags == ROTATION_180 && pos0.y < pos1.y) || (m_pFront[pos].m_Flags == ROTATION_270 && pos0.x > pos1.x)))
|
||||
if(m_pFront && m_pFront[pos].m_Index == TILE_THROUGH_DIR && ((m_pFront[pos].m_Flags == ROTATION_0 && Pos0.y > Pos1.y) || (m_pFront[pos].m_Flags == ROTATION_90 && Pos0.x < Pos1.x) || (m_pFront[pos].m_Flags == ROTATION_180 && Pos0.y < Pos1.y) || (m_pFront[pos].m_Flags == ROTATION_270 && Pos0.x > Pos1.x)))
|
||||
return true;
|
||||
int offpos = GetPureMapIndex(x + xoff, y + yoff);
|
||||
int offpos = GetPureMapIndex(x + OffsetX, y + OffsetY);
|
||||
return m_pTiles[offpos].m_Index == TILE_THROUGH || (m_pFront && m_pFront[offpos].m_Index == TILE_THROUGH);
|
||||
}
|
||||
|
||||
bool CCollision::IsHookBlocker(int x, int y, vec2 pos0, vec2 pos1) const
|
||||
bool CCollision::IsHookBlocker(int x, int y, vec2 Pos0, vec2 Pos1) const
|
||||
{
|
||||
int pos = GetPureMapIndex(x, y);
|
||||
if(m_pTiles[pos].m_Index == TILE_THROUGH_ALL || (m_pFront && m_pFront[pos].m_Index == TILE_THROUGH_ALL))
|
||||
return true;
|
||||
if(m_pTiles[pos].m_Index == TILE_THROUGH_DIR && ((m_pTiles[pos].m_Flags == ROTATION_0 && pos0.y < pos1.y) ||
|
||||
(m_pTiles[pos].m_Flags == ROTATION_90 && pos0.x > pos1.x) ||
|
||||
(m_pTiles[pos].m_Flags == ROTATION_180 && pos0.y > pos1.y) ||
|
||||
(m_pTiles[pos].m_Flags == ROTATION_270 && pos0.x < pos1.x)))
|
||||
if(m_pTiles[pos].m_Index == TILE_THROUGH_DIR && ((m_pTiles[pos].m_Flags == ROTATION_0 && Pos0.y < Pos1.y) ||
|
||||
(m_pTiles[pos].m_Flags == ROTATION_90 && Pos0.x > Pos1.x) ||
|
||||
(m_pTiles[pos].m_Flags == ROTATION_180 && Pos0.y > Pos1.y) ||
|
||||
(m_pTiles[pos].m_Flags == ROTATION_270 && Pos0.x < Pos1.x)))
|
||||
return true;
|
||||
if(m_pFront && m_pFront[pos].m_Index == TILE_THROUGH_DIR && ((m_pFront[pos].m_Flags == ROTATION_0 && pos0.y < pos1.y) || (m_pFront[pos].m_Flags == ROTATION_90 && pos0.x > pos1.x) || (m_pFront[pos].m_Flags == ROTATION_180 && pos0.y > pos1.y) || (m_pFront[pos].m_Flags == ROTATION_270 && pos0.x < pos1.x)))
|
||||
if(m_pFront && m_pFront[pos].m_Index == TILE_THROUGH_DIR && ((m_pFront[pos].m_Flags == ROTATION_0 && Pos0.y < Pos1.y) || (m_pFront[pos].m_Flags == ROTATION_90 && Pos0.x > Pos1.x) || (m_pFront[pos].m_Flags == ROTATION_180 && Pos0.y > Pos1.y) || (m_pFront[pos].m_Flags == ROTATION_270 && Pos0.x < Pos1.x)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -1078,12 +1078,12 @@ int CCollision::Entity(int x, int y, int Layer) const
|
|||
}
|
||||
}
|
||||
|
||||
void CCollision::SetCollisionAt(float x, float y, int id)
|
||||
void CCollision::SetCollisionAt(float x, float y, int Index)
|
||||
{
|
||||
int Nx = clamp(round_to_int(x) / 32, 0, m_Width - 1);
|
||||
int Ny = clamp(round_to_int(y) / 32, 0, m_Height - 1);
|
||||
|
||||
m_pTiles[Ny * m_Width + Nx].m_Index = id;
|
||||
m_pTiles[Ny * m_Width + Nx].m_Index = Index;
|
||||
}
|
||||
|
||||
void CCollision::SetDCollisionAt(float x, float y, int Type, int Flags, int Number)
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
bool TestBox(vec2 Pos, vec2 Size) const;
|
||||
|
||||
// DDRace
|
||||
void SetCollisionAt(float x, float y, int id);
|
||||
void SetCollisionAt(float x, float y, int Index);
|
||||
void SetDCollisionAt(float x, float y, int Type, int Flags, int Number);
|
||||
int GetDTileIndex(int Index) const;
|
||||
int GetDTileFlags(int Index) const;
|
||||
|
@ -101,8 +101,8 @@ public:
|
|||
int GetSwitchDelay(int Index) const;
|
||||
|
||||
int IsSolid(int x, int y) const;
|
||||
bool IsThrough(int x, int y, int xoff, int yoff, vec2 pos0, vec2 pos1) const;
|
||||
bool IsHookBlocker(int x, int y, vec2 pos0, vec2 pos1) const;
|
||||
bool IsThrough(int x, int y, int OffsetX, int OffsetY, vec2 Pos0, vec2 Pos1) const;
|
||||
bool IsHookBlocker(int x, int y, vec2 Pos0, vec2 Pos1) const;
|
||||
int IsWallJump(int Index) const;
|
||||
int IsNoLaser(int x, int y) const;
|
||||
int IsFNoLaser(int x, int y) const;
|
||||
|
|
|
@ -3207,11 +3207,11 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
std::shared_ptr<CLayerTiles> pBrushLayer = std::static_pointer_cast<CLayerTiles>(m_pBrush->m_vpLayers[BrushIndex]);
|
||||
|
||||
if(pLayer->m_Tele <= pBrushLayer->m_Tele && pLayer->m_Speedup <= pBrushLayer->m_Speedup && pLayer->m_Front <= pBrushLayer->m_Front && pLayer->m_Game <= pBrushLayer->m_Game && pLayer->m_Switch <= pBrushLayer->m_Switch && pLayer->m_Tune <= pBrushLayer->m_Tune)
|
||||
pLayer->BrushDraw(pBrushLayer, wx, wy);
|
||||
pLayer->BrushDraw(pBrushLayer, vec2(wx, wy));
|
||||
}
|
||||
else
|
||||
{
|
||||
apEditLayers[k].second->BrushDraw(m_pBrush->m_vpLayers[BrushIndex], wx, wy);
|
||||
apEditLayers[k].second->BrushDraw(m_pBrush->m_vpLayers[BrushIndex], vec2(wx, wy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3304,7 +3304,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
BrushIndex = 0;
|
||||
|
||||
if(apEditLayers[k].second->m_Type == m_pBrush->m_vpLayers[BrushIndex]->m_Type)
|
||||
apEditLayers[k].second->BrushPlace(m_pBrush->m_vpLayers[BrushIndex], wx, wy);
|
||||
apEditLayers[k].second->BrushPlace(m_pBrush->m_vpLayers[BrushIndex], vec2(wx, wy));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5915,14 +5915,14 @@ float CEditor::EnvelopeToScreenY(const CUIRect &View, float y) const
|
|||
return View.y + View.h - y / m_ZoomEnvelopeY.GetValue() * View.h - m_OffsetEnvelopeY * View.h;
|
||||
}
|
||||
|
||||
float CEditor::ScreenToEnvelopeDX(const CUIRect &View, float dx)
|
||||
float CEditor::ScreenToEnvelopeDX(const CUIRect &View, float DeltaX)
|
||||
{
|
||||
return dx / Graphics()->ScreenWidth() * Ui()->Screen()->w / View.w * m_ZoomEnvelopeX.GetValue();
|
||||
return DeltaX / Graphics()->ScreenWidth() * Ui()->Screen()->w / View.w * m_ZoomEnvelopeX.GetValue();
|
||||
}
|
||||
|
||||
float CEditor::ScreenToEnvelopeDY(const CUIRect &View, float dy)
|
||||
float CEditor::ScreenToEnvelopeDY(const CUIRect &View, float DeltaY)
|
||||
{
|
||||
return dy / Graphics()->ScreenHeight() * Ui()->Screen()->h / View.h * m_ZoomEnvelopeY.GetValue();
|
||||
return DeltaY / Graphics()->ScreenHeight() * Ui()->Screen()->h / View.h * m_ZoomEnvelopeY.GetValue();
|
||||
}
|
||||
|
||||
void CEditor::RemoveTimeOffsetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope)
|
||||
|
|
|
@ -850,9 +850,9 @@ public:
|
|||
void DoMapSettingsEditBox(CMapSettingsBackend::CContext *pContext, const CUIRect *pRect, float FontSize, float DropdownMaxHeight, int Corners = IGraphics::CORNER_ALL, const char *pToolTip = nullptr);
|
||||
|
||||
template<typename T>
|
||||
int DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &fnMatchCallback);
|
||||
int DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback);
|
||||
template<typename T>
|
||||
int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &fnMatchCallback);
|
||||
int RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback);
|
||||
|
||||
void RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture, float Size, float Brightness) const;
|
||||
|
||||
|
@ -1121,8 +1121,8 @@ public:
|
|||
float EnvelopeToScreenX(const CUIRect &View, float x) const;
|
||||
float ScreenToEnvelopeY(const CUIRect &View, float y) const;
|
||||
float EnvelopeToScreenY(const CUIRect &View, float y) const;
|
||||
float ScreenToEnvelopeDX(const CUIRect &View, float dx);
|
||||
float ScreenToEnvelopeDY(const CUIRect &View, float dy);
|
||||
float ScreenToEnvelopeDX(const CUIRect &View, float DeltaX);
|
||||
float ScreenToEnvelopeDY(const CUIRect &View, float DeltaY);
|
||||
|
||||
// DDRace
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ void CEditor::DoMapSettingsEditBox(CMapSettingsBackend::CContext *pContext, cons
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
int CEditor::DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &fnMatchCallback)
|
||||
int CEditor::DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *pLineInput, const CUIRect *pEditBoxRect, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback)
|
||||
{
|
||||
// Do an edit box with a possible dropdown
|
||||
// This is a generic method which can display any data we want
|
||||
|
@ -439,7 +439,7 @@ int CEditor::DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *p
|
|||
pDropdown->m_Selected %= vData.size();
|
||||
}
|
||||
|
||||
int Selected = RenderEditBoxDropdown<T>(pDropdown, *pEditBoxRect, pLineInput, x, MaxHeight, AutoWidth, vData, fnMatchCallback);
|
||||
int Selected = RenderEditBoxDropdown<T>(pDropdown, *pEditBoxRect, pLineInput, x, MaxHeight, AutoWidth, vData, pfnMatchCallback);
|
||||
if(Selected != -1)
|
||||
pDropdown->m_Selected = Selected;
|
||||
|
||||
|
@ -460,7 +460,7 @@ int CEditor::DoEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CLineInput *p
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
int CEditor::RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &fnMatchCallback)
|
||||
int CEditor::RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect View, CLineInput *pLineInput, int x, float MaxHeight, bool AutoWidth, const std::vector<T> &vData, const FDropdownRenderCallback<T> &pfnMatchCallback)
|
||||
{
|
||||
// Render a dropdown tied to an edit box/line input
|
||||
auto *pListBox = &pDropdown->m_ListBox;
|
||||
|
@ -506,7 +506,7 @@ int CEditor::RenderEditBoxDropdown(SEditBoxDropdownContext *pDropdown, CUIRect V
|
|||
|
||||
// Call the callback to fill the current line string
|
||||
char aBuf[128];
|
||||
fnMatchCallback(vData.at(i), aBuf, Props.m_vColorSplits);
|
||||
pfnMatchCallback(vData.at(i), aBuf, Props.m_vColorSplits);
|
||||
|
||||
LargestWidth = maximum(LargestWidth, TextRender()->TextWidth(12.0f, aBuf) + 10.0f);
|
||||
if(!Item.m_Visible)
|
||||
|
|
|
@ -46,8 +46,8 @@ public:
|
|||
virtual void BrushSelecting(CUIRect Rect) {}
|
||||
virtual int BrushGrab(std::shared_ptr<CLayerGroup> pBrush, CUIRect Rect) { return 0; }
|
||||
virtual void FillSelection(bool Empty, std::shared_ptr<CLayer> pBrush, CUIRect Rect) {}
|
||||
virtual void BrushDraw(std::shared_ptr<CLayer> pBrush, float x, float y) {}
|
||||
virtual void BrushPlace(std::shared_ptr<CLayer> pBrush, float x, float y) {}
|
||||
virtual void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) {}
|
||||
virtual void BrushPlace(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) {}
|
||||
virtual void BrushFlipX() {}
|
||||
virtual void BrushFlipY() {}
|
||||
virtual void BrushRotate(float Amount) {}
|
||||
|
|
|
@ -138,7 +138,7 @@ int CLayerQuads::BrushGrab(std::shared_ptr<CLayerGroup> pBrush, CUIRect Rect)
|
|||
return pGrabbed->m_vQuads.empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
void CLayerQuads::BrushPlace(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerQuads::BrushPlace(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
std::shared_ptr<CLayerQuads> pQuadLayer = std::static_pointer_cast<CLayerQuads>(pBrush);
|
||||
std::vector<CQuad> vAddedQuads;
|
||||
|
@ -148,8 +148,8 @@ void CLayerQuads::BrushPlace(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
|||
|
||||
for(auto &Point : n.m_aPoints)
|
||||
{
|
||||
Point.x += f2fx(wx);
|
||||
Point.y += f2fx(wy);
|
||||
Point.x += f2fx(WorldPos.x);
|
||||
Point.y += f2fx(WorldPos.y);
|
||||
}
|
||||
|
||||
m_vQuads.push_back(n);
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
|
||||
void BrushSelecting(CUIRect Rect) override;
|
||||
int BrushGrab(std::shared_ptr<CLayerGroup> pBrush, CUIRect Rect) override;
|
||||
void BrushPlace(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushPlace(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
void BrushFlipX() override;
|
||||
void BrushFlipY() override;
|
||||
void BrushRotate(float Amount) override;
|
||||
|
|
|
@ -150,7 +150,7 @@ int CLayerSounds::BrushGrab(std::shared_ptr<CLayerGroup> pBrush, CUIRect Rect)
|
|||
return pGrabbed->m_vSources.empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
void CLayerSounds::BrushPlace(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerSounds::BrushPlace(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
std::shared_ptr<CLayerSounds> pSoundLayer = std::static_pointer_cast<CLayerSounds>(pBrush);
|
||||
std::vector<CSoundSource> vAddedSources;
|
||||
|
@ -158,8 +158,8 @@ void CLayerSounds::BrushPlace(std::shared_ptr<CLayer> pBrush, float wx, float wy
|
|||
{
|
||||
CSoundSource n = Source;
|
||||
|
||||
n.m_Position.x += f2fx(wx);
|
||||
n.m_Position.y += f2fx(wy);
|
||||
n.m_Position.x += f2fx(WorldPos.x);
|
||||
n.m_Position.y += f2fx(WorldPos.y);
|
||||
|
||||
m_vSources.push_back(n);
|
||||
vAddedSources.push_back(n);
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
void BrushSelecting(CUIRect Rect) override;
|
||||
int BrushGrab(std::shared_ptr<CLayerGroup> pBrush, CUIRect Rect) override;
|
||||
void BrushPlace(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushPlace(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
|
||||
CUi::EPopupMenuFunctionResult RenderProperties(CUIRect *pToolbox) override;
|
||||
|
||||
|
|
|
@ -65,14 +65,14 @@ bool CLayerSpeedup::IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CLayerSpeedup::BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerSpeedup::BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
if(m_Readonly)
|
||||
return;
|
||||
|
||||
std::shared_ptr<CLayerSpeedup> pSpeedupLayer = std::static_pointer_cast<CLayerSpeedup>(pBrush);
|
||||
int sx = ConvertX(wx);
|
||||
int sy = ConvertY(wy);
|
||||
int sx = ConvertX(WorldPos.x);
|
||||
int sy = ConvertY(WorldPos.y);
|
||||
if(str_comp(pSpeedupLayer->m_aFileName, m_pEditor->m_aFileName))
|
||||
{
|
||||
m_pEditor->m_SpeedupAngle = pSpeedupLayer->m_SpeedupAngle;
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
void Resize(int NewW, int NewH) override;
|
||||
void Shift(int Direction) override;
|
||||
bool IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
void BrushFlipX() override;
|
||||
void BrushFlipY() override;
|
||||
void BrushRotate(float Amount) override;
|
||||
|
|
|
@ -67,14 +67,14 @@ bool CLayerSwitch::IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CLayerSwitch::BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerSwitch::BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
if(m_Readonly)
|
||||
return;
|
||||
|
||||
std::shared_ptr<CLayerSwitch> pSwitchLayer = std::static_pointer_cast<CLayerSwitch>(pBrush);
|
||||
int sx = ConvertX(wx);
|
||||
int sy = ConvertY(wy);
|
||||
int sx = ConvertX(WorldPos.x);
|
||||
int sy = ConvertY(WorldPos.y);
|
||||
if(str_comp(pSwitchLayer->m_aFileName, m_pEditor->m_aFileName))
|
||||
{
|
||||
m_pEditor->m_SwitchNum = pSwitchLayer->m_SwitchNumber;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void Resize(int NewW, int NewH) override;
|
||||
void Shift(int Direction) override;
|
||||
bool IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
void BrushFlipX() override;
|
||||
void BrushFlipY() override;
|
||||
void BrushRotate(float Amount) override;
|
||||
|
|
|
@ -68,14 +68,14 @@ bool CLayerTele::IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CLayerTele::BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerTele::BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
if(m_Readonly)
|
||||
return;
|
||||
|
||||
std::shared_ptr<CLayerTele> pTeleLayer = std::static_pointer_cast<CLayerTele>(pBrush);
|
||||
int sx = ConvertX(wx);
|
||||
int sy = ConvertY(wy);
|
||||
int sx = ConvertX(WorldPos.x);
|
||||
int sy = ConvertY(WorldPos.y);
|
||||
if(str_comp(pTeleLayer->m_aFileName, m_pEditor->m_aFileName))
|
||||
m_pEditor->m_TeleNumber = pTeleLayer->m_TeleNum;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
void Resize(int NewW, int NewH) override;
|
||||
void Shift(int Direction) override;
|
||||
bool IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
void BrushFlipX() override;
|
||||
void BrushFlipY() override;
|
||||
void BrushRotate(float Amount) override;
|
||||
|
|
|
@ -487,15 +487,15 @@ void CLayerTiles::FillSelection(bool Empty, std::shared_ptr<CLayer> pBrush, CUIR
|
|||
FlagModified(sx, sy, w, h);
|
||||
}
|
||||
|
||||
void CLayerTiles::BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerTiles::BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
if(m_Readonly)
|
||||
return;
|
||||
|
||||
//
|
||||
std::shared_ptr<CLayerTiles> pTileLayer = std::static_pointer_cast<CLayerTiles>(pBrush);
|
||||
int sx = ConvertX(wx);
|
||||
int sy = ConvertY(wy);
|
||||
int sx = ConvertX(WorldPos.x);
|
||||
int sy = ConvertY(WorldPos.y);
|
||||
|
||||
bool Destructive = m_pEditor->m_BrushDrawDestructive || IsEmpty(pTileLayer);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
void FillSelection(bool Empty, std::shared_ptr<CLayer> pBrush, CUIRect Rect) override;
|
||||
void FillGameTiles(EGameTileOp Fill);
|
||||
bool CanFillGameTiles() const;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
void BrushFlipX() override;
|
||||
void BrushFlipY() override;
|
||||
void BrushRotate(float Amount) override;
|
||||
|
|
|
@ -65,14 +65,14 @@ bool CLayerTune::IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer)
|
|||
return true;
|
||||
}
|
||||
|
||||
void CLayerTune::BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy)
|
||||
void CLayerTune::BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos)
|
||||
{
|
||||
if(m_Readonly)
|
||||
return;
|
||||
|
||||
std::shared_ptr<CLayerTune> pTuneLayer = std::static_pointer_cast<CLayerTune>(pBrush);
|
||||
int sx = ConvertX(wx);
|
||||
int sy = ConvertY(wy);
|
||||
int sx = ConvertX(WorldPos.x);
|
||||
int sy = ConvertY(WorldPos.y);
|
||||
if(str_comp(pTuneLayer->m_aFileName, m_pEditor->m_aFileName))
|
||||
{
|
||||
m_pEditor->m_TuningNum = pTuneLayer->m_TuningNumber;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
void Resize(int NewW, int NewH) override;
|
||||
void Shift(int Direction) override;
|
||||
bool IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
|
||||
void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) override;
|
||||
void BrushFlipX() override;
|
||||
void BrushFlipY() override;
|
||||
void BrushRotate(float Amount) override;
|
||||
|
|
Loading…
Reference in a new issue