mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5391
5391: Format vector variables names (fixes #5209) r=Jupeyy a=Chairn ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Chairn <chairn.nq@hotmail.fr>
This commit is contained in:
commit
47b9bccd38
|
@ -179,23 +179,23 @@ std::unique_ptr<ILogger> log_logger_android()
|
|||
|
||||
class CLoggerCollection : public ILogger
|
||||
{
|
||||
std::vector<std::shared_ptr<ILogger>> m_apLoggers;
|
||||
std::vector<std::shared_ptr<ILogger>> m_vpLoggers;
|
||||
|
||||
public:
|
||||
CLoggerCollection(std::vector<std::shared_ptr<ILogger>> &&apLoggers) :
|
||||
m_apLoggers(std::move(apLoggers))
|
||||
CLoggerCollection(std::vector<std::shared_ptr<ILogger>> &&vpLoggers) :
|
||||
m_vpLoggers(std::move(vpLoggers))
|
||||
{
|
||||
}
|
||||
void Log(const CLogMessage *pMessage) override
|
||||
{
|
||||
for(auto &pLogger : m_apLoggers)
|
||||
for(auto &pLogger : m_vpLoggers)
|
||||
{
|
||||
pLogger->Log(pMessage);
|
||||
}
|
||||
}
|
||||
void GlobalFinish() override
|
||||
{
|
||||
for(auto &pLogger : m_apLoggers)
|
||||
for(auto &pLogger : m_vpLoggers)
|
||||
{
|
||||
pLogger->GlobalFinish();
|
||||
}
|
||||
|
@ -453,12 +453,12 @@ void CFutureLogger::Set(std::unique_ptr<ILogger> &&pLogger)
|
|||
{
|
||||
dbg_assert(false, "future logger has already been set and can only be set once");
|
||||
}
|
||||
for(const auto &Pending : m_aPending)
|
||||
for(const auto &Pending : m_vPending)
|
||||
{
|
||||
pLoggerRaw->Log(&Pending);
|
||||
}
|
||||
m_aPending.clear();
|
||||
m_aPending.shrink_to_fit();
|
||||
m_vPending.clear();
|
||||
m_vPending.shrink_to_fit();
|
||||
m_PendingLock.unlock();
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ void CFutureLogger::Log(const CLogMessage *pMessage)
|
|||
return;
|
||||
}
|
||||
m_PendingLock.lock();
|
||||
m_aPending.push_back(*pMessage);
|
||||
m_vPending.push_back(*pMessage);
|
||||
m_PendingLock.unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ class CFutureLogger : public ILogger
|
|||
{
|
||||
private:
|
||||
std::atomic<ILogger *> m_pLogger;
|
||||
std::vector<CLogMessage> m_aPending;
|
||||
std::vector<CLogMessage> m_vPending;
|
||||
std::mutex m_PendingLock;
|
||||
|
||||
public:
|
||||
|
|
|
@ -19,7 +19,7 @@ CGLSLCompiler::CGLSLCompiler(int OpenGLVersionMajor, int OpenGLVersionMinor, int
|
|||
|
||||
void CGLSLCompiler::AddDefine(const std::string &DefineName, const std::string &DefineValue)
|
||||
{
|
||||
m_Defines.emplace_back(SGLSLCompilerDefine(DefineName, DefineValue));
|
||||
m_vDefines.emplace_back(SGLSLCompilerDefine(DefineName, DefineValue));
|
||||
}
|
||||
|
||||
void CGLSLCompiler::AddDefine(const char *pDefineName, const char *pDefineValue)
|
||||
|
@ -29,7 +29,7 @@ void CGLSLCompiler::AddDefine(const char *pDefineName, const char *pDefineValue)
|
|||
|
||||
void CGLSLCompiler::ClearDefines()
|
||||
{
|
||||
m_Defines.clear();
|
||||
m_vDefines.clear();
|
||||
}
|
||||
|
||||
void CGLSLCompiler::ParseLine(std::string &Line, const char *pReadLine, EGLSLShaderCompilerType Type)
|
||||
|
|
|
@ -26,7 +26,7 @@ private:
|
|||
std::string m_DefineValue;
|
||||
};
|
||||
|
||||
std::vector<SGLSLCompilerDefine> m_Defines;
|
||||
std::vector<SGLSLCompilerDefine> m_vDefines;
|
||||
|
||||
int m_OpenGLVersionMajor;
|
||||
int m_OpenGLVersionMinor;
|
||||
|
|
|
@ -65,7 +65,7 @@ size_t CCommandProcessorFragment_OpenGL::GLFormatToImageColorChannelCount(int GL
|
|||
|
||||
bool CCommandProcessorFragment_OpenGL::IsTexturedState(const CCommandBuffer::SState &State)
|
||||
{
|
||||
return State.m_Texture >= 0 && State.m_Texture < (int)m_Textures.size();
|
||||
return State.m_Texture >= 0 && State.m_Texture < (int)m_vTextures.size();
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL::SetState(const CCommandBuffer::SState &State, bool Use2DArrayTextures)
|
||||
|
@ -126,9 +126,9 @@ void CCommandProcessorFragment_OpenGL::SetState(const CCommandBuffer::SState &St
|
|||
if(!Use2DArrayTextures)
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[State.m_Texture].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[State.m_Texture].m_Tex);
|
||||
|
||||
if(m_Textures[State.m_Texture].m_LastWrapMode != State.m_WrapMode)
|
||||
if(m_vTextures[State.m_Texture].m_LastWrapMode != State.m_WrapMode)
|
||||
{
|
||||
switch(State.m_WrapMode)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ void CCommandProcessorFragment_OpenGL::SetState(const CCommandBuffer::SState &St
|
|||
default:
|
||||
dbg_msg("render", "unknown wrapmode %d\n", State.m_WrapMode);
|
||||
};
|
||||
m_Textures[State.m_Texture].m_LastWrapMode = State.m_WrapMode;
|
||||
m_vTextures[State.m_Texture].m_LastWrapMode = State.m_WrapMode;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -152,13 +152,13 @@ void CCommandProcessorFragment_OpenGL::SetState(const CCommandBuffer::SState &St
|
|||
{
|
||||
if(!m_HasShaders)
|
||||
glEnable(m_2DArrayTarget);
|
||||
glBindTexture(m_2DArrayTarget, m_Textures[State.m_Texture].m_Tex2DArray);
|
||||
glBindTexture(m_2DArrayTarget, m_vTextures[State.m_Texture].m_Tex2DArray);
|
||||
}
|
||||
else if(m_Has3DTextures)
|
||||
{
|
||||
if(!m_HasShaders)
|
||||
glEnable(GL_TEXTURE_3D);
|
||||
glBindTexture(GL_TEXTURE_3D, m_Textures[State.m_Texture].m_Tex2DArray);
|
||||
glBindTexture(GL_TEXTURE_3D, m_vTextures[State.m_Texture].m_Tex2DArray);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -633,12 +633,12 @@ bool CCommandProcessorFragment_OpenGL::Cmd_Init(const SCommand_Init *pCommand)
|
|||
|
||||
void CCommandProcessorFragment_OpenGL::TextureUpdate(int Slot, int X, int Y, int Width, int Height, int GLFormat, void *pTexData)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[Slot].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[Slot].m_Tex);
|
||||
|
||||
if(!m_HasNPOTTextures)
|
||||
{
|
||||
float ResizeW = m_Textures[Slot].m_ResizeWidth;
|
||||
float ResizeH = m_Textures[Slot].m_ResizeHeight;
|
||||
float ResizeW = m_vTextures[Slot].m_ResizeWidth;
|
||||
float ResizeH = m_vTextures[Slot].m_ResizeHeight;
|
||||
if(ResizeW > 0 && ResizeH > 0)
|
||||
{
|
||||
int ResizedW = (int)(Width * ResizeW);
|
||||
|
@ -653,11 +653,11 @@ void CCommandProcessorFragment_OpenGL::TextureUpdate(int Slot, int X, int Y, int
|
|||
}
|
||||
}
|
||||
|
||||
if(m_Textures[Slot].m_RescaleCount > 0)
|
||||
if(m_vTextures[Slot].m_RescaleCount > 0)
|
||||
{
|
||||
int OldWidth = Width;
|
||||
int OldHeight = Height;
|
||||
for(int i = 0; i < m_Textures[Slot].m_RescaleCount; ++i)
|
||||
for(int i = 0; i < m_vTextures[Slot].m_RescaleCount; ++i)
|
||||
{
|
||||
Width >>= 1;
|
||||
Height >>= 1;
|
||||
|
@ -682,35 +682,35 @@ void CCommandProcessorFragment_OpenGL::Cmd_Texture_Update(const CCommandBuffer::
|
|||
|
||||
void CCommandProcessorFragment_OpenGL::DestroyTexture(int Slot)
|
||||
{
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) - m_Textures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) - m_vTextures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
|
||||
if(m_Textures[Slot].m_Tex != 0)
|
||||
if(m_vTextures[Slot].m_Tex != 0)
|
||||
{
|
||||
glDeleteTextures(1, &m_Textures[Slot].m_Tex);
|
||||
glDeleteTextures(1, &m_vTextures[Slot].m_Tex);
|
||||
}
|
||||
|
||||
if(m_Textures[Slot].m_Tex2DArray != 0)
|
||||
if(m_vTextures[Slot].m_Tex2DArray != 0)
|
||||
{
|
||||
glDeleteTextures(1, &m_Textures[Slot].m_Tex2DArray);
|
||||
glDeleteTextures(1, &m_vTextures[Slot].m_Tex2DArray);
|
||||
}
|
||||
|
||||
if(IsNewApi())
|
||||
{
|
||||
if(m_Textures[Slot].m_Sampler != 0)
|
||||
if(m_vTextures[Slot].m_Sampler != 0)
|
||||
{
|
||||
glDeleteSamplers(1, &m_Textures[Slot].m_Sampler);
|
||||
glDeleteSamplers(1, &m_vTextures[Slot].m_Sampler);
|
||||
}
|
||||
if(m_Textures[Slot].m_Sampler2DArray != 0)
|
||||
if(m_vTextures[Slot].m_Sampler2DArray != 0)
|
||||
{
|
||||
glDeleteSamplers(1, &m_Textures[Slot].m_Sampler2DArray);
|
||||
glDeleteSamplers(1, &m_vTextures[Slot].m_Sampler2DArray);
|
||||
}
|
||||
}
|
||||
|
||||
m_Textures[Slot].m_Tex = 0;
|
||||
m_Textures[Slot].m_Sampler = 0;
|
||||
m_Textures[Slot].m_Tex2DArray = 0;
|
||||
m_Textures[Slot].m_Sampler2DArray = 0;
|
||||
m_Textures[Slot].m_LastWrapMode = CCommandBuffer::WRAP_REPEAT;
|
||||
m_vTextures[Slot].m_Tex = 0;
|
||||
m_vTextures[Slot].m_Sampler = 0;
|
||||
m_vTextures[Slot].m_Tex2DArray = 0;
|
||||
m_vTextures[Slot].m_Sampler2DArray = 0;
|
||||
m_vTextures[Slot].m_LastWrapMode = CCommandBuffer::WRAP_REPEAT;
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL::Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand)
|
||||
|
@ -729,11 +729,11 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_MaxTexSize);
|
||||
}
|
||||
|
||||
if(Slot >= (int)m_Textures.size())
|
||||
m_Textures.resize(m_Textures.size() * 2);
|
||||
if(Slot >= (int)m_vTextures.size())
|
||||
m_vTextures.resize(m_vTextures.size() * 2);
|
||||
|
||||
m_Textures[Slot].m_ResizeWidth = -1.f;
|
||||
m_Textures[Slot].m_ResizeHeight = -1.f;
|
||||
m_vTextures[Slot].m_ResizeWidth = -1.f;
|
||||
m_vTextures[Slot].m_ResizeHeight = -1.f;
|
||||
|
||||
if(!m_HasNPOTTextures)
|
||||
{
|
||||
|
@ -745,8 +745,8 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
free(pTexData);
|
||||
pTexData = pTmpData;
|
||||
|
||||
m_Textures[Slot].m_ResizeWidth = (float)PowerOfTwoWidth / (float)Width;
|
||||
m_Textures[Slot].m_ResizeHeight = (float)PowerOfTwoHeight / (float)Height;
|
||||
m_vTextures[Slot].m_ResizeWidth = (float)PowerOfTwoWidth / (float)Width;
|
||||
m_vTextures[Slot].m_ResizeHeight = (float)PowerOfTwoHeight / (float)Height;
|
||||
|
||||
Width = PowerOfTwoWidth;
|
||||
Height = PowerOfTwoHeight;
|
||||
|
@ -778,17 +778,17 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
pTexData = pTmpData;
|
||||
}
|
||||
}
|
||||
m_Textures[Slot].m_Width = Width;
|
||||
m_Textures[Slot].m_Height = Height;
|
||||
m_Textures[Slot].m_RescaleCount = RescaleCount;
|
||||
m_vTextures[Slot].m_Width = Width;
|
||||
m_vTextures[Slot].m_Height = Height;
|
||||
m_vTextures[Slot].m_RescaleCount = RescaleCount;
|
||||
|
||||
int Oglformat = GLFormat;
|
||||
int StoreOglformat = GLStoreFormat;
|
||||
|
||||
if((Flags & CCommandBuffer::TEXFLAG_NO_2D_TEXTURE) == 0)
|
||||
{
|
||||
glGenTextures(1, &m_Textures[Slot].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[Slot].m_Tex);
|
||||
glGenTextures(1, &m_vTextures[Slot].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[Slot].m_Tex);
|
||||
}
|
||||
|
||||
if(Flags & CCommandBuffer::TEXFLAG_NOMIPMAPS || !m_HasMipMaps)
|
||||
|
@ -822,7 +822,7 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
{
|
||||
bool Is3DTexture = (Flags & Flag3DTexture) != 0;
|
||||
|
||||
glGenTextures(1, &m_Textures[Slot].m_Tex2DArray);
|
||||
glGenTextures(1, &m_vTextures[Slot].m_Tex2DArray);
|
||||
|
||||
GLenum Target = GL_TEXTURE_3D;
|
||||
|
||||
|
@ -835,12 +835,12 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
Target = m_2DArrayTarget;
|
||||
}
|
||||
|
||||
glBindTexture(Target, m_Textures[Slot].m_Tex2DArray);
|
||||
glBindTexture(Target, m_vTextures[Slot].m_Tex2DArray);
|
||||
|
||||
if(IsNewApi())
|
||||
{
|
||||
glGenSamplers(1, &m_Textures[Slot].m_Sampler2DArray);
|
||||
glBindSampler(0, m_Textures[Slot].m_Sampler2DArray);
|
||||
glGenSamplers(1, &m_vTextures[Slot].m_Sampler2DArray);
|
||||
glBindSampler(0, m_vTextures[Slot].m_Sampler2DArray);
|
||||
}
|
||||
|
||||
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
@ -848,14 +848,14 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
{
|
||||
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
if(IsNewApi())
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glTexParameteri(Target, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
if(IsNewApi())
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
}
|
||||
|
||||
glTexParameteri(Target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
|
@ -869,13 +869,13 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
|
||||
if(IsNewApi())
|
||||
{
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
|
||||
|
||||
#ifndef BACKEND_AS_OPENGL_ES
|
||||
if(m_OpenGLTextureLodBIAS != 0 && !m_IsOpenGLES)
|
||||
glSamplerParameterf(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_LOD_BIAS, ((GLfloat)m_OpenGLTextureLodBIAS / 1000.0f));
|
||||
glSamplerParameterf(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_LOD_BIAS, ((GLfloat)m_OpenGLTextureLodBIAS / 1000.0f));
|
||||
#endif
|
||||
|
||||
glBindSampler(0, 0);
|
||||
|
@ -929,17 +929,17 @@ void CCommandProcessorFragment_OpenGL::TextureCreate(int Slot, int Width, int He
|
|||
}
|
||||
|
||||
// This is the initial value for the wrap modes
|
||||
m_Textures[Slot].m_LastWrapMode = CCommandBuffer::WRAP_REPEAT;
|
||||
m_vTextures[Slot].m_LastWrapMode = CCommandBuffer::WRAP_REPEAT;
|
||||
|
||||
// calculate memory usage
|
||||
m_Textures[Slot].m_MemSize = Width * Height * PixelSize;
|
||||
m_vTextures[Slot].m_MemSize = Width * Height * PixelSize;
|
||||
while(Width > 2 && Height > 2)
|
||||
{
|
||||
Width >>= 1;
|
||||
Height >>= 1;
|
||||
m_Textures[Slot].m_MemSize += Width * Height * PixelSize;
|
||||
m_vTextures[Slot].m_MemSize += Width * Height * PixelSize;
|
||||
}
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) + m_Textures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) + m_vTextures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
|
||||
free(pTexData);
|
||||
#endif
|
||||
|
@ -1050,7 +1050,7 @@ void CCommandProcessorFragment_OpenGL::Cmd_Screenshot(const CCommandBuffer::SCom
|
|||
|
||||
CCommandProcessorFragment_OpenGL::CCommandProcessorFragment_OpenGL()
|
||||
{
|
||||
m_Textures.resize(CCommandBuffer::MAX_TEXTURES);
|
||||
m_vTextures.resize(CCommandBuffer::MAX_TEXTURES);
|
||||
m_HasShaders = false;
|
||||
}
|
||||
|
||||
|
@ -1135,13 +1135,13 @@ void CCommandProcessorFragment_OpenGL2::UseProgram(CGLSLTWProgram *pProgram)
|
|||
|
||||
bool CCommandProcessorFragment_OpenGL2::IsAndUpdateTextureSlotBound(int IDX, int Slot, bool Is2DArray)
|
||||
{
|
||||
if(m_TextureSlotBoundToUnit[IDX].m_TextureSlot == Slot && m_TextureSlotBoundToUnit[IDX].m_Is2DArray == Is2DArray)
|
||||
if(m_vTextureSlotBoundToUnit[IDX].m_TextureSlot == Slot && m_vTextureSlotBoundToUnit[IDX].m_Is2DArray == Is2DArray)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
// the texture slot uses this index now
|
||||
m_TextureSlotBoundToUnit[IDX].m_TextureSlot = Slot;
|
||||
m_TextureSlotBoundToUnit[IDX].m_Is2DArray = Is2DArray;
|
||||
m_vTextureSlotBoundToUnit[IDX].m_TextureSlot = Slot;
|
||||
m_vTextureSlotBoundToUnit[IDX].m_Is2DArray = Is2DArray;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1218,15 +1218,15 @@ void CCommandProcessorFragment_OpenGL2::SetState(const CCommandBuffer::SState &S
|
|||
glActiveTexture(GL_TEXTURE0 + Slot);
|
||||
if(!Use2DArrayTextures)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[State.m_Texture].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[State.m_Texture].m_Tex);
|
||||
if(IsNewApi())
|
||||
glBindSampler(Slot, m_Textures[State.m_Texture].m_Sampler);
|
||||
glBindSampler(Slot, m_vTextures[State.m_Texture].m_Sampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, m_Textures[State.m_Texture].m_Tex2DArray);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, m_vTextures[State.m_Texture].m_Tex2DArray);
|
||||
if(IsNewApi())
|
||||
glBindSampler(Slot, m_Textures[State.m_Texture].m_Sampler2DArray);
|
||||
glBindSampler(Slot, m_vTextures[State.m_Texture].m_Sampler2DArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1237,9 +1237,9 @@ void CCommandProcessorFragment_OpenGL2::SetState(const CCommandBuffer::SState &S
|
|||
{
|
||||
if(!IsNewApi() && !m_HasShaders)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[State.m_Texture].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[State.m_Texture].m_Tex);
|
||||
if(IsNewApi())
|
||||
glBindSampler(Slot, m_Textures[State.m_Texture].m_Sampler);
|
||||
glBindSampler(Slot, m_vTextures[State.m_Texture].m_Sampler);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1247,17 +1247,17 @@ void CCommandProcessorFragment_OpenGL2::SetState(const CCommandBuffer::SState &S
|
|||
{
|
||||
if(!IsNewApi() && !m_HasShaders)
|
||||
glEnable(GL_TEXTURE_3D);
|
||||
glBindTexture(GL_TEXTURE_3D, m_Textures[State.m_Texture].m_Tex2DArray);
|
||||
glBindTexture(GL_TEXTURE_3D, m_vTextures[State.m_Texture].m_Tex2DArray);
|
||||
if(IsNewApi())
|
||||
glBindSampler(Slot, m_Textures[State.m_Texture].m_Sampler2DArray);
|
||||
glBindSampler(Slot, m_vTextures[State.m_Texture].m_Sampler2DArray);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!IsNewApi() && !m_HasShaders)
|
||||
glEnable(m_2DArrayTarget);
|
||||
glBindTexture(m_2DArrayTarget, m_Textures[State.m_Texture].m_Tex2DArray);
|
||||
glBindTexture(m_2DArrayTarget, m_vTextures[State.m_Texture].m_Tex2DArray);
|
||||
if(IsNewApi())
|
||||
glBindSampler(Slot, m_Textures[State.m_Texture].m_Sampler2DArray);
|
||||
glBindSampler(Slot, m_vTextures[State.m_Texture].m_Sampler2DArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1268,28 +1268,28 @@ void CCommandProcessorFragment_OpenGL2::SetState(const CCommandBuffer::SState &S
|
|||
pProgram->m_LastTextureSampler = Slot;
|
||||
}
|
||||
|
||||
if(m_Textures[State.m_Texture].m_LastWrapMode != State.m_WrapMode && !Use2DArrayTextures)
|
||||
if(m_vTextures[State.m_Texture].m_LastWrapMode != State.m_WrapMode && !Use2DArrayTextures)
|
||||
{
|
||||
switch(State.m_WrapMode)
|
||||
{
|
||||
case CCommandBuffer::WRAP_REPEAT:
|
||||
if(IsNewApi())
|
||||
{
|
||||
glSamplerParameteri(m_Textures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glSamplerParameteri(m_Textures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glSamplerParameteri(m_vTextures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glSamplerParameteri(m_vTextures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
break;
|
||||
case CCommandBuffer::WRAP_CLAMP:
|
||||
if(IsNewApi())
|
||||
{
|
||||
glSamplerParameteri(m_Textures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_Textures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_vTextures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_vTextures[State.m_Texture].m_Sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dbg_msg("render", "unknown wrapmode %d\n", State.m_WrapMode);
|
||||
};
|
||||
m_Textures[State.m_Texture].m_LastWrapMode = State.m_WrapMode;
|
||||
m_vTextures[State.m_Texture].m_LastWrapMode = State.m_WrapMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1874,11 +1874,11 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CreateBufferObject(const CCommandBuf
|
|||
void *pUploadData = pCommand->m_pUploadData;
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
// create necessary space
|
||||
if((size_t)Index >= m_BufferObjectIndices.size())
|
||||
if((size_t)Index >= m_vBufferObjectIndices.size())
|
||||
{
|
||||
for(int i = m_BufferObjectIndices.size(); i < Index + 1; ++i)
|
||||
for(int i = m_vBufferObjectIndices.size(); i < Index + 1; ++i)
|
||||
{
|
||||
m_BufferObjectIndices.emplace_back(0);
|
||||
m_vBufferObjectIndices.emplace_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1892,7 +1892,7 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CreateBufferObject(const CCommandBuf
|
|||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[Index];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[Index];
|
||||
BufferObject.m_BufferObjectID = VertBufferID;
|
||||
BufferObject.m_DataSize = pCommand->m_DataSize;
|
||||
BufferObject.m_pData = malloc(pCommand->m_DataSize);
|
||||
|
@ -1907,7 +1907,7 @@ void CCommandProcessorFragment_OpenGL2::Cmd_RecreateBufferObject(const CCommandB
|
|||
{
|
||||
void *pUploadData = pCommand->m_pUploadData;
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[Index];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[Index];
|
||||
|
||||
if(m_HasShaders)
|
||||
{
|
||||
|
@ -1930,7 +1930,7 @@ void CCommandProcessorFragment_OpenGL2::Cmd_UpdateBufferObject(const CCommandBuf
|
|||
{
|
||||
void *pUploadData = pCommand->m_pUploadData;
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[Index];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[Index];
|
||||
|
||||
if(m_HasShaders)
|
||||
{
|
||||
|
@ -1951,8 +1951,8 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CopyBufferObject(const CCommandBuffe
|
|||
int WriteIndex = pCommand->m_WriteBufferIndex;
|
||||
int ReadIndex = pCommand->m_ReadBufferIndex;
|
||||
|
||||
SBufferObject &ReadBufferObject = m_BufferObjectIndices[ReadIndex];
|
||||
SBufferObject &WriteBufferObject = m_BufferObjectIndices[WriteIndex];
|
||||
SBufferObject &ReadBufferObject = m_vBufferObjectIndices[ReadIndex];
|
||||
SBufferObject &WriteBufferObject = m_vBufferObjectIndices[WriteIndex];
|
||||
|
||||
mem_copy(((uint8_t *)WriteBufferObject.m_pData) + (ptrdiff_t)pCommand->m_pWriteOffset, ((uint8_t *)ReadBufferObject.m_pData) + (ptrdiff_t)pCommand->m_pReadOffset, pCommand->m_CopySize);
|
||||
|
||||
|
@ -1967,7 +1967,7 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CopyBufferObject(const CCommandBuffe
|
|||
void CCommandProcessorFragment_OpenGL2::Cmd_DeleteBufferObject(const CCommandBuffer::SCommand_DeleteBufferObject *pCommand)
|
||||
{
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[Index];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[Index];
|
||||
|
||||
if(m_HasShaders)
|
||||
{
|
||||
|
@ -1982,23 +1982,23 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CreateBufferContainer(const CCommand
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// create necessary space
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
{
|
||||
for(int i = m_BufferContainers.size(); i < Index + 1; ++i)
|
||||
for(int i = m_vBufferContainers.size(); i < Index + 1; ++i)
|
||||
{
|
||||
SBufferContainer Container;
|
||||
Container.m_ContainerInfo.m_Stride = 0;
|
||||
Container.m_ContainerInfo.m_VertBufferBindingIndex = -1;
|
||||
m_BufferContainers.push_back(Container);
|
||||
m_vBufferContainers.push_back(Container);
|
||||
}
|
||||
}
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
|
||||
for(int i = 0; i < pCommand->m_AttrCount; ++i)
|
||||
{
|
||||
SBufferContainerInfo::SAttribute &Attr = pCommand->m_pAttributes[i];
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.push_back(Attr);
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.push_back(Attr);
|
||||
}
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_Stride = pCommand->m_Stride;
|
||||
|
@ -2007,14 +2007,14 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CreateBufferContainer(const CCommand
|
|||
|
||||
void CCommandProcessorFragment_OpenGL2::Cmd_UpdateBufferContainer(const CCommandBuffer::SCommand_UpdateBufferContainer *pCommand)
|
||||
{
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[pCommand->m_BufferContainerIndex];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[pCommand->m_BufferContainerIndex];
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.clear();
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.clear();
|
||||
|
||||
for(int i = 0; i < pCommand->m_AttrCount; ++i)
|
||||
{
|
||||
SBufferContainerInfo::SAttribute &Attr = pCommand->m_pAttributes[i];
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.push_back(Attr);
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.push_back(Attr);
|
||||
}
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_Stride = pCommand->m_Stride;
|
||||
|
@ -2023,7 +2023,7 @@ void CCommandProcessorFragment_OpenGL2::Cmd_UpdateBufferContainer(const CCommand
|
|||
|
||||
void CCommandProcessorFragment_OpenGL2::Cmd_DeleteBufferContainer(const CCommandBuffer::SCommand_DeleteBufferContainer *pCommand)
|
||||
{
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[pCommand->m_BufferContainerIndex];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[pCommand->m_BufferContainerIndex];
|
||||
|
||||
if(pCommand->m_DestroyAllBO)
|
||||
{
|
||||
|
@ -2032,15 +2032,15 @@ void CCommandProcessorFragment_OpenGL2::Cmd_DeleteBufferContainer(const CCommand
|
|||
{
|
||||
if(m_HasShaders)
|
||||
{
|
||||
glDeleteBuffers(1, &m_BufferObjectIndices[VertBufferID].m_BufferObjectID);
|
||||
glDeleteBuffers(1, &m_vBufferObjectIndices[VertBufferID].m_BufferObjectID);
|
||||
}
|
||||
|
||||
free(m_BufferObjectIndices[VertBufferID].m_pData);
|
||||
m_BufferObjectIndices[VertBufferID].m_pData = NULL;
|
||||
free(m_vBufferObjectIndices[VertBufferID].m_pData);
|
||||
m_vBufferObjectIndices[VertBufferID].m_pData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.clear();
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.clear();
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL2::Cmd_IndicesRequiredNumNotify(const CCommandBuffer::SCommand_IndicesRequiredNumNotify *pCommand)
|
||||
|
@ -2068,9 +2068,9 @@ void CCommandProcessorFragment_OpenGL2::RenderBorderTileEmulation(SBufferContain
|
|||
CCommandProcessorFragment_OpenGL::SetState(State, true);
|
||||
}
|
||||
|
||||
bool IsTextured = BufferContainer.m_ContainerInfo.m_Attributes.size() == 2;
|
||||
bool IsTextured = BufferContainer.m_ContainerInfo.m_vAttributes.size() == 2;
|
||||
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[(size_t)BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[(size_t)BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex];
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
@ -2153,9 +2153,9 @@ void CCommandProcessorFragment_OpenGL2::RenderBorderTileLineEmulation(SBufferCon
|
|||
CCommandProcessorFragment_OpenGL::SetState(State, true);
|
||||
}
|
||||
|
||||
bool IsTextured = BufferContainer.m_ContainerInfo.m_Attributes.size() == 2;
|
||||
bool IsTextured = BufferContainer.m_ContainerInfo.m_vAttributes.size() == 2;
|
||||
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[(size_t)BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[(size_t)BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex];
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
@ -2219,10 +2219,10 @@ void CCommandProcessorFragment_OpenGL2::Cmd_RenderBorderTile(const CCommandBuffe
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
|
||||
RenderBorderTileEmulation(BufferContainer, pCommand->m_State, (float *)&pCommand->m_Color, pCommand->m_pIndicesOffset, pCommand->m_DrawNum, pCommand->m_Offset, pCommand->m_Dir, pCommand->m_JumpIndex);
|
||||
}
|
||||
|
@ -2231,10 +2231,10 @@ void CCommandProcessorFragment_OpenGL2::Cmd_RenderBorderTileLine(const CCommandB
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
|
||||
RenderBorderTileLineEmulation(BufferContainer, pCommand->m_State, (float *)&pCommand->m_Color, pCommand->m_pIndicesOffset, pCommand->m_IndexDrawNum, pCommand->m_DrawNum, pCommand->m_Offset, pCommand->m_Dir);
|
||||
}
|
||||
|
@ -2243,10 +2243,10 @@ void CCommandProcessorFragment_OpenGL2::Cmd_RenderTileLayer(const CCommandBuffer
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
|
||||
if(pCommand->m_IndicesDrawNum == 0)
|
||||
{
|
||||
|
@ -2273,9 +2273,9 @@ void CCommandProcessorFragment_OpenGL2::Cmd_RenderTileLayer(const CCommandBuffer
|
|||
CCommandProcessorFragment_OpenGL::SetState(pCommand->m_State, true);
|
||||
}
|
||||
|
||||
bool IsTextured = BufferContainer.m_ContainerInfo.m_Attributes.size() == 2;
|
||||
bool IsTextured = BufferContainer.m_ContainerInfo.m_vAttributes.size() == 2;
|
||||
|
||||
SBufferObject &BufferObject = m_BufferObjectIndices[(size_t)BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex];
|
||||
SBufferObject &BufferObject = m_vBufferObjectIndices[(size_t)BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex];
|
||||
if(m_HasShaders)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, BufferObject.m_BufferObjectID);
|
||||
|
||||
|
@ -2291,11 +2291,11 @@ void CCommandProcessorFragment_OpenGL2::Cmd_RenderTileLayer(const CCommandBuffer
|
|||
if(m_HasShaders)
|
||||
{
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, false, BufferContainer.m_ContainerInfo.m_Stride, BufferContainer.m_ContainerInfo.m_Attributes[0].m_pOffset);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, false, BufferContainer.m_ContainerInfo.m_Stride, BufferContainer.m_ContainerInfo.m_vAttributes[0].m_pOffset);
|
||||
if(IsTextured)
|
||||
{
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, false, BufferContainer.m_ContainerInfo.m_Stride, BufferContainer.m_ContainerInfo.m_Attributes[1].m_pOffset);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, false, BufferContainer.m_ContainerInfo.m_Stride, BufferContainer.m_ContainerInfo.m_vAttributes[1].m_pOffset);
|
||||
}
|
||||
|
||||
for(int i = 0; i < pCommand->m_IndicesDrawNum; ++i)
|
||||
|
|
|
@ -52,7 +52,7 @@ protected:
|
|||
float m_ResizeWidth;
|
||||
float m_ResizeHeight;
|
||||
};
|
||||
std::vector<CTexture> m_Textures;
|
||||
std::vector<CTexture> m_vTextures;
|
||||
std::atomic<uint64_t> *m_pTextureMemoryUsage;
|
||||
|
||||
uint32_t m_CanvasWidth = 0;
|
||||
|
@ -140,7 +140,7 @@ class CCommandProcessorFragment_OpenGL2 : public CCommandProcessorFragment_OpenG
|
|||
{
|
||||
SBufferContainerInfo m_ContainerInfo;
|
||||
};
|
||||
std::vector<SBufferContainer> m_BufferContainers;
|
||||
std::vector<SBufferContainer> m_vBufferContainers;
|
||||
|
||||
#ifndef BACKEND_AS_OPENGL_ES
|
||||
GL_SVertexTex3D m_aStreamVertices[1024 * 4];
|
||||
|
@ -159,7 +159,7 @@ class CCommandProcessorFragment_OpenGL2 : public CCommandProcessorFragment_OpenG
|
|||
size_t m_DataSize;
|
||||
};
|
||||
|
||||
std::vector<SBufferObject> m_BufferObjectIndices;
|
||||
std::vector<SBufferObject> m_vBufferObjectIndices;
|
||||
|
||||
#ifndef BACKEND_GL_MODERN_API
|
||||
bool DoAnalyzeStep(size_t StepN, size_t CheckCount, size_t VerticesCount, uint8_t aFakeTexture[], size_t SingleImageSize);
|
||||
|
@ -210,7 +210,7 @@ protected:
|
|||
int m_TextureSlot;
|
||||
bool m_Is2DArray;
|
||||
};
|
||||
std::vector<STextureBound> m_TextureSlotBoundToUnit; // the texture index generated by loadtextureraw is stored in an index calculated by max texture units
|
||||
std::vector<STextureBound> m_vTextureSlotBoundToUnit; // the texture index generated by loadtextureraw is stored in an index calculated by max texture units
|
||||
|
||||
bool IsAndUpdateTextureSlotBound(int IDX, int Slot, bool Is2DArray = false);
|
||||
|
||||
|
|
|
@ -459,11 +459,11 @@ bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
|
|||
|
||||
// query maximum of allowed textures
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &m_MaxTextureUnits);
|
||||
m_TextureSlotBoundToUnit.resize(m_MaxTextureUnits);
|
||||
m_vTextureSlotBoundToUnit.resize(m_MaxTextureUnits);
|
||||
for(int i = 0; i < m_MaxTextureUnits; ++i)
|
||||
{
|
||||
m_TextureSlotBoundToUnit[i].m_TextureSlot = -1;
|
||||
m_TextureSlotBoundToUnit[i].m_Is2DArray = false;
|
||||
m_vTextureSlotBoundToUnit[i].m_TextureSlot = -1;
|
||||
m_vTextureSlotBoundToUnit[i].m_Is2DArray = false;
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
@ -486,7 +486,7 @@ bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
|
|||
|
||||
m_CurrentIndicesInBuffer = CCommandBuffer::MAX_VERTICES / 4 * 6;
|
||||
|
||||
m_Textures.resize(CCommandBuffer::MAX_TEXTURES);
|
||||
m_vTextures.resize(CCommandBuffer::MAX_TEXTURES);
|
||||
|
||||
m_ClearColor.r = m_ClearColor.g = m_ClearColor.b = -1.f;
|
||||
|
||||
|
@ -546,17 +546,17 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Shutdown(const SCommand_Shutdown *
|
|||
glDeleteBuffers(1, &m_PrimitiveDrawBufferIDTex3D);
|
||||
glDeleteVertexArrays(1, &m_PrimitiveDrawVertexIDTex3D);
|
||||
|
||||
for(int i = 0; i < (int)m_Textures.size(); ++i)
|
||||
for(int i = 0; i < (int)m_vTextures.size(); ++i)
|
||||
{
|
||||
DestroyTexture(i);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < m_BufferContainers.size(); ++i)
|
||||
for(size_t i = 0; i < m_vBufferContainers.size(); ++i)
|
||||
{
|
||||
DestroyBufferContainer(i);
|
||||
}
|
||||
|
||||
m_BufferContainers.clear();
|
||||
m_vBufferContainers.clear();
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::TextureUpdate(int Slot, int X, int Y, int Width, int Height, int GLFormat, void *pTexData)
|
||||
|
@ -567,14 +567,14 @@ void CCommandProcessorFragment_OpenGL3_3::TextureUpdate(int Slot, int X, int Y,
|
|||
// just tell, that we using this texture now
|
||||
IsAndUpdateTextureSlotBound(SamplerSlot, Slot);
|
||||
glActiveTexture(GL_TEXTURE0 + SamplerSlot);
|
||||
glBindSampler(SamplerSlot, m_Textures[Slot].m_Sampler);
|
||||
glBindSampler(SamplerSlot, m_vTextures[Slot].m_Sampler);
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[Slot].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[Slot].m_Tex);
|
||||
|
||||
if(m_Textures[Slot].m_RescaleCount > 0)
|
||||
if(m_vTextures[Slot].m_RescaleCount > 0)
|
||||
{
|
||||
for(int i = 0; i < m_Textures[Slot].m_RescaleCount; ++i)
|
||||
for(int i = 0; i < m_vTextures[Slot].m_RescaleCount; ++i)
|
||||
{
|
||||
Width >>= 1;
|
||||
Height >>= 1;
|
||||
|
@ -608,15 +608,15 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Destroy(const CCommandBuff
|
|||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindSampler(Slot, 0);
|
||||
m_TextureSlotBoundToUnit[Slot].m_TextureSlot = -1;
|
||||
m_TextureSlotBoundToUnit[Slot].m_Is2DArray = false;
|
||||
m_vTextureSlotBoundToUnit[Slot].m_TextureSlot = -1;
|
||||
m_vTextureSlotBoundToUnit[Slot].m_Is2DArray = false;
|
||||
DestroyTexture(pCommand->m_Slot);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int Height, int PixelSize, int GLFormat, int GLStoreFormat, int Flags, void *pTexData)
|
||||
{
|
||||
if(Slot >= (int)m_Textures.size())
|
||||
m_Textures.resize(m_Textures.size() * 2);
|
||||
if(Slot >= (int)m_vTextures.size())
|
||||
m_vTextures.resize(m_vTextures.size() * 2);
|
||||
|
||||
// resample if needed
|
||||
int RescaleCount = 0;
|
||||
|
@ -636,9 +636,9 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
|||
pTexData = pTmpData;
|
||||
}
|
||||
}
|
||||
m_Textures[Slot].m_Width = Width;
|
||||
m_Textures[Slot].m_Height = Height;
|
||||
m_Textures[Slot].m_RescaleCount = RescaleCount;
|
||||
m_vTextures[Slot].m_Width = Width;
|
||||
m_vTextures[Slot].m_Height = Height;
|
||||
m_vTextures[Slot].m_RescaleCount = RescaleCount;
|
||||
|
||||
int Oglformat = GLFormat;
|
||||
int StoreOglformat = GLStoreFormat;
|
||||
|
@ -652,17 +652,17 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
|||
// just tell, that we using this texture now
|
||||
IsAndUpdateTextureSlotBound(SamplerSlot, Slot);
|
||||
glActiveTexture(GL_TEXTURE0 + SamplerSlot);
|
||||
m_TextureSlotBoundToUnit[SamplerSlot].m_TextureSlot = -1;
|
||||
m_TextureSlotBoundToUnit[SamplerSlot].m_Is2DArray = false;
|
||||
m_vTextureSlotBoundToUnit[SamplerSlot].m_TextureSlot = -1;
|
||||
m_vTextureSlotBoundToUnit[SamplerSlot].m_Is2DArray = false;
|
||||
}
|
||||
|
||||
if((Flags & CCommandBuffer::TEXFLAG_NO_2D_TEXTURE) == 0)
|
||||
{
|
||||
glGenTextures(1, &m_Textures[Slot].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[Slot].m_Tex);
|
||||
glGenTextures(1, &m_vTextures[Slot].m_Tex);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[Slot].m_Tex);
|
||||
|
||||
glGenSamplers(1, &m_Textures[Slot].m_Sampler);
|
||||
glBindSampler(SamplerSlot, m_Textures[Slot].m_Sampler);
|
||||
glGenSamplers(1, &m_vTextures[Slot].m_Sampler);
|
||||
glBindSampler(SamplerSlot, m_vTextures[Slot].m_Sampler);
|
||||
}
|
||||
|
||||
if(Flags & CCommandBuffer::TEXFLAG_NOMIPMAPS)
|
||||
|
@ -671,8 +671,8 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
|||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, StoreOglformat, Width, Height, 0, Oglformat, GL_UNSIGNED_BYTE, pTexData);
|
||||
}
|
||||
}
|
||||
|
@ -680,12 +680,12 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
|||
{
|
||||
if((Flags & CCommandBuffer::TEXFLAG_NO_2D_TEXTURE) == 0)
|
||||
{
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
|
||||
#ifndef BACKEND_AS_OPENGL_ES
|
||||
if(m_OpenGLTextureLodBIAS != 0 && !m_IsOpenGLES)
|
||||
glSamplerParameterf(m_Textures[Slot].m_Sampler, GL_TEXTURE_LOD_BIAS, ((GLfloat)m_OpenGLTextureLodBIAS / 1000.0f));
|
||||
glSamplerParameterf(m_vTextures[Slot].m_Sampler, GL_TEXTURE_LOD_BIAS, ((GLfloat)m_OpenGLTextureLodBIAS / 1000.0f));
|
||||
#endif
|
||||
|
||||
// prevent mipmap display bugs, when zooming out far
|
||||
|
@ -700,20 +700,20 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
|||
|
||||
if((Flags & (CCommandBuffer::TEXFLAG_TO_2D_ARRAY_TEXTURE | CCommandBuffer::TEXFLAG_TO_2D_ARRAY_TEXTURE_SINGLE_LAYER)) != 0)
|
||||
{
|
||||
glGenTextures(1, &m_Textures[Slot].m_Tex2DArray);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, m_Textures[Slot].m_Tex2DArray);
|
||||
glGenTextures(1, &m_vTextures[Slot].m_Tex2DArray);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, m_vTextures[Slot].m_Tex2DArray);
|
||||
|
||||
glGenSamplers(1, &m_Textures[Slot].m_Sampler2DArray);
|
||||
glBindSampler(SamplerSlot, m_Textures[Slot].m_Sampler2DArray);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
|
||||
glGenSamplers(1, &m_vTextures[Slot].m_Sampler2DArray);
|
||||
glBindSampler(SamplerSlot, m_vTextures[Slot].m_Sampler2DArray);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
|
||||
|
||||
#ifndef BACKEND_AS_OPENGL_ES
|
||||
if(m_OpenGLTextureLodBIAS != 0 && !m_IsOpenGLES)
|
||||
glSamplerParameterf(m_Textures[Slot].m_Sampler2DArray, GL_TEXTURE_LOD_BIAS, ((GLfloat)m_OpenGLTextureLodBIAS / 1000.0f));
|
||||
glSamplerParameterf(m_vTextures[Slot].m_Sampler2DArray, GL_TEXTURE_LOD_BIAS, ((GLfloat)m_OpenGLTextureLodBIAS / 1000.0f));
|
||||
#endif
|
||||
|
||||
int ImageColorChannels = GLFormatToImageColorChannelCount(GLFormat);
|
||||
|
@ -765,17 +765,17 @@ void CCommandProcessorFragment_OpenGL3_3::TextureCreate(int Slot, int Width, int
|
|||
}
|
||||
|
||||
// This is the initial value for the wrap modes
|
||||
m_Textures[Slot].m_LastWrapMode = CCommandBuffer::WRAP_REPEAT;
|
||||
m_vTextures[Slot].m_LastWrapMode = CCommandBuffer::WRAP_REPEAT;
|
||||
|
||||
// calculate memory usage
|
||||
m_Textures[Slot].m_MemSize = Width * Height * PixelSize;
|
||||
m_vTextures[Slot].m_MemSize = Width * Height * PixelSize;
|
||||
while(Width > 2 && Height > 2)
|
||||
{
|
||||
Width >>= 1;
|
||||
Height >>= 1;
|
||||
m_Textures[Slot].m_MemSize += Width * Height * PixelSize;
|
||||
m_vTextures[Slot].m_MemSize += Width * Height * PixelSize;
|
||||
}
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) + m_Textures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
m_pTextureMemoryUsage->store(m_pTextureMemoryUsage->load(std::memory_order_relaxed) + m_vTextures[Slot].m_MemSize, std::memory_order_relaxed);
|
||||
|
||||
free(pTexData);
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderTex3D(const CCommandBuffer::
|
|||
|
||||
void CCommandProcessorFragment_OpenGL3_3::DestroyBufferContainer(int Index, bool DeleteBOs)
|
||||
{
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID != 0)
|
||||
glDeleteVertexArrays(1, &BufferContainer.m_VertArrayID);
|
||||
|
||||
|
@ -925,12 +925,12 @@ void CCommandProcessorFragment_OpenGL3_3::DestroyBufferContainer(int Index, bool
|
|||
int VertBufferID = BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex;
|
||||
if(VertBufferID != -1)
|
||||
{
|
||||
glDeleteBuffers(1, &m_BufferObjectIndices[VertBufferID]);
|
||||
glDeleteBuffers(1, &m_vBufferObjectIndices[VertBufferID]);
|
||||
}
|
||||
}
|
||||
|
||||
BufferContainer.m_LastIndexBufferBound = 0;
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.clear();
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.clear();
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::AppendIndices(unsigned int NewIndicesCount)
|
||||
|
@ -967,7 +967,7 @@ void CCommandProcessorFragment_OpenGL3_3::AppendIndices(unsigned int NewIndicesC
|
|||
|
||||
for(unsigned int &i : m_LastIndexBufferBound)
|
||||
i = 0;
|
||||
for(auto &BufferContainer : m_BufferContainers)
|
||||
for(auto &BufferContainer : m_vBufferContainers)
|
||||
{
|
||||
BufferContainer.m_LastIndexBufferBound = 0;
|
||||
}
|
||||
|
@ -981,11 +981,11 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferObject(const CCommandB
|
|||
void *pUploadData = pCommand->m_pUploadData;
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
// create necessary space
|
||||
if((size_t)Index >= m_BufferObjectIndices.size())
|
||||
if((size_t)Index >= m_vBufferObjectIndices.size())
|
||||
{
|
||||
for(int i = m_BufferObjectIndices.size(); i < Index + 1; ++i)
|
||||
for(int i = m_vBufferObjectIndices.size(); i < Index + 1; ++i)
|
||||
{
|
||||
m_BufferObjectIndices.push_back(0);
|
||||
m_vBufferObjectIndices.push_back(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -995,7 +995,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferObject(const CCommandB
|
|||
glBindBuffer(BUFFER_INIT_VERTEX_TARGET, VertBufferID);
|
||||
glBufferData(BUFFER_INIT_VERTEX_TARGET, (GLsizeiptr)(pCommand->m_DataSize), pUploadData, GL_STATIC_DRAW);
|
||||
|
||||
m_BufferObjectIndices[Index] = VertBufferID;
|
||||
m_vBufferObjectIndices[Index] = VertBufferID;
|
||||
|
||||
if(pCommand->m_DeletePointer)
|
||||
free(pUploadData);
|
||||
|
@ -1006,7 +1006,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RecreateBufferObject(const CComman
|
|||
void *pUploadData = pCommand->m_pUploadData;
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
|
||||
glBindBuffer(BUFFER_INIT_VERTEX_TARGET, m_BufferObjectIndices[Index]);
|
||||
glBindBuffer(BUFFER_INIT_VERTEX_TARGET, m_vBufferObjectIndices[Index]);
|
||||
glBufferData(BUFFER_INIT_VERTEX_TARGET, (GLsizeiptr)(pCommand->m_DataSize), pUploadData, GL_STATIC_DRAW);
|
||||
|
||||
if(pCommand->m_DeletePointer)
|
||||
|
@ -1018,7 +1018,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_UpdateBufferObject(const CCommandB
|
|||
void *pUploadData = pCommand->m_pUploadData;
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
|
||||
glBindBuffer(BUFFER_INIT_VERTEX_TARGET, m_BufferObjectIndices[Index]);
|
||||
glBindBuffer(BUFFER_INIT_VERTEX_TARGET, m_vBufferObjectIndices[Index]);
|
||||
glBufferSubData(BUFFER_INIT_VERTEX_TARGET, (GLintptr)(pCommand->m_pOffset), (GLsizeiptr)(pCommand->m_DataSize), pUploadData);
|
||||
|
||||
if(pCommand->m_DeletePointer)
|
||||
|
@ -1030,8 +1030,8 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CopyBufferObject(const CCommandBuf
|
|||
int WriteIndex = pCommand->m_WriteBufferIndex;
|
||||
int ReadIndex = pCommand->m_ReadBufferIndex;
|
||||
|
||||
glBindBuffer(GL_COPY_WRITE_BUFFER, m_BufferObjectIndices[WriteIndex]);
|
||||
glBindBuffer(GL_COPY_READ_BUFFER, m_BufferObjectIndices[ReadIndex]);
|
||||
glBindBuffer(GL_COPY_WRITE_BUFFER, m_vBufferObjectIndices[WriteIndex]);
|
||||
glBindBuffer(GL_COPY_READ_BUFFER, m_vBufferObjectIndices[ReadIndex]);
|
||||
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, (GLsizeiptr)(pCommand->m_pReadOffset), (GLsizeiptr)(pCommand->m_pWriteOffset), (GLsizeiptr)pCommand->m_CopySize);
|
||||
}
|
||||
|
||||
|
@ -1039,25 +1039,25 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_DeleteBufferObject(const CCommandB
|
|||
{
|
||||
int Index = pCommand->m_BufferIndex;
|
||||
|
||||
glDeleteBuffers(1, &m_BufferObjectIndices[Index]);
|
||||
glDeleteBuffers(1, &m_vBufferObjectIndices[Index]);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferContainer(const CCommandBuffer::SCommand_CreateBufferContainer *pCommand)
|
||||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// create necessary space
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
{
|
||||
for(int i = m_BufferContainers.size(); i < Index + 1; ++i)
|
||||
for(int i = m_vBufferContainers.size(); i < Index + 1; ++i)
|
||||
{
|
||||
SBufferContainer Container;
|
||||
Container.m_ContainerInfo.m_Stride = 0;
|
||||
Container.m_ContainerInfo.m_VertBufferBindingIndex = -1;
|
||||
m_BufferContainers.push_back(Container);
|
||||
m_vBufferContainers.push_back(Container);
|
||||
}
|
||||
}
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
glGenVertexArrays(1, &BufferContainer.m_VertArrayID);
|
||||
glBindVertexArray(BufferContainer.m_VertArrayID);
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferContainer(const CComma
|
|||
{
|
||||
glEnableVertexAttribArray((GLuint)i);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_BufferObjectIndices[pCommand->m_VertBufferBindingIndex]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vBufferObjectIndices[pCommand->m_VertBufferBindingIndex]);
|
||||
|
||||
SBufferContainerInfo::SAttribute &Attr = pCommand->m_pAttributes[i];
|
||||
|
||||
|
@ -1076,7 +1076,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferContainer(const CComma
|
|||
else if(Attr.m_FuncType == 1)
|
||||
glVertexAttribIPointer((GLuint)i, Attr.m_DataTypeCount, Attr.m_Type, pCommand->m_Stride, Attr.m_pOffset);
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.push_back(Attr);
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.push_back(Attr);
|
||||
}
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex = pCommand->m_VertBufferBindingIndex;
|
||||
|
@ -1085,29 +1085,29 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferContainer(const CComma
|
|||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_UpdateBufferContainer(const CCommandBuffer::SCommand_UpdateBufferContainer *pCommand)
|
||||
{
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[pCommand->m_BufferContainerIndex];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[pCommand->m_BufferContainerIndex];
|
||||
|
||||
glBindVertexArray(BufferContainer.m_VertArrayID);
|
||||
|
||||
// disable all old attributes
|
||||
for(size_t i = 0; i < BufferContainer.m_ContainerInfo.m_Attributes.size(); ++i)
|
||||
for(size_t i = 0; i < BufferContainer.m_ContainerInfo.m_vAttributes.size(); ++i)
|
||||
{
|
||||
glDisableVertexAttribArray((GLuint)i);
|
||||
}
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.clear();
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.clear();
|
||||
|
||||
for(int i = 0; i < pCommand->m_AttrCount; ++i)
|
||||
{
|
||||
glEnableVertexAttribArray((GLuint)i);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_BufferObjectIndices[pCommand->m_VertBufferBindingIndex]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_vBufferObjectIndices[pCommand->m_VertBufferBindingIndex]);
|
||||
SBufferContainerInfo::SAttribute &Attr = pCommand->m_pAttributes[i];
|
||||
if(Attr.m_FuncType == 0)
|
||||
glVertexAttribPointer((GLuint)i, Attr.m_DataTypeCount, Attr.m_Type, Attr.m_Normalized, pCommand->m_Stride, Attr.m_pOffset);
|
||||
else if(Attr.m_FuncType == 1)
|
||||
glVertexAttribIPointer((GLuint)i, Attr.m_DataTypeCount, Attr.m_Type, pCommand->m_Stride, Attr.m_pOffset);
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_Attributes.push_back(Attr);
|
||||
BufferContainer.m_ContainerInfo.m_vAttributes.push_back(Attr);
|
||||
}
|
||||
|
||||
BufferContainer.m_ContainerInfo.m_VertBufferBindingIndex = pCommand->m_VertBufferBindingIndex;
|
||||
|
@ -1129,10 +1129,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderBorderTile(const CCommandBuf
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1165,10 +1165,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderBorderTileLine(const CComman
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1199,10 +1199,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderTileLayer(const CCommandBuff
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1240,10 +1240,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadLayer(const CCommandBuff
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1323,25 +1323,25 @@ void CCommandProcessorFragment_OpenGL3_3::RenderText(const CCommandBuffer::SStat
|
|||
if(!IsAndUpdateTextureSlotBound(SlotText, TextTextureIndex))
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + SlotText);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[TextTextureIndex].m_Tex);
|
||||
glBindSampler(SlotText, m_Textures[TextTextureIndex].m_Sampler);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[TextTextureIndex].m_Tex);
|
||||
glBindSampler(SlotText, m_vTextures[TextTextureIndex].m_Sampler);
|
||||
}
|
||||
if(!IsAndUpdateTextureSlotBound(SlotTextOutline, TextOutlineTextureIndex))
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + SlotTextOutline);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[TextOutlineTextureIndex].m_Tex);
|
||||
glBindSampler(SlotTextOutline, m_Textures[TextOutlineTextureIndex].m_Sampler);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[TextOutlineTextureIndex].m_Tex);
|
||||
glBindSampler(SlotTextOutline, m_vTextures[TextOutlineTextureIndex].m_Sampler);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SlotText = 0;
|
||||
SlotTextOutline = 1;
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[TextTextureIndex].m_Tex);
|
||||
glBindSampler(SlotText, m_Textures[TextTextureIndex].m_Sampler);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[TextTextureIndex].m_Tex);
|
||||
glBindSampler(SlotText, m_vTextures[TextTextureIndex].m_Sampler);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, m_Textures[TextOutlineTextureIndex].m_Tex);
|
||||
glBindSampler(SlotTextOutline, m_Textures[TextOutlineTextureIndex].m_Sampler);
|
||||
glBindTexture(GL_TEXTURE_2D, m_vTextures[TextOutlineTextureIndex].m_Tex);
|
||||
glBindSampler(SlotTextOutline, m_vTextures[TextOutlineTextureIndex].m_Sampler);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
|
@ -1390,10 +1390,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderText(const CCommandBuffer::S
|
|||
{
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1416,10 +1416,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadContainer(const CCommand
|
|||
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1448,10 +1448,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadContainerEx(const CComma
|
|||
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
@ -1513,10 +1513,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadContainerAsSpriteMultipl
|
|||
|
||||
int Index = pCommand->m_BufferContainerIndex;
|
||||
// if space not there return
|
||||
if((size_t)Index >= m_BufferContainers.size())
|
||||
if((size_t)Index >= m_vBufferContainers.size())
|
||||
return;
|
||||
|
||||
SBufferContainer &BufferContainer = m_BufferContainers[Index];
|
||||
SBufferContainer &BufferContainer = m_vBufferContainers[Index];
|
||||
if(BufferContainer.m_VertArrayID == 0)
|
||||
return;
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ protected:
|
|||
TWGLuint m_LastIndexBufferBound;
|
||||
SBufferContainerInfo m_ContainerInfo;
|
||||
};
|
||||
std::vector<SBufferContainer> m_BufferContainers;
|
||||
std::vector<SBufferContainer> m_vBufferContainers;
|
||||
|
||||
std::vector<TWGLuint> m_BufferObjectIndices;
|
||||
std::vector<TWGLuint> m_vBufferObjectIndices;
|
||||
|
||||
CCommandBuffer::SColorf m_ClearColor;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char
|
|||
}
|
||||
}
|
||||
|
||||
for(CGLSLCompiler::SGLSLCompilerDefine &Define : pCompiler->m_Defines)
|
||||
for(CGLSLCompiler::SGLSLCompilerDefine &Define : pCompiler->m_vDefines)
|
||||
{
|
||||
Lines.push_back(std::string("#define ") + Define.m_DefineName + std::string(" ") + Define.m_DefineValue + std::string("\r\n"));
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3269,7 +3269,7 @@ void CClient::Run()
|
|||
{
|
||||
// write down the config and quit
|
||||
if(!m_pConfigManager->Save())
|
||||
m_Warnings.emplace_back(SWarning(Localize("Saving ddnet-settings.cfg failed")));
|
||||
m_vWarnings.emplace_back(SWarning(Localize("Saving ddnet-settings.cfg failed")));
|
||||
s_SavedConfig = true;
|
||||
}
|
||||
|
||||
|
@ -3280,7 +3280,7 @@ void CClient::Run()
|
|||
m_pStorage->RemoveFile(m_aDDNetInfoTmp, IStorage::TYPE_SAVE);
|
||||
}
|
||||
|
||||
if(m_Warnings.empty() && !GameClient()->IsDisplayingWarning())
|
||||
if(m_vWarnings.empty() && !GameClient()->IsDisplayingWarning())
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4651,18 +4651,18 @@ void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float Mix
|
|||
|
||||
SWarning *CClient::GetCurWarning()
|
||||
{
|
||||
if(m_Warnings.empty())
|
||||
if(m_vWarnings.empty())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else if(m_Warnings[0].m_WasShown)
|
||||
else if(m_vWarnings[0].m_WasShown)
|
||||
{
|
||||
m_Warnings.erase(m_Warnings.begin());
|
||||
m_vWarnings.erase(m_vWarnings.begin());
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &m_Warnings[0];
|
||||
return &m_vWarnings[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
static void GraphicsThreadProxy(void *pThis) { ((CClient *)pThis)->GraphicsThread(); }
|
||||
void GraphicsThread();
|
||||
|
||||
std::vector<SWarning> m_Warnings;
|
||||
std::vector<SWarning> m_vWarnings;
|
||||
|
||||
#if defined(CONF_FAMILY_UNIX)
|
||||
CFifo m_Fifo;
|
||||
|
|
|
@ -275,7 +275,7 @@ int CGraphics_Threaded::UnloadTexture(CTextureHandle *pIndex)
|
|||
AddCmd(
|
||||
Cmd, [] { return true; }, "failed to unload texture.");
|
||||
|
||||
m_TextureIndices[pIndex->Id()] = m_FirstFreeTexture;
|
||||
m_vTextureIndices[pIndex->Id()] = m_FirstFreeTexture;
|
||||
m_FirstFreeTexture = pIndex->Id();
|
||||
|
||||
pIndex->Invalidate();
|
||||
|
@ -355,11 +355,11 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadSpriteTextureImpl(CImageInfo &
|
|||
{
|
||||
int bpp = ImageFormatToPixelSize(FromImageInfo.m_Format);
|
||||
|
||||
m_SpriteHelper.resize(w * h * bpp);
|
||||
m_vSpriteHelper.resize((size_t)w * h * bpp);
|
||||
|
||||
CopyTextureFromTextureBufferSub(&m_SpriteHelper[0], w, h, (uint8_t *)FromImageInfo.m_pData, FromImageInfo.m_Width, FromImageInfo.m_Height, bpp, x, y, w, h);
|
||||
CopyTextureFromTextureBufferSub(&m_vSpriteHelper[0], w, h, (uint8_t *)FromImageInfo.m_pData, FromImageInfo.m_Width, FromImageInfo.m_Height, bpp, x, y, w, h);
|
||||
|
||||
IGraphics::CTextureHandle RetHandle = LoadTextureRaw(w, h, FromImageInfo.m_Format, &m_SpriteHelper[0], FromImageInfo.m_Format, 0);
|
||||
IGraphics::CTextureHandle RetHandle = LoadTextureRaw(w, h, FromImageInfo.m_Format, &m_vSpriteHelper[0], FromImageInfo.m_Format, 0);
|
||||
|
||||
return RetHandle;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadTextureRaw(int Width, int Heig
|
|||
}
|
||||
str_format(NewWarning.m_aWarningMsg, sizeof(NewWarning.m_aWarningMsg), Localize("The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs."), aText, 16, 16);
|
||||
|
||||
m_Warnings.emplace_back(NewWarning);
|
||||
m_vWarnings.emplace_back(NewWarning);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,18 +451,18 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadTextureRaw(int Width, int Heig
|
|||
int Tex = m_FirstFreeTexture;
|
||||
if(Tex == -1)
|
||||
{
|
||||
size_t CurSize = m_TextureIndices.size();
|
||||
m_TextureIndices.resize(CurSize * 2);
|
||||
size_t CurSize = m_vTextureIndices.size();
|
||||
m_vTextureIndices.resize(CurSize * 2);
|
||||
for(size_t i = 0; i < CurSize - 1; ++i)
|
||||
{
|
||||
m_TextureIndices[CurSize + i] = CurSize + i + 1;
|
||||
m_vTextureIndices[CurSize + i] = CurSize + i + 1;
|
||||
}
|
||||
m_TextureIndices.back() = -1;
|
||||
m_vTextureIndices.back() = -1;
|
||||
|
||||
Tex = CurSize;
|
||||
}
|
||||
m_FirstFreeTexture = m_TextureIndices[Tex];
|
||||
m_TextureIndices[Tex] = -1;
|
||||
m_FirstFreeTexture = m_vTextureIndices[Tex];
|
||||
m_vTextureIndices[Tex] = -1;
|
||||
|
||||
CCommandBuffer::SCommand_Texture_Create Cmd;
|
||||
Cmd.m_Slot = Tex;
|
||||
|
@ -535,34 +535,34 @@ bool CGraphics_Threaded::LoadTextTextures(int Width, int Height, CTextureHandle
|
|||
int Tex = m_FirstFreeTexture;
|
||||
if(Tex == -1)
|
||||
{
|
||||
size_t CurSize = m_TextureIndices.size();
|
||||
m_TextureIndices.resize(CurSize * 2);
|
||||
size_t CurSize = m_vTextureIndices.size();
|
||||
m_vTextureIndices.resize(CurSize * 2);
|
||||
for(size_t i = 0; i < CurSize - 1; ++i)
|
||||
{
|
||||
m_TextureIndices[CurSize + i] = CurSize + i + 1;
|
||||
m_vTextureIndices[CurSize + i] = CurSize + i + 1;
|
||||
}
|
||||
m_TextureIndices.back() = -1;
|
||||
m_vTextureIndices.back() = -1;
|
||||
|
||||
Tex = CurSize;
|
||||
}
|
||||
m_FirstFreeTexture = m_TextureIndices[Tex];
|
||||
m_TextureIndices[Tex] = -1;
|
||||
m_FirstFreeTexture = m_vTextureIndices[Tex];
|
||||
m_vTextureIndices[Tex] = -1;
|
||||
|
||||
int Tex2 = m_FirstFreeTexture;
|
||||
if(Tex2 == -1)
|
||||
{
|
||||
size_t CurSize = m_TextureIndices.size();
|
||||
m_TextureIndices.resize(CurSize * 2);
|
||||
size_t CurSize = m_vTextureIndices.size();
|
||||
m_vTextureIndices.resize(CurSize * 2);
|
||||
for(size_t i = 0; i < CurSize - 1; ++i)
|
||||
{
|
||||
m_TextureIndices[CurSize + i] = CurSize + i + 1;
|
||||
m_vTextureIndices[CurSize + i] = CurSize + i + 1;
|
||||
}
|
||||
m_TextureIndices.back() = -1;
|
||||
m_vTextureIndices.back() = -1;
|
||||
|
||||
Tex2 = CurSize;
|
||||
}
|
||||
m_FirstFreeTexture = m_TextureIndices[Tex2];
|
||||
m_TextureIndices[Tex2] = -1;
|
||||
m_FirstFreeTexture = m_vTextureIndices[Tex2];
|
||||
m_vTextureIndices[Tex2] = -1;
|
||||
|
||||
CCommandBuffer::SCommand_TextTextures_Create Cmd;
|
||||
Cmd.m_Slot = Tex;
|
||||
|
@ -590,10 +590,10 @@ bool CGraphics_Threaded::UnloadTextTextures(CTextureHandle &TextTexture, CTextur
|
|||
AddCmd(
|
||||
Cmd, [] { return true; }, "failed to unload text textures.");
|
||||
|
||||
m_TextureIndices[TextTexture.Id()] = m_FirstFreeTexture;
|
||||
m_vTextureIndices[TextTexture.Id()] = m_FirstFreeTexture;
|
||||
m_FirstFreeTexture = TextTexture.Id();
|
||||
|
||||
m_TextureIndices[TextOutlineTexture.Id()] = m_FirstFreeTexture;
|
||||
m_vTextureIndices[TextOutlineTexture.Id()] = m_FirstFreeTexture;
|
||||
m_FirstFreeTexture = TextOutlineTexture.Id();
|
||||
|
||||
TextTexture.Invalidate();
|
||||
|
@ -694,7 +694,7 @@ bool CGraphics_Threaded::CheckImageDivisibility(const char *pFileName, CImageInf
|
|||
SWarning NewWarning;
|
||||
str_format(NewWarning.m_aWarningMsg, sizeof(NewWarning.m_aWarningMsg), Localize("The width of texture %s is not divisible by %d, or the height is not divisible by %d, which might cause visual bugs."), pFileName, DivX, DivY);
|
||||
|
||||
m_Warnings.emplace_back(NewWarning);
|
||||
m_vWarnings.emplace_back(NewWarning);
|
||||
|
||||
ImageIsValid = false;
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ bool CGraphics_Threaded::IsImageFormatRGBA(const char *pFileName, CImageInfo &Im
|
|||
}
|
||||
str_format(NewWarning.m_aWarningMsg, sizeof(NewWarning.m_aWarningMsg),
|
||||
Localize("The format of texture %s is not RGBA which will cause visual bugs."), aText);
|
||||
m_Warnings.emplace_back(NewWarning);
|
||||
m_vWarnings.emplace_back(NewWarning);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1396,14 +1396,14 @@ int CGraphics_Threaded::CreateQuadContainer(bool AutomaticUpload)
|
|||
int Index = -1;
|
||||
if(m_FirstFreeQuadContainer == -1)
|
||||
{
|
||||
Index = m_QuadContainers.size();
|
||||
m_QuadContainers.emplace_back(AutomaticUpload);
|
||||
Index = m_vQuadContainers.size();
|
||||
m_vQuadContainers.emplace_back(AutomaticUpload);
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = m_FirstFreeQuadContainer;
|
||||
m_FirstFreeQuadContainer = m_QuadContainers[Index].m_FreeIndex;
|
||||
m_QuadContainers[Index].m_FreeIndex = Index;
|
||||
m_FirstFreeQuadContainer = m_vQuadContainers[Index].m_FreeIndex;
|
||||
m_vQuadContainers[Index].m_FreeIndex = Index;
|
||||
}
|
||||
|
||||
return Index;
|
||||
|
@ -1411,7 +1411,7 @@ int CGraphics_Threaded::CreateQuadContainer(bool AutomaticUpload)
|
|||
|
||||
void CGraphics_Threaded::QuadContainerChangeAutomaticUpload(int ContainerIndex, bool AutomaticUpload)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
Container.m_AutomaticUpload = AutomaticUpload;
|
||||
}
|
||||
|
||||
|
@ -1419,18 +1419,18 @@ void CGraphics_Threaded::QuadContainerUpload(int ContainerIndex)
|
|||
{
|
||||
if(IsQuadContainerBufferingEnabled())
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
if(!Container.m_Quads.empty())
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
if(!Container.m_vQuads.empty())
|
||||
{
|
||||
if(Container.m_QuadBufferObjectIndex == -1)
|
||||
{
|
||||
size_t UploadDataSize = Container.m_Quads.size() * sizeof(SQuadContainer::SQuad);
|
||||
Container.m_QuadBufferObjectIndex = CreateBufferObject(UploadDataSize, &Container.m_Quads[0], 0);
|
||||
size_t UploadDataSize = Container.m_vQuads.size() * sizeof(SQuadContainer::SQuad);
|
||||
Container.m_QuadBufferObjectIndex = CreateBufferObject(UploadDataSize, &Container.m_vQuads[0], 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t UploadDataSize = Container.m_Quads.size() * sizeof(SQuadContainer::SQuad);
|
||||
RecreateBufferObject(Container.m_QuadBufferObjectIndex, UploadDataSize, &Container.m_Quads[0], 0);
|
||||
size_t UploadDataSize = Container.m_vQuads.size() * sizeof(SQuadContainer::SQuad);
|
||||
RecreateBufferObject(Container.m_QuadBufferObjectIndex, UploadDataSize, &Container.m_vQuads[0], 0);
|
||||
}
|
||||
|
||||
if(Container.m_QuadBufferContainerIndex == -1)
|
||||
|
@ -1439,22 +1439,22 @@ void CGraphics_Threaded::QuadContainerUpload(int ContainerIndex)
|
|||
Info.m_Stride = sizeof(CCommandBuffer::SVertex);
|
||||
Info.m_VertBufferBindingIndex = Container.m_QuadBufferObjectIndex;
|
||||
|
||||
Info.m_Attributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &Info.m_Attributes.back();
|
||||
Info.m_vAttributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &Info.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 2;
|
||||
pAttr->m_FuncType = 0;
|
||||
pAttr->m_Normalized = false;
|
||||
pAttr->m_pOffset = 0;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
Info.m_Attributes.emplace_back();
|
||||
pAttr = &Info.m_Attributes.back();
|
||||
Info.m_vAttributes.emplace_back();
|
||||
pAttr = &Info.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 2;
|
||||
pAttr->m_FuncType = 0;
|
||||
pAttr->m_Normalized = false;
|
||||
pAttr->m_pOffset = (void *)(sizeof(float) * 2);
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
Info.m_Attributes.emplace_back();
|
||||
pAttr = &Info.m_Attributes.back();
|
||||
Info.m_vAttributes.emplace_back();
|
||||
pAttr = &Info.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 4;
|
||||
pAttr->m_FuncType = 0;
|
||||
pAttr->m_Normalized = true;
|
||||
|
@ -1469,17 +1469,17 @@ void CGraphics_Threaded::QuadContainerUpload(int ContainerIndex)
|
|||
|
||||
int CGraphics_Threaded::QuadContainerAddQuads(int ContainerIndex, CQuadItem *pArray, int Num)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
|
||||
if((int)Container.m_Quads.size() > Num + CCommandBuffer::CCommandBuffer::MAX_VERTICES)
|
||||
if((int)Container.m_vQuads.size() > Num + CCommandBuffer::CCommandBuffer::MAX_VERTICES)
|
||||
return -1;
|
||||
|
||||
int RetOff = (int)Container.m_Quads.size();
|
||||
int RetOff = (int)Container.m_vQuads.size();
|
||||
|
||||
for(int i = 0; i < Num; ++i)
|
||||
{
|
||||
Container.m_Quads.emplace_back();
|
||||
SQuadContainer::SQuad &Quad = Container.m_Quads.back();
|
||||
Container.m_vQuads.emplace_back();
|
||||
SQuadContainer::SQuad &Quad = Container.m_vQuads.back();
|
||||
|
||||
Quad.m_aVertices[0].m_Pos.x = pArray[i].m_X;
|
||||
Quad.m_aVertices[0].m_Pos.y = pArray[i].m_Y;
|
||||
|
@ -1519,17 +1519,17 @@ int CGraphics_Threaded::QuadContainerAddQuads(int ContainerIndex, CQuadItem *pAr
|
|||
|
||||
int CGraphics_Threaded::QuadContainerAddQuads(int ContainerIndex, CFreeformItem *pArray, int Num)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
|
||||
if((int)Container.m_Quads.size() > Num + CCommandBuffer::CCommandBuffer::MAX_VERTICES)
|
||||
if((int)Container.m_vQuads.size() > Num + CCommandBuffer::CCommandBuffer::MAX_VERTICES)
|
||||
return -1;
|
||||
|
||||
int RetOff = (int)Container.m_Quads.size();
|
||||
int RetOff = (int)Container.m_vQuads.size();
|
||||
|
||||
for(int i = 0; i < Num; ++i)
|
||||
{
|
||||
Container.m_Quads.emplace_back();
|
||||
SQuadContainer::SQuad &Quad = Container.m_Quads.back();
|
||||
Container.m_vQuads.emplace_back();
|
||||
SQuadContainer::SQuad &Quad = Container.m_vQuads.back();
|
||||
|
||||
Quad.m_aVertices[0].m_Pos.x = pArray[i].m_X0;
|
||||
Quad.m_aVertices[0].m_Pos.y = pArray[i].m_Y0;
|
||||
|
@ -1560,13 +1560,13 @@ int CGraphics_Threaded::QuadContainerAddQuads(int ContainerIndex, CFreeformItem
|
|||
|
||||
void CGraphics_Threaded::QuadContainerReset(int ContainerIndex)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
if(IsQuadContainerBufferingEnabled())
|
||||
{
|
||||
if(Container.m_QuadBufferContainerIndex != -1)
|
||||
DeleteBufferContainer(Container.m_QuadBufferContainerIndex, true);
|
||||
}
|
||||
Container.m_Quads.clear();
|
||||
Container.m_vQuads.clear();
|
||||
Container.m_QuadBufferContainerIndex = Container.m_QuadBufferObjectIndex = -1;
|
||||
}
|
||||
|
||||
|
@ -1575,7 +1575,7 @@ void CGraphics_Threaded::DeleteQuadContainer(int ContainerIndex)
|
|||
QuadContainerReset(ContainerIndex);
|
||||
|
||||
// also clear the container index
|
||||
m_QuadContainers[ContainerIndex].m_FreeIndex = m_FirstFreeQuadContainer;
|
||||
m_vQuadContainers[ContainerIndex].m_FreeIndex = m_FirstFreeQuadContainer;
|
||||
m_FirstFreeQuadContainer = ContainerIndex;
|
||||
}
|
||||
|
||||
|
@ -1586,12 +1586,12 @@ void CGraphics_Threaded::RenderQuadContainer(int ContainerIndex, int QuadDrawNum
|
|||
|
||||
void CGraphics_Threaded::RenderQuadContainer(int ContainerIndex, int QuadOffset, int QuadDrawNum, bool ChangeWrapMode)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
|
||||
if(QuadDrawNum == -1)
|
||||
QuadDrawNum = (int)Container.m_Quads.size() - QuadOffset;
|
||||
QuadDrawNum = (int)Container.m_vQuads.size() - QuadOffset;
|
||||
|
||||
if((int)Container.m_Quads.size() < QuadOffset + QuadDrawNum || QuadDrawNum == 0)
|
||||
if((int)Container.m_vQuads.size() < QuadOffset + QuadDrawNum || QuadDrawNum == 0)
|
||||
return;
|
||||
|
||||
if(IsQuadContainerBufferingEnabled())
|
||||
|
@ -1622,7 +1622,7 @@ void CGraphics_Threaded::RenderQuadContainer(int ContainerIndex, int QuadOffset,
|
|||
{
|
||||
for(int i = 0; i < QuadDrawNum; ++i)
|
||||
{
|
||||
SQuadContainer::SQuad &Quad = Container.m_Quads[QuadOffset + i];
|
||||
SQuadContainer::SQuad &Quad = Container.m_vQuads[QuadOffset + i];
|
||||
m_aVertices[i * 6] = Quad.m_aVertices[0];
|
||||
m_aVertices[i * 6 + 1] = Quad.m_aVertices[1];
|
||||
m_aVertices[i * 6 + 2] = Quad.m_aVertices[2];
|
||||
|
@ -1634,7 +1634,7 @@ void CGraphics_Threaded::RenderQuadContainer(int ContainerIndex, int QuadOffset,
|
|||
}
|
||||
else
|
||||
{
|
||||
mem_copy(m_aVertices, &Container.m_Quads[QuadOffset], sizeof(CCommandBuffer::SVertex) * 4 * QuadDrawNum);
|
||||
mem_copy(m_aVertices, &Container.m_vQuads[QuadOffset], sizeof(CCommandBuffer::SVertex) * 4 * QuadDrawNum);
|
||||
m_NumVertices += 4 * QuadDrawNum;
|
||||
}
|
||||
m_Drawing = DRAWING_QUADS;
|
||||
|
@ -1648,20 +1648,20 @@ void CGraphics_Threaded::RenderQuadContainer(int ContainerIndex, int QuadOffset,
|
|||
|
||||
void CGraphics_Threaded::RenderQuadContainerEx(int ContainerIndex, int QuadOffset, int QuadDrawNum, float X, float Y, float ScaleX, float ScaleY)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
|
||||
if((int)Container.m_Quads.size() < QuadOffset + 1)
|
||||
if((int)Container.m_vQuads.size() < QuadOffset + 1)
|
||||
return;
|
||||
|
||||
if(QuadDrawNum == -1)
|
||||
QuadDrawNum = (int)Container.m_Quads.size() - QuadOffset;
|
||||
QuadDrawNum = (int)Container.m_vQuads.size() - QuadOffset;
|
||||
|
||||
if(IsQuadContainerBufferingEnabled())
|
||||
{
|
||||
if(Container.m_QuadBufferContainerIndex == -1)
|
||||
return;
|
||||
|
||||
SQuadContainer::SQuad &Quad = Container.m_Quads[QuadOffset];
|
||||
SQuadContainer::SQuad &Quad = Container.m_vQuads[QuadOffset];
|
||||
CCommandBuffer::SCommand_RenderQuadContainerEx Cmd;
|
||||
|
||||
WrapClamp();
|
||||
|
@ -1701,7 +1701,7 @@ void CGraphics_Threaded::RenderQuadContainerEx(int ContainerIndex, int QuadOffse
|
|||
{
|
||||
for(int i = 0; i < QuadDrawNum; ++i)
|
||||
{
|
||||
SQuadContainer::SQuad &Quad = Container.m_Quads[QuadOffset + i];
|
||||
SQuadContainer::SQuad &Quad = Container.m_vQuads[QuadOffset + i];
|
||||
m_aVertices[i * 6 + 0] = Quad.m_aVertices[0];
|
||||
m_aVertices[i * 6 + 1] = Quad.m_aVertices[1];
|
||||
m_aVertices[i * 6 + 2] = Quad.m_aVertices[2];
|
||||
|
@ -1736,7 +1736,7 @@ void CGraphics_Threaded::RenderQuadContainerEx(int ContainerIndex, int QuadOffse
|
|||
}
|
||||
else
|
||||
{
|
||||
mem_copy(m_aVertices, &Container.m_Quads[QuadOffset], sizeof(CCommandBuffer::SVertex) * 4 * QuadDrawNum);
|
||||
mem_copy(m_aVertices, &Container.m_vQuads[QuadOffset], sizeof(CCommandBuffer::SVertex) * 4 * QuadDrawNum);
|
||||
for(int i = 0; i < QuadDrawNum; ++i)
|
||||
{
|
||||
for(int n = 0; n < 4; ++n)
|
||||
|
@ -1778,7 +1778,7 @@ void CGraphics_Threaded::RenderQuadContainerAsSprite(int ContainerIndex, int Qua
|
|||
|
||||
void CGraphics_Threaded::RenderQuadContainerAsSpriteMultiple(int ContainerIndex, int QuadOffset, int DrawCount, SRenderSpriteInfo *pRenderInfo)
|
||||
{
|
||||
SQuadContainer &Container = m_QuadContainers[ContainerIndex];
|
||||
SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
|
||||
|
||||
if(DrawCount == 0)
|
||||
return;
|
||||
|
@ -1789,7 +1789,7 @@ void CGraphics_Threaded::RenderQuadContainerAsSpriteMultiple(int ContainerIndex,
|
|||
return;
|
||||
|
||||
WrapClamp();
|
||||
SQuadContainer::SQuad &Quad = Container.m_Quads[0];
|
||||
SQuadContainer::SQuad &Quad = Container.m_vQuads[0];
|
||||
CCommandBuffer::SCommand_RenderQuadContainerAsSpriteMultiple Cmd;
|
||||
|
||||
Cmd.m_State = m_State;
|
||||
|
@ -1876,14 +1876,14 @@ int CGraphics_Threaded::CreateBufferObject(size_t UploadDataSize, void *pUploadD
|
|||
int Index = -1;
|
||||
if(m_FirstFreeBufferObjectIndex == -1)
|
||||
{
|
||||
Index = m_BufferObjectIndices.size();
|
||||
m_BufferObjectIndices.push_back(Index);
|
||||
Index = m_vBufferObjectIndices.size();
|
||||
m_vBufferObjectIndices.push_back(Index);
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = m_FirstFreeBufferObjectIndex;
|
||||
m_FirstFreeBufferObjectIndex = m_BufferObjectIndices[Index];
|
||||
m_BufferObjectIndices[Index] = Index;
|
||||
m_FirstFreeBufferObjectIndex = m_vBufferObjectIndices[Index];
|
||||
m_vBufferObjectIndices[Index] = Index;
|
||||
}
|
||||
|
||||
CCommandBuffer::SCommand_CreateBufferObject Cmd;
|
||||
|
@ -2096,7 +2096,7 @@ void CGraphics_Threaded::DeleteBufferObject(int BufferIndex)
|
|||
}
|
||||
|
||||
// also clear the buffer object index
|
||||
m_BufferObjectIndices[BufferIndex] = m_FirstFreeBufferObjectIndex;
|
||||
m_vBufferObjectIndices[BufferIndex] = m_FirstFreeBufferObjectIndex;
|
||||
m_FirstFreeBufferObjectIndex = BufferIndex;
|
||||
}
|
||||
|
||||
|
@ -2117,7 +2117,7 @@ int CGraphics_Threaded::CreateBufferContainer(SBufferContainerInfo *pContainerIn
|
|||
|
||||
CCommandBuffer::SCommand_CreateBufferContainer Cmd;
|
||||
Cmd.m_BufferContainerIndex = Index;
|
||||
Cmd.m_AttrCount = (int)pContainerInfo->m_Attributes.size();
|
||||
Cmd.m_AttrCount = (int)pContainerInfo->m_vAttributes.size();
|
||||
Cmd.m_Stride = pContainerInfo->m_Stride;
|
||||
Cmd.m_VertBufferBindingIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
|
||||
|
@ -2140,7 +2140,7 @@ int CGraphics_Threaded::CreateBufferContainer(SBufferContainerInfo *pContainerIn
|
|||
return -1;
|
||||
}
|
||||
|
||||
mem_copy(Cmd.m_pAttributes, pContainerInfo->m_Attributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
|
||||
mem_copy(Cmd.m_pAttributes, pContainerInfo->m_vAttributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
|
||||
|
||||
m_VertexArrayInfo[Index].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
|
||||
|
@ -2168,7 +2168,7 @@ void CGraphics_Threaded::DeleteBufferContainer(int ContainerIndex, bool DestroyA
|
|||
if(BufferObjectIndex != -1)
|
||||
{
|
||||
// clear the buffer object index
|
||||
m_BufferObjectIndices[BufferObjectIndex] = m_FirstFreeBufferObjectIndex;
|
||||
m_vBufferObjectIndices[BufferObjectIndex] = m_FirstFreeBufferObjectIndex;
|
||||
m_FirstFreeBufferObjectIndex = BufferObjectIndex;
|
||||
}
|
||||
}
|
||||
|
@ -2183,7 +2183,7 @@ void CGraphics_Threaded::UpdateBufferContainerInternal(int ContainerIndex, SBuff
|
|||
{
|
||||
CCommandBuffer::SCommand_UpdateBufferContainer Cmd;
|
||||
Cmd.m_BufferContainerIndex = ContainerIndex;
|
||||
Cmd.m_AttrCount = (int)pContainerInfo->m_Attributes.size();
|
||||
Cmd.m_AttrCount = (int)pContainerInfo->m_vAttributes.size();
|
||||
Cmd.m_Stride = pContainerInfo->m_Stride;
|
||||
Cmd.m_VertBufferBindingIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
|
||||
|
@ -2206,7 +2206,7 @@ void CGraphics_Threaded::UpdateBufferContainerInternal(int ContainerIndex, SBuff
|
|||
return;
|
||||
}
|
||||
|
||||
mem_copy(Cmd.m_pAttributes, pContainerInfo->m_Attributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
|
||||
mem_copy(Cmd.m_pAttributes, pContainerInfo->m_vAttributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
|
||||
|
||||
m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
}
|
||||
|
@ -2307,7 +2307,7 @@ void CGraphics_Threaded::AddBackEndWarningIfExists()
|
|||
{
|
||||
SWarning NewWarning;
|
||||
str_format(NewWarning.m_aWarningMsg, sizeof(NewWarning.m_aWarningMsg), "%s", Localize(pErrStr));
|
||||
m_Warnings.emplace_back(NewWarning);
|
||||
m_vWarnings.emplace_back(NewWarning);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2446,10 +2446,10 @@ int CGraphics_Threaded::Init()
|
|||
|
||||
// init textures
|
||||
m_FirstFreeTexture = 0;
|
||||
m_TextureIndices.resize(CCommandBuffer::MAX_TEXTURES);
|
||||
for(int i = 0; i < (int)m_TextureIndices.size() - 1; i++)
|
||||
m_TextureIndices[i] = i + 1;
|
||||
m_TextureIndices.back() = -1;
|
||||
m_vTextureIndices.resize(CCommandBuffer::MAX_TEXTURES);
|
||||
for(int i = 0; i < (int)m_vTextureIndices.size() - 1; i++)
|
||||
m_vTextureIndices[i] = i + 1;
|
||||
m_vTextureIndices.back() = -1;
|
||||
|
||||
m_FirstFreeVertexArrayInfo = -1;
|
||||
m_FirstFreeBufferObjectIndex = -1;
|
||||
|
@ -2609,13 +2609,13 @@ void CGraphics_Threaded::GotResized(int w, int h, int RefreshRate)
|
|||
KickCommandBuffer();
|
||||
WaitForIdle();
|
||||
|
||||
for(auto &ResizeListener : m_ResizeListeners)
|
||||
for(auto &ResizeListener : m_vResizeListeners)
|
||||
ResizeListener.m_pFunc(ResizeListener.m_pUser);
|
||||
}
|
||||
|
||||
void CGraphics_Threaded::AddWindowResizeListener(WINDOW_RESIZE_FUNC pFunc, void *pUser)
|
||||
{
|
||||
m_ResizeListeners.emplace_back(pFunc, pUser);
|
||||
m_vResizeListeners.emplace_back(pFunc, pUser);
|
||||
}
|
||||
|
||||
int CGraphics_Threaded::GetWindowScreen()
|
||||
|
@ -2696,12 +2696,12 @@ void CGraphics_Threaded::TakeCustomScreenshot(const char *pFilename)
|
|||
|
||||
void CGraphics_Threaded::Swap()
|
||||
{
|
||||
if(!m_Warnings.empty())
|
||||
if(!m_vWarnings.empty())
|
||||
{
|
||||
SWarning *pCurWarning = GetCurWarning();
|
||||
if(pCurWarning->m_WasShown)
|
||||
{
|
||||
m_Warnings.erase(m_Warnings.begin());
|
||||
m_vWarnings.erase(m_vWarnings.begin());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2816,11 +2816,11 @@ void CGraphics_Threaded::WaitForIdle()
|
|||
|
||||
SWarning *CGraphics_Threaded::GetCurWarning()
|
||||
{
|
||||
if(m_Warnings.empty())
|
||||
if(m_vWarnings.empty())
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
SWarning *pCurWarning = &m_Warnings[0];
|
||||
SWarning *pCurWarning = &m_vWarnings[0];
|
||||
return pCurWarning;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -818,13 +818,13 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
|
||||
CTextureHandle m_InvalidTexture;
|
||||
|
||||
std::vector<int> m_TextureIndices;
|
||||
std::vector<int> m_vTextureIndices;
|
||||
int m_FirstFreeTexture;
|
||||
int m_TextureMemoryUsage;
|
||||
|
||||
std::vector<uint8_t> m_SpriteHelper;
|
||||
std::vector<uint8_t> m_vSpriteHelper;
|
||||
|
||||
std::vector<SWarning> m_Warnings;
|
||||
std::vector<SWarning> m_vWarnings;
|
||||
|
||||
// is a non full windowed (in a sense that the viewport won't include the whole window),
|
||||
// forced viewport, so that it justifies our UI ratio needs
|
||||
|
@ -842,14 +842,14 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
std::vector<SVertexArrayInfo> m_VertexArrayInfo;
|
||||
int m_FirstFreeVertexArrayInfo;
|
||||
|
||||
std::vector<int> m_BufferObjectIndices;
|
||||
std::vector<int> m_vBufferObjectIndices;
|
||||
int m_FirstFreeBufferObjectIndex;
|
||||
|
||||
struct SQuadContainer
|
||||
{
|
||||
SQuadContainer(bool AutomaticUpload = true)
|
||||
{
|
||||
m_Quads.clear();
|
||||
m_vQuads.clear();
|
||||
m_QuadBufferObjectIndex = m_QuadBufferContainerIndex = -1;
|
||||
m_FreeIndex = -1;
|
||||
|
||||
|
@ -861,7 +861,7 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
CCommandBuffer::SVertex m_aVertices[4];
|
||||
};
|
||||
|
||||
std::vector<SQuad> m_Quads;
|
||||
std::vector<SQuad> m_vQuads;
|
||||
|
||||
int m_QuadBufferObjectIndex;
|
||||
int m_QuadBufferContainerIndex;
|
||||
|
@ -870,7 +870,7 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
|
||||
bool m_AutomaticUpload;
|
||||
};
|
||||
std::vector<SQuadContainer> m_QuadContainers;
|
||||
std::vector<SQuadContainer> m_vQuadContainers;
|
||||
int m_FirstFreeQuadContainer;
|
||||
|
||||
struct SWindowResizeListener
|
||||
|
@ -880,7 +880,7 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
WINDOW_RESIZE_FUNC m_pFunc;
|
||||
void *m_pUser;
|
||||
};
|
||||
std::vector<SWindowResizeListener> m_ResizeListeners;
|
||||
std::vector<SWindowResizeListener> m_vResizeListeners;
|
||||
|
||||
void *AllocCommandBufferData(unsigned AllocSize);
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ CServerBrowser::CServerEntry *CServerBrowser::Add(const NETADDR &Addr)
|
|||
CNetworkCountry *pCntr = &Network.m_aCountries[i];
|
||||
for(int j = 0; j < pCntr->m_NumServers; j++)
|
||||
{
|
||||
if(net_addr_comp(&Addr, &pCntr->m_aServers[j]) == 0)
|
||||
if(net_addr_comp(&Addr, &pCntr->m_vServers[j]) == 0)
|
||||
{
|
||||
pEntry->m_Info.m_Official = true;
|
||||
break;
|
||||
|
@ -1016,7 +1016,7 @@ void CServerBrowser::UpdateFromHttp()
|
|||
|
||||
if(DDNetFiltered(pExcludeTypes, pCntr->m_aTypes[g]))
|
||||
continue;
|
||||
aWantedAddresses.push_back(CWantedAddr{pCntr->m_aServers[g], false, false});
|
||||
aWantedAddresses.push_back(CWantedAddr{pCntr->m_vServers[g], false, false});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1415,7 +1415,7 @@ void CServerBrowser::LoadDDNetServers()
|
|||
continue;
|
||||
}
|
||||
const char *pStr = json_string_get(pAddr);
|
||||
net_addr_from_str(&pCntr->m_aServers[pCntr->m_NumServers], pStr);
|
||||
net_addr_from_str(&pCntr->m_vServers[pCntr->m_NumServers], pStr);
|
||||
str_copy(pCntr->m_aTypes[pCntr->m_NumServers], pType, sizeof(pCntr->m_aTypes[pCntr->m_NumServers]));
|
||||
}
|
||||
}
|
||||
|
@ -1434,7 +1434,7 @@ void CServerBrowser::RecheckOfficial()
|
|||
CNetworkCountry *pCntr = &Network.m_aCountries[i];
|
||||
for(int j = 0; j < pCntr->m_NumServers; j++)
|
||||
{
|
||||
CServerEntry *pEntry = Find(pCntr->m_aServers[j]);
|
||||
CServerEntry *pEntry = Find(pCntr->m_vServers[j]);
|
||||
if(pEntry)
|
||||
{
|
||||
pEntry->m_Info.m_Official = true;
|
||||
|
@ -1538,7 +1538,7 @@ const char *CServerBrowser::GetTutorialServer()
|
|||
CNetworkCountry *pCntr = &pNetwork->m_aCountries[i];
|
||||
for(int j = 0; j < pCntr->m_NumServers; j++)
|
||||
{
|
||||
CServerEntry *pEntry = Find(pCntr->m_aServers[j]);
|
||||
CServerEntry *pEntry = Find(pCntr->m_vServers[j]);
|
||||
if(!pEntry)
|
||||
continue;
|
||||
if(str_find(pEntry->m_Info.m_aName, "(Tutorial)") == 0)
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
char m_aName[256];
|
||||
int m_FlagID;
|
||||
NETADDR m_aServers[MAX_SERVERS];
|
||||
NETADDR m_vServers[MAX_SERVERS];
|
||||
char m_aTypes[MAX_SERVERS][32];
|
||||
int m_NumServers;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
/*void Add(NETADDR Addr, char* pType) {
|
||||
if (m_NumServers < MAX_SERVERS)
|
||||
{
|
||||
m_aServers[m_NumServers] = Addr;
|
||||
m_vServers[m_NumServers] = Addr;
|
||||
str_copy(m_aTypes[m_NumServers], pType, sizeof(m_aTypes[0]));
|
||||
m_NumServers++;
|
||||
}
|
||||
|
|
|
@ -258,25 +258,25 @@ public:
|
|||
|
||||
int NumServers() const override
|
||||
{
|
||||
return m_aServers.size();
|
||||
return m_vServers.size();
|
||||
}
|
||||
const NETADDR &ServerAddress(int Index) const override
|
||||
{
|
||||
return m_aServers[Index].m_Addr;
|
||||
return m_vServers[Index].m_Addr;
|
||||
}
|
||||
void Server(int Index, NETADDR *pAddr, CServerInfo *pInfo) const override
|
||||
{
|
||||
const CEntry &Entry = m_aServers[Index];
|
||||
const CEntry &Entry = m_vServers[Index];
|
||||
*pAddr = Entry.m_Addr;
|
||||
*pInfo = Entry.m_Info;
|
||||
}
|
||||
int NumLegacyServers() const override
|
||||
{
|
||||
return m_aLegacyServers.size();
|
||||
return m_vLegacyServers.size();
|
||||
}
|
||||
const NETADDR &LegacyServer(int Index) const override
|
||||
{
|
||||
return m_aLegacyServers[Index];
|
||||
return m_vLegacyServers[Index];
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -305,8 +305,8 @@ private:
|
|||
std::shared_ptr<CHttpRequest> m_pGetServers;
|
||||
std::unique_ptr<CChooseMaster> m_pChooseMaster;
|
||||
|
||||
std::vector<CEntry> m_aServers;
|
||||
std::vector<NETADDR> m_aLegacyServers;
|
||||
std::vector<CEntry> m_vServers;
|
||||
std::vector<NETADDR> m_vLegacyServers;
|
||||
};
|
||||
|
||||
CServerBrowserHttp::CServerBrowserHttp(IEngine *pEngine, IConsole *pConsole, const char **ppUrls, int NumUrls, int PreviousBestIndex) :
|
||||
|
@ -358,7 +358,7 @@ void CServerBrowserHttp::Update()
|
|||
bool Success = true;
|
||||
json_value *pJson = pGetServers->ResultJson();
|
||||
Success = Success && pJson;
|
||||
Success = Success && !Parse(pJson, &m_aServers, &m_aLegacyServers);
|
||||
Success = Success && !Parse(pJson, &m_vServers, &m_vLegacyServers);
|
||||
json_value_free(pJson);
|
||||
if(!Success)
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ private:
|
|||
CSqliteStmt m_pLoadStmt;
|
||||
CSqliteStmt m_pStoreStmt;
|
||||
|
||||
std::vector<CEntry> m_aEntries;
|
||||
std::vector<CEntry> m_aNewEntries;
|
||||
std::vector<CEntry> m_vEntries;
|
||||
std::vector<CEntry> m_vNewEntries;
|
||||
};
|
||||
|
||||
CServerBrowserPingCache::CServerBrowserPingCache(IConsole *pConsole, IStorage *pStorage) :
|
||||
|
@ -55,7 +55,7 @@ void CServerBrowserPingCache::Load()
|
|||
{
|
||||
if(m_pDisk)
|
||||
{
|
||||
int PrevNewEntriesSize = m_aNewEntries.size();
|
||||
int PrevNewEntriesSize = m_vNewEntries.size();
|
||||
|
||||
sqlite3 *pSqlite = m_pDisk.get();
|
||||
IConsole *pConsole = m_pConsole;
|
||||
|
@ -85,7 +85,7 @@ void CServerBrowserPingCache::Load()
|
|||
}
|
||||
continue;
|
||||
}
|
||||
m_aNewEntries.push_back(CEntry{Addr, Ping});
|
||||
m_vNewEntries.push_back(CEntry{Addr, Ping});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ void CServerBrowserPingCache::Load()
|
|||
if(Error)
|
||||
{
|
||||
pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "serverbrowse_ping_cache", "failed to load ping cache");
|
||||
m_aNewEntries.resize(PrevNewEntriesSize);
|
||||
m_vNewEntries.resize(PrevNewEntriesSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void CServerBrowserPingCache::Load()
|
|||
void CServerBrowserPingCache::CachePing(NETADDR Addr, int Ping)
|
||||
{
|
||||
Addr.port = 0;
|
||||
m_aNewEntries.push_back(CEntry{Addr, Ping});
|
||||
m_vNewEntries.push_back(CEntry{Addr, Ping});
|
||||
if(m_pDisk)
|
||||
{
|
||||
sqlite3 *pSqlite = m_pDisk.get();
|
||||
|
@ -126,7 +126,7 @@ void CServerBrowserPingCache::CachePing(NETADDR Addr, int Ping)
|
|||
|
||||
void CServerBrowserPingCache::GetPingCache(const CEntry **ppEntries, int *pNumEntries)
|
||||
{
|
||||
if(!m_aNewEntries.empty())
|
||||
if(!m_vNewEntries.empty())
|
||||
{
|
||||
class CAddrComparer
|
||||
{
|
||||
|
@ -137,44 +137,44 @@ void CServerBrowserPingCache::GetPingCache(const CEntry **ppEntries, int *pNumEn
|
|||
}
|
||||
};
|
||||
std::vector<CEntry> aOldEntries;
|
||||
std::swap(m_aEntries, aOldEntries);
|
||||
std::swap(m_vEntries, aOldEntries);
|
||||
|
||||
// Remove duplicates, keeping newer ones.
|
||||
std::stable_sort(m_aNewEntries.begin(), m_aNewEntries.end(), CAddrComparer());
|
||||
std::stable_sort(m_vNewEntries.begin(), m_vNewEntries.end(), CAddrComparer());
|
||||
{
|
||||
unsigned To = 0;
|
||||
for(unsigned int From = 0; From < m_aNewEntries.size(); From++)
|
||||
for(unsigned int From = 0; From < m_vNewEntries.size(); From++)
|
||||
{
|
||||
if(To < From)
|
||||
{
|
||||
m_aNewEntries[To] = m_aNewEntries[From];
|
||||
m_vNewEntries[To] = m_vNewEntries[From];
|
||||
}
|
||||
if(From + 1 >= m_aNewEntries.size() ||
|
||||
net_addr_comp(&m_aNewEntries[From].m_Addr, &m_aNewEntries[From + 1].m_Addr) != 0)
|
||||
if(From + 1 >= m_vNewEntries.size() ||
|
||||
net_addr_comp(&m_vNewEntries[From].m_Addr, &m_vNewEntries[From + 1].m_Addr) != 0)
|
||||
{
|
||||
To++;
|
||||
}
|
||||
}
|
||||
m_aNewEntries.resize(To);
|
||||
m_vNewEntries.resize(To);
|
||||
}
|
||||
// Only keep the new entries where there are duplicates.
|
||||
m_aEntries.reserve(m_aNewEntries.size() + aOldEntries.size());
|
||||
m_vEntries.reserve(m_vNewEntries.size() + aOldEntries.size());
|
||||
{
|
||||
unsigned i = 0;
|
||||
unsigned j = 0;
|
||||
while(i < aOldEntries.size() && j < m_aNewEntries.size())
|
||||
while(i < aOldEntries.size() && j < m_vNewEntries.size())
|
||||
{
|
||||
int Cmp = net_addr_comp(&aOldEntries[i].m_Addr, &m_aNewEntries[j].m_Addr);
|
||||
int Cmp = net_addr_comp(&aOldEntries[i].m_Addr, &m_vNewEntries[j].m_Addr);
|
||||
if(Cmp != 0)
|
||||
{
|
||||
if(Cmp < 0)
|
||||
{
|
||||
m_aEntries.push_back(aOldEntries[i]);
|
||||
m_vEntries.push_back(aOldEntries[i]);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_aEntries.push_back(m_aNewEntries[j]);
|
||||
m_vEntries.push_back(m_vNewEntries[j]);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
@ -187,17 +187,17 @@ void CServerBrowserPingCache::GetPingCache(const CEntry **ppEntries, int *pNumEn
|
|||
// Add the remaining elements.
|
||||
for(; i < aOldEntries.size(); i++)
|
||||
{
|
||||
m_aEntries.push_back(aOldEntries[i]);
|
||||
m_vEntries.push_back(aOldEntries[i]);
|
||||
}
|
||||
for(; j < m_aNewEntries.size(); j++)
|
||||
for(; j < m_vNewEntries.size(); j++)
|
||||
{
|
||||
m_aEntries.push_back(m_aNewEntries[j]);
|
||||
m_vEntries.push_back(m_vNewEntries[j]);
|
||||
}
|
||||
}
|
||||
m_aNewEntries.clear();
|
||||
m_vNewEntries.clear();
|
||||
}
|
||||
*ppEntries = m_aEntries.data();
|
||||
*pNumEntries = m_aEntries.size();
|
||||
*ppEntries = m_vEntries.data();
|
||||
*pNumEntries = m_vEntries.size();
|
||||
}
|
||||
|
||||
IServerBrowserPingCache *CreateServerBrowserPingCache(IConsole *pConsole, IStorage *pStorage)
|
||||
|
|
|
@ -71,7 +71,7 @@ struct STextCharQuad
|
|||
struct STextureSkyline
|
||||
{
|
||||
// the height of each column
|
||||
std::vector<int> m_CurHeightOfPixelColumn;
|
||||
std::vector<int> m_vCurHeightOfPixelColumn;
|
||||
};
|
||||
|
||||
struct CFontSizeData
|
||||
|
@ -94,7 +94,7 @@ public:
|
|||
free(m_pBuf);
|
||||
delete[] m_TextureData[0];
|
||||
delete[] m_TextureData[1];
|
||||
for(auto &FtFallbackFont : m_FtFallbackFonts)
|
||||
for(auto &FtFallbackFont : m_vFtFallbackFonts)
|
||||
{
|
||||
free(FtFallbackFont.m_pBuf);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
FT_Face m_FtFace;
|
||||
};
|
||||
|
||||
std::vector<SFontFallBack> m_FtFallbackFonts;
|
||||
std::vector<SFontFallBack> m_vFtFallbackFonts;
|
||||
|
||||
CFontSizeData m_aFontSizes[NUM_FONT_SIZES];
|
||||
|
||||
|
@ -149,7 +149,7 @@ struct STextString
|
|||
size_t m_QuadNum;
|
||||
int m_SelectionQuadContainerIndex;
|
||||
|
||||
std::vector<STextCharQuad> m_CharacterQuads;
|
||||
std::vector<STextCharQuad> m_vCharacterQuads;
|
||||
};
|
||||
|
||||
struct STextContainer
|
||||
|
@ -191,7 +191,7 @@ struct STextContainer
|
|||
|
||||
m_StringInfo.m_QuadBufferObjectIndex = m_StringInfo.m_QuadBufferContainerIndex = m_StringInfo.m_SelectionQuadContainerIndex = -1;
|
||||
m_StringInfo.m_QuadNum = 0;
|
||||
m_StringInfo.m_CharacterQuads.clear();
|
||||
m_StringInfo.m_vCharacterQuads.clear();
|
||||
|
||||
m_AlignedStartX = m_AlignedStartY = m_X = m_Y = 0.f;
|
||||
m_Flags = m_LineCount = m_CharCount = m_GlyphCount = 0;
|
||||
|
@ -216,13 +216,13 @@ class CTextRender : public IEngineTextRender
|
|||
|
||||
unsigned int m_RenderFlags;
|
||||
|
||||
std::vector<STextContainer *> m_TextContainers;
|
||||
std::vector<int> m_TextContainerIndices;
|
||||
std::vector<STextContainer *> m_vpTextContainers;
|
||||
std::vector<int> m_vTextContainerIndices;
|
||||
int m_FirstFreeTextContainerIndex;
|
||||
|
||||
SBufferContainerInfo m_DefaultTextContainerInfo;
|
||||
|
||||
std::vector<CFont *> m_Fonts;
|
||||
std::vector<CFont *> m_vpFonts;
|
||||
CFont *m_pCurFont;
|
||||
|
||||
std::chrono::nanoseconds m_CursorRenderTime;
|
||||
|
@ -231,41 +231,41 @@ class CTextRender : public IEngineTextRender
|
|||
{
|
||||
if(m_FirstFreeTextContainerIndex == -1)
|
||||
{
|
||||
int Index = (int)m_TextContainerIndices.size();
|
||||
m_TextContainerIndices.push_back(Index);
|
||||
int Index = (int)m_vTextContainerIndices.size();
|
||||
m_vTextContainerIndices.push_back(Index);
|
||||
return Index;
|
||||
}
|
||||
else
|
||||
{
|
||||
int Index = m_FirstFreeTextContainerIndex;
|
||||
m_FirstFreeTextContainerIndex = m_TextContainerIndices[Index];
|
||||
m_TextContainerIndices[Index] = Index;
|
||||
m_FirstFreeTextContainerIndex = m_vTextContainerIndices[Index];
|
||||
m_vTextContainerIndices[Index] = Index;
|
||||
return Index;
|
||||
}
|
||||
}
|
||||
|
||||
void FreeTextContainerIndex(int Index)
|
||||
{
|
||||
m_TextContainerIndices[Index] = m_FirstFreeTextContainerIndex;
|
||||
m_vTextContainerIndices[Index] = m_FirstFreeTextContainerIndex;
|
||||
m_FirstFreeTextContainerIndex = Index;
|
||||
}
|
||||
|
||||
void FreeTextContainer(int Index)
|
||||
{
|
||||
m_TextContainers[Index]->Reset();
|
||||
m_vpTextContainers[Index]->Reset();
|
||||
FreeTextContainerIndex(Index);
|
||||
}
|
||||
|
||||
STextContainer &GetTextContainer(int Index)
|
||||
{
|
||||
if(Index >= (int)m_TextContainers.size())
|
||||
if(Index >= (int)m_vpTextContainers.size())
|
||||
{
|
||||
int Size = (int)m_TextContainers.size();
|
||||
int Size = (int)m_vpTextContainers.size();
|
||||
for(int i = 0; i < (Index + 1) - Size; ++i)
|
||||
m_TextContainers.push_back(new STextContainer());
|
||||
m_vpTextContainers.push_back(new STextContainer());
|
||||
}
|
||||
|
||||
return *m_TextContainers[Index];
|
||||
return *m_vpTextContainers[Index];
|
||||
}
|
||||
|
||||
int WordLength(const char *pText)
|
||||
|
@ -353,7 +353,7 @@ class CTextRender : public IEngineTextRender
|
|||
delete[] pFont->m_TextureData[TextureIndex];
|
||||
pFont->m_TextureData[TextureIndex] = pTmpTexBuffer;
|
||||
pFont->m_CurTextureDimensions[TextureIndex] = NewDimensions;
|
||||
pFont->m_TextureSkyline[TextureIndex].m_CurHeightOfPixelColumn.resize(NewDimensions, 0);
|
||||
pFont->m_TextureSkyline[TextureIndex].m_vCurHeightOfPixelColumn.resize(NewDimensions, 0);
|
||||
}
|
||||
|
||||
void IncreaseFontTexture(CFont *pFont)
|
||||
|
@ -400,7 +400,7 @@ class CTextRender : public IEngineTextRender
|
|||
return false;
|
||||
|
||||
// skyline bottom left algorithm
|
||||
std::vector<int> &SkylineHeights = pFont->m_TextureSkyline[TextureIndex].m_CurHeightOfPixelColumn;
|
||||
std::vector<int> &SkylineHeights = pFont->m_TextureSkyline[TextureIndex].m_vCurHeightOfPixelColumn;
|
||||
|
||||
// search a fitting area with less pixel loss
|
||||
int SmallestPixelLossAreaX = 0;
|
||||
|
@ -486,7 +486,7 @@ class CTextRender : public IEngineTextRender
|
|||
|
||||
if(GlyphIndex == 0)
|
||||
{
|
||||
for(CFont::SFontFallBack &FallbackFont : pFont->m_FtFallbackFonts)
|
||||
for(CFont::SFontFallBack &FallbackFont : pFont->m_vFtFallbackFonts)
|
||||
{
|
||||
FtFace = FallbackFont.m_FtFace;
|
||||
FT_Set_Pixel_Sizes(FtFace, 0, pSizeData->m_FontSize);
|
||||
|
@ -631,18 +631,18 @@ public:
|
|||
|
||||
virtual ~CTextRender()
|
||||
{
|
||||
for(auto *pTextCont : m_TextContainers)
|
||||
for(auto *pTextCont : m_vpTextContainers)
|
||||
{
|
||||
pTextCont->Reset();
|
||||
delete pTextCont;
|
||||
}
|
||||
m_TextContainers.clear();
|
||||
m_vpTextContainers.clear();
|
||||
|
||||
for(auto &pFont : m_Fonts)
|
||||
for(auto &pFont : m_vpFonts)
|
||||
{
|
||||
FT_Done_Face(pFont->m_FtFace);
|
||||
|
||||
for(CFont::SFontFallBack &FallbackFont : pFont->m_FtFallbackFonts)
|
||||
for(CFont::SFontFallBack &FallbackFont : pFont->m_vFtFallbackFonts)
|
||||
{
|
||||
FT_Done_Face(FallbackFont.m_FtFace);
|
||||
}
|
||||
|
@ -671,22 +671,22 @@ public:
|
|||
m_DefaultTextContainerInfo.m_Stride = sizeof(STextCharQuadVertex);
|
||||
m_DefaultTextContainerInfo.m_VertBufferBindingIndex = -1;
|
||||
|
||||
m_DefaultTextContainerInfo.m_Attributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &m_DefaultTextContainerInfo.m_Attributes.back();
|
||||
m_DefaultTextContainerInfo.m_vAttributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &m_DefaultTextContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 2;
|
||||
pAttr->m_FuncType = 0;
|
||||
pAttr->m_Normalized = false;
|
||||
pAttr->m_pOffset = 0;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
m_DefaultTextContainerInfo.m_Attributes.emplace_back();
|
||||
pAttr = &m_DefaultTextContainerInfo.m_Attributes.back();
|
||||
m_DefaultTextContainerInfo.m_vAttributes.emplace_back();
|
||||
pAttr = &m_DefaultTextContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 2;
|
||||
pAttr->m_FuncType = 0;
|
||||
pAttr->m_Normalized = false;
|
||||
pAttr->m_pOffset = (void *)(sizeof(float) * 2);
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
m_DefaultTextContainerInfo.m_Attributes.emplace_back();
|
||||
pAttr = &m_DefaultTextContainerInfo.m_Attributes.back();
|
||||
m_DefaultTextContainerInfo.m_vAttributes.emplace_back();
|
||||
pAttr = &m_DefaultTextContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 4;
|
||||
pAttr->m_FuncType = 0;
|
||||
pAttr->m_Normalized = true;
|
||||
|
@ -731,12 +731,12 @@ public:
|
|||
|
||||
InitTextures(pFont->m_CurTextureDimensions[0], pFont->m_CurTextureDimensions[0], pFont->m_aTextures, pFont->m_TextureData);
|
||||
|
||||
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->m_TextureSkyline[0].m_vCurHeightOfPixelColumn.resize(pFont->m_CurTextureDimensions[0], 0);
|
||||
pFont->m_TextureSkyline[1].m_vCurHeightOfPixelColumn.resize(pFont->m_CurTextureDimensions[1], 0);
|
||||
|
||||
pFont->InitFontSizes();
|
||||
|
||||
m_Fonts.push_back(pFont);
|
||||
m_vpFonts.push_back(pFont);
|
||||
|
||||
return pFont;
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ public:
|
|||
if(FT_New_Memory_Face(m_FTLibrary, pBuf, Size, 0, &FallbackFont.m_FtFace) == 0)
|
||||
{
|
||||
dbg_msg("textrender", "loaded fallback font from '%s'", pFilename);
|
||||
pFont->m_FtFallbackFonts.emplace_back(FallbackFont);
|
||||
pFont->m_vFtFallbackFonts.emplace_back(FallbackFont);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -760,15 +760,15 @@ public:
|
|||
|
||||
CFont *GetFont(int FontIndex) override
|
||||
{
|
||||
if(FontIndex >= 0 && FontIndex < (int)m_Fonts.size())
|
||||
return m_Fonts[FontIndex];
|
||||
if(FontIndex >= 0 && FontIndex < (int)m_vpFonts.size())
|
||||
return m_vpFonts[FontIndex];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CFont *GetFont(const char *pFilename) override
|
||||
{
|
||||
for(auto &pFont : m_Fonts)
|
||||
for(auto &pFont : m_vpFonts)
|
||||
{
|
||||
if(str_comp(pFilename, pFont->m_aFilename) == 0)
|
||||
return pFont;
|
||||
|
@ -983,15 +983,15 @@ public:
|
|||
|
||||
AppendTextContainer(pCursor, ContainerIndex, pText, Length);
|
||||
|
||||
if(TextContainer.m_StringInfo.m_CharacterQuads.empty() && TextContainer.m_StringInfo.m_SelectionQuadContainerIndex == -1 && IsRendered)
|
||||
if(TextContainer.m_StringInfo.m_vCharacterQuads.empty() && TextContainer.m_StringInfo.m_SelectionQuadContainerIndex == -1 && IsRendered)
|
||||
{
|
||||
FreeTextContainer(ContainerIndex);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
TextContainer.m_StringInfo.m_QuadNum = TextContainer.m_StringInfo.m_CharacterQuads.size();
|
||||
if(Graphics()->IsTextBufferingEnabled() && IsRendered && !TextContainer.m_StringInfo.m_CharacterQuads.empty())
|
||||
TextContainer.m_StringInfo.m_QuadNum = TextContainer.m_StringInfo.m_vCharacterQuads.size();
|
||||
if(Graphics()->IsTextBufferingEnabled() && IsRendered && !TextContainer.m_StringInfo.m_vCharacterQuads.empty())
|
||||
{
|
||||
if((TextContainer.m_RenderFlags & TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD) == 0)
|
||||
{
|
||||
|
@ -1305,8 +1305,8 @@ public:
|
|||
// don't add text that isn't drawn, the color overwrite is used for that
|
||||
if(m_Color.a != 0.f && IsRendered)
|
||||
{
|
||||
TextContainer.m_StringInfo.m_CharacterQuads.emplace_back();
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_CharacterQuads.back();
|
||||
TextContainer.m_StringInfo.m_vCharacterQuads.emplace_back();
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_vCharacterQuads.back();
|
||||
|
||||
TextCharQuad.m_Vertices[0].m_X = CharX;
|
||||
TextCharQuad.m_Vertices[0].m_Y = CharY;
|
||||
|
@ -1432,14 +1432,14 @@ public:
|
|||
GotNewLineLast = 0;
|
||||
}
|
||||
|
||||
if(!TextContainer.m_StringInfo.m_CharacterQuads.empty() && IsRendered)
|
||||
if(!TextContainer.m_StringInfo.m_vCharacterQuads.empty() && IsRendered)
|
||||
{
|
||||
TextContainer.m_StringInfo.m_QuadNum = TextContainer.m_StringInfo.m_CharacterQuads.size();
|
||||
TextContainer.m_StringInfo.m_QuadNum = TextContainer.m_StringInfo.m_vCharacterQuads.size();
|
||||
// setup the buffers
|
||||
if(Graphics()->IsTextBufferingEnabled())
|
||||
{
|
||||
size_t DataSize = TextContainer.m_StringInfo.m_CharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = &TextContainer.m_StringInfo.m_CharacterQuads[0];
|
||||
size_t DataSize = TextContainer.m_StringInfo.m_vCharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = &TextContainer.m_StringInfo.m_vCharacterQuads[0];
|
||||
|
||||
if(TextContainer.m_StringInfo.m_QuadBufferObjectIndex != -1 && (TextContainer.m_RenderFlags & TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD) == 0)
|
||||
{
|
||||
|
@ -1537,7 +1537,7 @@ public:
|
|||
void RecreateTextContainerSoft(CTextCursor *pCursor, int TextContainerIndex, const char *pText, int Length = -1) override
|
||||
{
|
||||
STextContainer &TextContainer = GetTextContainer(TextContainerIndex);
|
||||
TextContainer.m_StringInfo.m_CharacterQuads.clear();
|
||||
TextContainer.m_StringInfo.m_vCharacterQuads.clear();
|
||||
TextContainer.m_StringInfo.m_QuadNum = 0;
|
||||
// the text buffer gets then recreated by the appended quads
|
||||
AppendTextContainer(pCursor, TextContainerIndex, pText, Length);
|
||||
|
@ -1561,8 +1561,8 @@ public:
|
|||
if(Graphics()->IsTextBufferingEnabled())
|
||||
{
|
||||
STextContainer &TextContainer = GetTextContainer(TextContainerIndex);
|
||||
size_t DataSize = TextContainer.m_StringInfo.m_CharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = TextContainer.m_StringInfo.m_CharacterQuads.data();
|
||||
size_t DataSize = TextContainer.m_StringInfo.m_vCharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = TextContainer.m_StringInfo.m_vCharacterQuads.data();
|
||||
TextContainer.m_StringInfo.m_QuadBufferObjectIndex = Graphics()->CreateBufferObject(DataSize, pUploadData, TextContainer.m_SingleTimeUse ? IGraphics::EBufferObjectCreateFlags::BUFFER_OBJECT_CREATE_FLAGS_ONE_TIME_USE_BIT : 0);
|
||||
|
||||
m_DefaultTextContainerInfo.m_VertBufferBindingIndex = TextContainer.m_StringInfo.m_QuadBufferObjectIndex;
|
||||
|
@ -1608,7 +1608,7 @@ public:
|
|||
|
||||
for(size_t i = 0; i < TextContainer.m_StringInfo.m_QuadNum; ++i)
|
||||
{
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_CharacterQuads[i];
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_vCharacterQuads[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);
|
||||
|
||||
|
@ -1625,7 +1625,7 @@ public:
|
|||
|
||||
for(size_t i = 0; i < TextContainer.m_StringInfo.m_QuadNum; ++i)
|
||||
{
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_CharacterQuads[i];
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_vCharacterQuads[i];
|
||||
unsigned char CR = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.m_R) * pTextColor->m_R);
|
||||
unsigned char CG = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.m_G) * pTextColor->m_G);
|
||||
unsigned char CB = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.m_B) * pTextColor->m_B);
|
||||
|
@ -1940,7 +1940,7 @@ public:
|
|||
void OnWindowResize() override
|
||||
{
|
||||
bool HasNonEmptyTextContainer = false;
|
||||
for(auto *pTextContainer : m_TextContainers)
|
||||
for(auto *pTextContainer : m_vpTextContainers)
|
||||
{
|
||||
if(pTextContainer->m_StringInfo.m_QuadBufferContainerIndex != -1)
|
||||
{
|
||||
|
@ -1951,12 +1951,12 @@ public:
|
|||
|
||||
dbg_assert(!HasNonEmptyTextContainer, "text container was not empty");
|
||||
|
||||
for(auto &pFont : m_Fonts)
|
||||
for(auto &pFont : m_vpFonts)
|
||||
{
|
||||
// reset the skylines
|
||||
for(int j = 0; j < 2; ++j)
|
||||
{
|
||||
for(int &k : pFont->m_TextureSkyline[j].m_CurHeightOfPixelColumn)
|
||||
for(int &k : pFont->m_TextureSkyline[j].m_vCurHeightOfPixelColumn)
|
||||
k = 0;
|
||||
|
||||
mem_zero(pFont->m_TextureData[j], (size_t)pFont->m_CurTextureDimensions[j] * pFont->m_CurTextureDimensions[j] * sizeof(unsigned char));
|
||||
|
|
|
@ -34,7 +34,7 @@ struct SBufferContainerInfo
|
|||
//0: float, 1:integer
|
||||
unsigned int m_FuncType;
|
||||
};
|
||||
std::vector<SAttribute> m_Attributes;
|
||||
std::vector<SAttribute> m_vAttributes;
|
||||
};
|
||||
|
||||
struct SQuadRenderInfo
|
||||
|
@ -195,7 +195,7 @@ struct STWGraphicGPU
|
|||
char m_Name[256];
|
||||
ETWGraphicsGPUType m_GPUType;
|
||||
};
|
||||
std::vector<STWGraphicGPUItem> m_GPUs;
|
||||
std::vector<STWGraphicGPUItem> m_vGPUs;
|
||||
STWGraphicGPUItem m_AutoGPU;
|
||||
};
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ CDbConnectionPool::~CDbConnectionPool() = default;
|
|||
void CDbConnectionPool::Print(IConsole *pConsole, Mode DatabaseMode)
|
||||
{
|
||||
const char *ModeDesc[] = {"Read", "Write", "WriteBackup"};
|
||||
for(unsigned int i = 0; i < m_aapDbConnections[DatabaseMode].size(); i++)
|
||||
for(unsigned int i = 0; i < m_vvpDbConnections[DatabaseMode].size(); i++)
|
||||
{
|
||||
m_aapDbConnections[DatabaseMode][i]->Print(pConsole, ModeDesc[DatabaseMode]);
|
||||
m_vvpDbConnections[DatabaseMode][i]->Print(pConsole, ModeDesc[DatabaseMode]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void CDbConnectionPool::RegisterDatabase(std::unique_ptr<IDbConnection> pDatabas
|
|||
{
|
||||
if(DatabaseMode < 0 || NUM_MODES <= DatabaseMode)
|
||||
return;
|
||||
m_aapDbConnections[DatabaseMode].push_back(std::move(pDatabase));
|
||||
m_vvpDbConnections[DatabaseMode].push_back(std::move(pDatabase));
|
||||
}
|
||||
|
||||
void CDbConnectionPool::Execute(
|
||||
|
@ -157,7 +157,7 @@ void CDbConnectionPool::Worker()
|
|||
{
|
||||
case CSqlExecData::READ_ACCESS:
|
||||
{
|
||||
for(int i = 0; i < (int)m_aapDbConnections[Mode::READ].size(); i++)
|
||||
for(int i = 0; i < (int)m_vvpDbConnections[Mode::READ].size(); i++)
|
||||
{
|
||||
if(m_Shutdown)
|
||||
{
|
||||
|
@ -169,8 +169,8 @@ void CDbConnectionPool::Worker()
|
|||
dbg_msg("sql", "%s dismissed read request during FailMode", pThreadData->m_pName);
|
||||
break;
|
||||
}
|
||||
int CurServer = (ReadServer + i) % (int)m_aapDbConnections[Mode::READ].size();
|
||||
if(ExecSqlFunc(m_aapDbConnections[Mode::READ][CurServer].get(), pThreadData.get(), false))
|
||||
int CurServer = (ReadServer + i) % (int)m_vvpDbConnections[Mode::READ].size();
|
||||
if(ExecSqlFunc(m_vvpDbConnections[Mode::READ][CurServer].get(), pThreadData.get(), false))
|
||||
{
|
||||
ReadServer = CurServer;
|
||||
dbg_msg("sql", "%s done on read database %d", pThreadData->m_pName, CurServer);
|
||||
|
@ -186,20 +186,20 @@ void CDbConnectionPool::Worker()
|
|||
break;
|
||||
case CSqlExecData::WRITE_ACCESS:
|
||||
{
|
||||
for(int i = 0; i < (int)m_aapDbConnections[Mode::WRITE].size(); i++)
|
||||
for(int i = 0; i < (int)m_vvpDbConnections[Mode::WRITE].size(); i++)
|
||||
{
|
||||
if(m_Shutdown && !m_aapDbConnections[Mode::WRITE_BACKUP].empty())
|
||||
if(m_Shutdown && !m_vvpDbConnections[Mode::WRITE_BACKUP].empty())
|
||||
{
|
||||
dbg_msg("sql", "%s skipped to backup database during shutdown", pThreadData->m_pName);
|
||||
break;
|
||||
}
|
||||
if(FailMode && !m_aapDbConnections[Mode::WRITE_BACKUP].empty())
|
||||
if(FailMode && !m_vvpDbConnections[Mode::WRITE_BACKUP].empty())
|
||||
{
|
||||
dbg_msg("sql", "%s skipped to backup database during FailMode", pThreadData->m_pName);
|
||||
break;
|
||||
}
|
||||
int CurServer = (WriteServer + i) % (int)m_aapDbConnections[Mode::WRITE].size();
|
||||
if(ExecSqlFunc(m_aapDbConnections[Mode::WRITE][i].get(), pThreadData.get(), false))
|
||||
int CurServer = (WriteServer + i) % (int)m_vvpDbConnections[Mode::WRITE].size();
|
||||
if(ExecSqlFunc(m_vvpDbConnections[Mode::WRITE][i].get(), pThreadData.get(), false))
|
||||
{
|
||||
WriteServer = CurServer;
|
||||
dbg_msg("sql", "%s done on write database %d", pThreadData->m_pName, CurServer);
|
||||
|
@ -210,9 +210,9 @@ void CDbConnectionPool::Worker()
|
|||
if(!Success)
|
||||
{
|
||||
FailMode = true;
|
||||
for(int i = 0; i < (int)m_aapDbConnections[Mode::WRITE_BACKUP].size(); i++)
|
||||
for(int i = 0; i < (int)m_vvpDbConnections[Mode::WRITE_BACKUP].size(); i++)
|
||||
{
|
||||
if(ExecSqlFunc(m_aapDbConnections[Mode::WRITE_BACKUP][i].get(), pThreadData.get(), true))
|
||||
if(ExecSqlFunc(m_vvpDbConnections[Mode::WRITE_BACKUP][i].get(), pThreadData.get(), true))
|
||||
{
|
||||
dbg_msg("sql", "%s done on write backup database %d", pThreadData->m_pName, i);
|
||||
Success = true;
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
void OnShutdown();
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<IDbConnection>> m_aapDbConnections[NUM_MODES];
|
||||
std::vector<std::unique_ptr<IDbConnection>> m_vvpDbConnections[NUM_MODES];
|
||||
|
||||
static void Worker(void *pUser);
|
||||
void Worker();
|
||||
|
|
|
@ -129,8 +129,8 @@ private:
|
|||
bool m_HaveConnection = false;
|
||||
MYSQL m_Mysql;
|
||||
std::unique_ptr<MYSQL_STMT, CStmtDeleter> m_pStmt = nullptr;
|
||||
std::vector<MYSQL_BIND> m_aStmtParameters;
|
||||
std::vector<UParameterExtra> m_aStmtParameterExtras;
|
||||
std::vector<MYSQL_BIND> m_vStmtParameters;
|
||||
std::vector<UParameterExtra> m_vStmtParameterExtras;
|
||||
|
||||
// copy of config vars
|
||||
char m_aDatabase[64];
|
||||
|
@ -348,10 +348,10 @@ bool CMysqlConnection::PrepareStatement(const char *pStmt, char *pError, int Err
|
|||
}
|
||||
m_NewQuery = true;
|
||||
unsigned NumParameters = mysql_stmt_param_count(m_pStmt.get());
|
||||
m_aStmtParameters.resize(NumParameters);
|
||||
m_aStmtParameterExtras.resize(NumParameters);
|
||||
mem_zero(&m_aStmtParameters[0], sizeof(m_aStmtParameters[0]) * m_aStmtParameters.size());
|
||||
mem_zero(&m_aStmtParameterExtras[0], sizeof(m_aStmtParameterExtras[0]) * m_aStmtParameterExtras.size());
|
||||
m_vStmtParameters.resize(NumParameters);
|
||||
m_vStmtParameterExtras.resize(NumParameters);
|
||||
mem_zero(&m_vStmtParameters[0], sizeof(m_vStmtParameters[0]) * m_vStmtParameters.size());
|
||||
mem_zero(&m_vStmtParameterExtras[0], sizeof(m_vStmtParameterExtras[0]) * m_vStmtParameterExtras.size());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -359,15 +359,15 @@ void CMysqlConnection::BindString(int Idx, const char *pString)
|
|||
{
|
||||
m_NewQuery = true;
|
||||
Idx -= 1;
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_aStmtParameters.size(), "index out of bounds");
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_vStmtParameters.size(), "index out of bounds");
|
||||
|
||||
int Length = str_length(pString);
|
||||
m_aStmtParameterExtras[Idx].ul = Length;
|
||||
MYSQL_BIND *pParam = &m_aStmtParameters[Idx];
|
||||
m_vStmtParameterExtras[Idx].ul = Length;
|
||||
MYSQL_BIND *pParam = &m_vStmtParameters[Idx];
|
||||
pParam->buffer_type = MYSQL_TYPE_STRING;
|
||||
pParam->buffer = (void *)pString;
|
||||
pParam->buffer_length = Length + 1;
|
||||
pParam->length = &m_aStmtParameterExtras[Idx].ul;
|
||||
pParam->length = &m_vStmtParameterExtras[Idx].ul;
|
||||
pParam->is_null = nullptr;
|
||||
pParam->is_unsigned = false;
|
||||
pParam->error = nullptr;
|
||||
|
@ -377,14 +377,14 @@ void CMysqlConnection::BindBlob(int Idx, unsigned char *pBlob, int Size)
|
|||
{
|
||||
m_NewQuery = true;
|
||||
Idx -= 1;
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_aStmtParameters.size(), "index out of bounds");
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_vStmtParameters.size(), "index out of bounds");
|
||||
|
||||
m_aStmtParameterExtras[Idx].ul = Size;
|
||||
MYSQL_BIND *pParam = &m_aStmtParameters[Idx];
|
||||
m_vStmtParameterExtras[Idx].ul = Size;
|
||||
MYSQL_BIND *pParam = &m_vStmtParameters[Idx];
|
||||
pParam->buffer_type = MYSQL_TYPE_BLOB;
|
||||
pParam->buffer = pBlob;
|
||||
pParam->buffer_length = Size;
|
||||
pParam->length = &m_aStmtParameterExtras[Idx].ul;
|
||||
pParam->length = &m_vStmtParameterExtras[Idx].ul;
|
||||
pParam->is_null = nullptr;
|
||||
pParam->is_unsigned = false;
|
||||
pParam->error = nullptr;
|
||||
|
@ -394,13 +394,13 @@ void CMysqlConnection::BindInt(int Idx, int Value)
|
|||
{
|
||||
m_NewQuery = true;
|
||||
Idx -= 1;
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_aStmtParameters.size(), "index out of bounds");
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_vStmtParameters.size(), "index out of bounds");
|
||||
|
||||
m_aStmtParameterExtras[Idx].i = Value;
|
||||
MYSQL_BIND *pParam = &m_aStmtParameters[Idx];
|
||||
m_vStmtParameterExtras[Idx].i = Value;
|
||||
MYSQL_BIND *pParam = &m_vStmtParameters[Idx];
|
||||
pParam->buffer_type = MYSQL_TYPE_LONG;
|
||||
pParam->buffer = &m_aStmtParameterExtras[Idx].i;
|
||||
pParam->buffer_length = sizeof(m_aStmtParameterExtras[Idx].i);
|
||||
pParam->buffer = &m_vStmtParameterExtras[Idx].i;
|
||||
pParam->buffer_length = sizeof(m_vStmtParameterExtras[Idx].i);
|
||||
pParam->length = nullptr;
|
||||
pParam->is_null = nullptr;
|
||||
pParam->is_unsigned = false;
|
||||
|
@ -411,13 +411,13 @@ void CMysqlConnection::BindInt64(int Idx, int64_t Value)
|
|||
{
|
||||
m_NewQuery = true;
|
||||
Idx -= 1;
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_aStmtParameters.size(), "index out of bounds");
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_vStmtParameters.size(), "index out of bounds");
|
||||
|
||||
m_aStmtParameterExtras[Idx].i = Value;
|
||||
MYSQL_BIND *pParam = &m_aStmtParameters[Idx];
|
||||
m_vStmtParameterExtras[Idx].i = Value;
|
||||
MYSQL_BIND *pParam = &m_vStmtParameters[Idx];
|
||||
pParam->buffer_type = MYSQL_TYPE_LONGLONG;
|
||||
pParam->buffer = &m_aStmtParameterExtras[Idx].i;
|
||||
pParam->buffer_length = sizeof(m_aStmtParameterExtras[Idx].i);
|
||||
pParam->buffer = &m_vStmtParameterExtras[Idx].i;
|
||||
pParam->buffer_length = sizeof(m_vStmtParameterExtras[Idx].i);
|
||||
pParam->length = nullptr;
|
||||
pParam->is_null = nullptr;
|
||||
pParam->is_unsigned = false;
|
||||
|
@ -428,13 +428,13 @@ void CMysqlConnection::BindFloat(int Idx, float Value)
|
|||
{
|
||||
m_NewQuery = true;
|
||||
Idx -= 1;
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_aStmtParameters.size(), "index out of bounds");
|
||||
dbg_assert(0 <= Idx && Idx < (int)m_vStmtParameters.size(), "index out of bounds");
|
||||
|
||||
m_aStmtParameterExtras[Idx].f = Value;
|
||||
MYSQL_BIND *pParam = &m_aStmtParameters[Idx];
|
||||
m_vStmtParameterExtras[Idx].f = Value;
|
||||
MYSQL_BIND *pParam = &m_vStmtParameters[Idx];
|
||||
pParam->buffer_type = MYSQL_TYPE_FLOAT;
|
||||
pParam->buffer = &m_aStmtParameterExtras[Idx].f;
|
||||
pParam->buffer_length = sizeof(m_aStmtParameterExtras[Idx].i);
|
||||
pParam->buffer = &m_vStmtParameterExtras[Idx].f;
|
||||
pParam->buffer_length = sizeof(m_vStmtParameterExtras[Idx].i);
|
||||
pParam->length = nullptr;
|
||||
pParam->is_null = nullptr;
|
||||
pParam->is_unsigned = false;
|
||||
|
@ -446,7 +446,7 @@ bool CMysqlConnection::Step(bool *pEnd, char *pError, int ErrorSize)
|
|||
if(m_NewQuery)
|
||||
{
|
||||
m_NewQuery = false;
|
||||
if(mysql_stmt_bind_param(m_pStmt.get(), &m_aStmtParameters[0]))
|
||||
if(mysql_stmt_bind_param(m_pStmt.get(), &m_vStmtParameters[0]))
|
||||
{
|
||||
StoreErrorStmt("bind_param");
|
||||
str_copy(pError, m_aErrorDetail, ErrorSize);
|
||||
|
@ -477,7 +477,7 @@ bool CMysqlConnection::ExecuteUpdate(int *pNumUpdated, char *pError, int ErrorSi
|
|||
if(m_NewQuery)
|
||||
{
|
||||
m_NewQuery = false;
|
||||
if(mysql_stmt_bind_param(m_pStmt.get(), &m_aStmtParameters[0]))
|
||||
if(mysql_stmt_bind_param(m_pStmt.get(), &m_vStmtParameters[0]))
|
||||
{
|
||||
StoreErrorStmt("bind_param");
|
||||
str_copy(pError, m_aErrorDetail, ErrorSize);
|
||||
|
|
|
@ -278,7 +278,7 @@ class CServerLogger : public ILogger
|
|||
{
|
||||
CServer *m_pServer;
|
||||
std::mutex m_PendingLock;
|
||||
std::vector<CLogMessage> m_aPending;
|
||||
std::vector<CLogMessage> m_vPending;
|
||||
std::thread::id m_MainThread;
|
||||
|
||||
public:
|
||||
|
@ -298,23 +298,23 @@ void CServerLogger::Log(const CLogMessage *pMessage)
|
|||
m_PendingLock.lock();
|
||||
if(m_MainThread == std::this_thread::get_id())
|
||||
{
|
||||
if(!m_aPending.empty())
|
||||
if(!m_vPending.empty())
|
||||
{
|
||||
if(m_pServer)
|
||||
{
|
||||
for(const auto &Message : m_aPending)
|
||||
for(const auto &Message : m_vPending)
|
||||
{
|
||||
m_pServer->SendLogLine(&Message);
|
||||
}
|
||||
}
|
||||
m_aPending.clear();
|
||||
m_vPending.clear();
|
||||
}
|
||||
m_PendingLock.unlock();
|
||||
m_pServer->SendLogLine(pMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_aPending.push_back(*pMessage);
|
||||
m_vPending.push_back(*pMessage);
|
||||
m_PendingLock.unlock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ CChat::CChat()
|
|||
|
||||
#define CHAT_COMMAND(name, params, flags, callback, userdata, help) RegisterCommand(name, params, flags, help);
|
||||
#include <game/ddracechat.h>
|
||||
std::sort(m_Commands.begin(), m_Commands.end());
|
||||
std::sort(m_vCommands.begin(), m_vCommands.end());
|
||||
|
||||
m_Mode = MODE_NONE;
|
||||
Reset();
|
||||
|
@ -40,7 +40,7 @@ CChat::CChat()
|
|||
|
||||
void CChat::RegisterCommand(const char *pName, const char *pParams, int flags, const char *pHelp)
|
||||
{
|
||||
m_Commands.emplace_back(pName, pParams);
|
||||
m_vCommands.emplace_back(pName, pParams);
|
||||
}
|
||||
|
||||
void CChat::RebuildChat()
|
||||
|
@ -349,7 +349,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
{
|
||||
CCommand *pCompletionCommand = 0;
|
||||
|
||||
const size_t NumCommands = m_Commands.size();
|
||||
const size_t NumCommands = m_vCommands.size();
|
||||
|
||||
if(m_ReverseTAB && m_CompletionUsed)
|
||||
m_CompletionChosen--;
|
||||
|
@ -376,7 +376,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
Index = (m_CompletionChosen + i) % NumCommands;
|
||||
}
|
||||
|
||||
auto &Command = m_Commands[Index];
|
||||
auto &Command = m_vCommands[Index];
|
||||
|
||||
if(str_startswith(Command.m_pName, pCommandStart))
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@ class CChat : public CComponent
|
|||
bool operator==(const CCommand &Other) const { return str_comp(m_pName, Other.m_pName) == 0; }
|
||||
};
|
||||
|
||||
std::vector<CCommand> m_Commands;
|
||||
std::vector<CCommand> m_vCommands;
|
||||
bool m_ReverseTAB;
|
||||
|
||||
struct CHistoryEntry
|
||||
|
|
|
@ -80,15 +80,15 @@ void CCountryFlags::LoadCountryflagsIndexfile()
|
|||
str_format(aBuf, sizeof(aBuf), "loaded country flag '%s'", aOrigin);
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "countryflags", aBuf);
|
||||
}
|
||||
m_aCountryFlags.push_back(CountryFlag);
|
||||
m_vCountryFlags.push_back(CountryFlag);
|
||||
}
|
||||
io_close(File);
|
||||
std::sort(m_aCountryFlags.begin(), m_aCountryFlags.end());
|
||||
std::sort(m_vCountryFlags.begin(), m_vCountryFlags.end());
|
||||
|
||||
// find index of default item
|
||||
size_t DefaultIndex = 0;
|
||||
for(size_t Index = 0; Index < m_aCountryFlags.size(); ++Index)
|
||||
if(m_aCountryFlags[Index].m_CountryCode == -1)
|
||||
for(size_t Index = 0; Index < m_vCountryFlags.size(); ++Index)
|
||||
if(m_vCountryFlags[Index].m_CountryCode == -1)
|
||||
{
|
||||
DefaultIndex = Index;
|
||||
break;
|
||||
|
@ -100,22 +100,22 @@ void CCountryFlags::LoadCountryflagsIndexfile()
|
|||
CodeIndexLUT = DefaultIndex;
|
||||
else
|
||||
mem_zero(m_CodeIndexLUT, sizeof(m_CodeIndexLUT));
|
||||
for(size_t i = 0; i < m_aCountryFlags.size(); ++i)
|
||||
m_CodeIndexLUT[maximum(0, (m_aCountryFlags[i].m_CountryCode - CODE_LB) % CODE_RANGE)] = i;
|
||||
for(size_t i = 0; i < m_vCountryFlags.size(); ++i)
|
||||
m_CodeIndexLUT[maximum(0, (m_vCountryFlags[i].m_CountryCode - CODE_LB) % CODE_RANGE)] = i;
|
||||
}
|
||||
|
||||
void CCountryFlags::OnInit()
|
||||
{
|
||||
// load country flags
|
||||
m_aCountryFlags.clear();
|
||||
m_vCountryFlags.clear();
|
||||
LoadCountryflagsIndexfile();
|
||||
if(m_aCountryFlags.empty())
|
||||
if(m_vCountryFlags.empty())
|
||||
{
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "countryflags", "failed to load country flags. folder='countryflags/'");
|
||||
CCountryFlag DummyEntry;
|
||||
DummyEntry.m_CountryCode = -1;
|
||||
mem_zero(DummyEntry.m_aCountryCodeString, sizeof(DummyEntry.m_aCountryCodeString));
|
||||
m_aCountryFlags.push_back(DummyEntry);
|
||||
m_vCountryFlags.push_back(DummyEntry);
|
||||
}
|
||||
|
||||
m_FlagsQuadContainerIndex = Graphics()->CreateQuadContainer(false);
|
||||
|
@ -127,7 +127,7 @@ void CCountryFlags::OnInit()
|
|||
|
||||
size_t CCountryFlags::Num() const
|
||||
{
|
||||
return m_aCountryFlags.size();
|
||||
return m_vCountryFlags.size();
|
||||
}
|
||||
|
||||
const CCountryFlags::CCountryFlag *CCountryFlags::GetByCountryCode(int CountryCode) const
|
||||
|
@ -137,7 +137,7 @@ const CCountryFlags::CCountryFlag *CCountryFlags::GetByCountryCode(int CountryCo
|
|||
|
||||
const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(size_t Index) const
|
||||
{
|
||||
return &m_aCountryFlags[Index % m_aCountryFlags.size()];
|
||||
return &m_vCountryFlags[Index % m_vCountryFlags.size()];
|
||||
}
|
||||
|
||||
void CCountryFlags::Render(int CountryCode, const ColorRGBA *pColor, float x, float y, float w, float h)
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
CODE_UB = 999,
|
||||
CODE_RANGE = CODE_UB - CODE_LB + 1,
|
||||
};
|
||||
std::vector<CCountryFlag> m_aCountryFlags;
|
||||
std::vector<CCountryFlag> m_vCountryFlags;
|
||||
size_t m_CodeIndexLUT[CODE_RANGE];
|
||||
|
||||
int m_FlagsQuadContainerIndex;
|
||||
|
|
|
@ -61,41 +61,41 @@ void CGhost::GetNetObjCharacter(CNetObj_Character *pChar, const CGhostCharacter
|
|||
}
|
||||
|
||||
CGhost::CGhostPath::CGhostPath(CGhostPath &&Other) noexcept :
|
||||
m_ChunkSize(Other.m_ChunkSize), m_NumItems(Other.m_NumItems), m_lChunks(std::move(Other.m_lChunks))
|
||||
m_ChunkSize(Other.m_ChunkSize), m_NumItems(Other.m_NumItems), m_vpChunks(std::move(Other.m_vpChunks))
|
||||
{
|
||||
Other.m_NumItems = 0;
|
||||
Other.m_lChunks.clear();
|
||||
Other.m_vpChunks.clear();
|
||||
}
|
||||
|
||||
CGhost::CGhostPath &CGhost::CGhostPath::operator=(CGhostPath &&Other) noexcept
|
||||
{
|
||||
Reset(Other.m_ChunkSize);
|
||||
m_NumItems = Other.m_NumItems;
|
||||
m_lChunks = std::move(Other.m_lChunks);
|
||||
m_vpChunks = std::move(Other.m_vpChunks);
|
||||
Other.m_NumItems = 0;
|
||||
Other.m_lChunks.clear();
|
||||
Other.m_vpChunks.clear();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CGhost::CGhostPath::Reset(int ChunkSize)
|
||||
{
|
||||
for(auto &pChunk : m_lChunks)
|
||||
for(auto &pChunk : m_vpChunks)
|
||||
free(pChunk);
|
||||
m_lChunks.clear();
|
||||
m_vpChunks.clear();
|
||||
m_ChunkSize = ChunkSize;
|
||||
m_NumItems = 0;
|
||||
}
|
||||
|
||||
void CGhost::CGhostPath::SetSize(int Items)
|
||||
{
|
||||
int Chunks = m_lChunks.size();
|
||||
int Chunks = m_vpChunks.size();
|
||||
int NeededChunks = (Items + m_ChunkSize - 1) / m_ChunkSize;
|
||||
|
||||
if(NeededChunks > Chunks)
|
||||
{
|
||||
m_lChunks.resize(NeededChunks);
|
||||
m_vpChunks.resize(NeededChunks);
|
||||
for(int i = Chunks; i < NeededChunks; i++)
|
||||
m_lChunks[i] = (CGhostCharacter *)calloc(m_ChunkSize, sizeof(CGhostCharacter));
|
||||
m_vpChunks[i] = (CGhostCharacter *)calloc(m_ChunkSize, sizeof(CGhostCharacter));
|
||||
}
|
||||
|
||||
m_NumItems = Items;
|
||||
|
@ -114,7 +114,7 @@ CGhostCharacter *CGhost::CGhostPath::Get(int Index)
|
|||
|
||||
int Chunk = Index / m_ChunkSize;
|
||||
int Pos = Index % m_ChunkSize;
|
||||
return &m_lChunks[Chunk][Pos];
|
||||
return &m_vpChunks[Chunk][Pos];
|
||||
}
|
||||
|
||||
void CGhost::GetPath(char *pBuf, int Size, const char *pPlayerName, int Time) const
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
int m_ChunkSize;
|
||||
int m_NumItems;
|
||||
|
||||
std::vector<CGhostCharacter *> m_lChunks;
|
||||
std::vector<CGhostCharacter *> m_vpChunks;
|
||||
|
||||
public:
|
||||
CGhostPath() { Reset(); }
|
||||
|
|
|
@ -390,20 +390,20 @@ void mem_copy_special(void *pDest, void *pSource, size_t Size, size_t Count, siz
|
|||
CMapLayers::~CMapLayers()
|
||||
{
|
||||
//clear everything and destroy all buffers
|
||||
if(!m_TileLayerVisuals.empty())
|
||||
if(!m_vpTileLayerVisuals.empty())
|
||||
{
|
||||
int s = m_TileLayerVisuals.size();
|
||||
int s = m_vpTileLayerVisuals.size();
|
||||
for(int i = 0; i < s; ++i)
|
||||
{
|
||||
delete m_TileLayerVisuals[i];
|
||||
delete m_vpTileLayerVisuals[i];
|
||||
}
|
||||
}
|
||||
if(!m_QuadLayerVisuals.empty())
|
||||
if(!m_vpQuadLayerVisuals.empty())
|
||||
{
|
||||
int s = m_QuadLayerVisuals.size();
|
||||
int s = m_vpQuadLayerVisuals.size();
|
||||
for(int i = 0; i < s; ++i)
|
||||
{
|
||||
delete m_QuadLayerVisuals[i];
|
||||
delete m_vpQuadLayerVisuals[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,25 +413,25 @@ void CMapLayers::OnMapLoad()
|
|||
if(!Graphics()->IsTileBufferingEnabled() && !Graphics()->IsQuadBufferingEnabled())
|
||||
return;
|
||||
//clear everything and destroy all buffers
|
||||
if(!m_TileLayerVisuals.empty())
|
||||
if(!m_vpTileLayerVisuals.empty())
|
||||
{
|
||||
int s = m_TileLayerVisuals.size();
|
||||
int s = m_vpTileLayerVisuals.size();
|
||||
for(int i = 0; i < s; ++i)
|
||||
{
|
||||
Graphics()->DeleteBufferContainer(m_TileLayerVisuals[i]->m_BufferContainerIndex, true);
|
||||
delete m_TileLayerVisuals[i];
|
||||
Graphics()->DeleteBufferContainer(m_vpTileLayerVisuals[i]->m_BufferContainerIndex, true);
|
||||
delete m_vpTileLayerVisuals[i];
|
||||
}
|
||||
m_TileLayerVisuals.clear();
|
||||
m_vpTileLayerVisuals.clear();
|
||||
}
|
||||
if(!m_QuadLayerVisuals.empty())
|
||||
if(!m_vpQuadLayerVisuals.empty())
|
||||
{
|
||||
int s = m_QuadLayerVisuals.size();
|
||||
int s = m_vpQuadLayerVisuals.size();
|
||||
for(int i = 0; i < s; ++i)
|
||||
{
|
||||
Graphics()->DeleteBufferContainer(m_QuadLayerVisuals[i]->m_BufferContainerIndex, true);
|
||||
delete m_QuadLayerVisuals[i];
|
||||
Graphics()->DeleteBufferContainer(m_vpQuadLayerVisuals[i]->m_BufferContainerIndex, true);
|
||||
delete m_vpQuadLayerVisuals[i];
|
||||
}
|
||||
m_QuadLayerVisuals.clear();
|
||||
m_vpQuadLayerVisuals.clear();
|
||||
}
|
||||
|
||||
bool PassedGameLayer = false;
|
||||
|
@ -566,8 +566,8 @@ void CMapLayers::OnMapLoad()
|
|||
while(CurOverlay < OverlayCount + 1)
|
||||
{
|
||||
// We can later just count the tile layers to get the idx in the vector
|
||||
m_TileLayerVisuals.push_back(new STileLayerVisuals());
|
||||
STileLayerVisuals &Visuals = *m_TileLayerVisuals.back();
|
||||
m_vpTileLayerVisuals.push_back(new STileLayerVisuals());
|
||||
STileLayerVisuals &Visuals = *m_vpTileLayerVisuals.back();
|
||||
if(!Visuals.Init(pTMap->m_Width, pTMap->m_Height))
|
||||
{
|
||||
++CurOverlay;
|
||||
|
@ -841,8 +841,8 @@ void CMapLayers::OnMapLoad()
|
|||
SBufferContainerInfo ContainerInfo;
|
||||
ContainerInfo.m_Stride = (DoTextureCoords ? (sizeof(float) * 2 + sizeof(vec3)) : 0);
|
||||
ContainerInfo.m_VertBufferBindingIndex = BufferObjectIndex;
|
||||
ContainerInfo.m_Attributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &ContainerInfo.m_Attributes.back();
|
||||
ContainerInfo.m_vAttributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &ContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 2;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
pAttr->m_Normalized = false;
|
||||
|
@ -850,8 +850,8 @@ void CMapLayers::OnMapLoad()
|
|||
pAttr->m_FuncType = 0;
|
||||
if(DoTextureCoords)
|
||||
{
|
||||
ContainerInfo.m_Attributes.emplace_back();
|
||||
pAttr = &ContainerInfo.m_Attributes.back();
|
||||
ContainerInfo.m_vAttributes.emplace_back();
|
||||
pAttr = &ContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 3;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
pAttr->m_Normalized = false;
|
||||
|
@ -872,8 +872,8 @@ void CMapLayers::OnMapLoad()
|
|||
{
|
||||
CMapItemLayerQuads *pQLayer = (CMapItemLayerQuads *)pLayer;
|
||||
|
||||
m_QuadLayerVisuals.push_back(new SQuadLayerVisuals());
|
||||
SQuadLayerVisuals *pQLayerVisuals = m_QuadLayerVisuals.back();
|
||||
m_vpQuadLayerVisuals.push_back(new SQuadLayerVisuals());
|
||||
SQuadLayerVisuals *pQLayerVisuals = m_vpQuadLayerVisuals.back();
|
||||
|
||||
bool Textured = (pQLayer->m_Image != -1);
|
||||
|
||||
|
@ -944,15 +944,15 @@ void CMapLayers::OnMapLoad()
|
|||
SBufferContainerInfo ContainerInfo;
|
||||
ContainerInfo.m_Stride = (Textured ? (sizeof(STmpQuadTextured) / 4) : (sizeof(STmpQuad) / 4));
|
||||
ContainerInfo.m_VertBufferBindingIndex = BufferObjectIndex;
|
||||
ContainerInfo.m_Attributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &ContainerInfo.m_Attributes.back();
|
||||
ContainerInfo.m_vAttributes.emplace_back();
|
||||
SBufferContainerInfo::SAttribute *pAttr = &ContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 4;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
pAttr->m_Normalized = false;
|
||||
pAttr->m_pOffset = 0;
|
||||
pAttr->m_FuncType = 0;
|
||||
ContainerInfo.m_Attributes.emplace_back();
|
||||
pAttr = &ContainerInfo.m_Attributes.back();
|
||||
ContainerInfo.m_vAttributes.emplace_back();
|
||||
pAttr = &ContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 4;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_UNSIGNED_BYTE;
|
||||
pAttr->m_Normalized = true;
|
||||
|
@ -960,8 +960,8 @@ void CMapLayers::OnMapLoad()
|
|||
pAttr->m_FuncType = 0;
|
||||
if(Textured)
|
||||
{
|
||||
ContainerInfo.m_Attributes.emplace_back();
|
||||
pAttr = &ContainerInfo.m_Attributes.back();
|
||||
ContainerInfo.m_vAttributes.emplace_back();
|
||||
pAttr = &ContainerInfo.m_vAttributes.back();
|
||||
pAttr->m_DataTypeCount = 2;
|
||||
pAttr->m_Type = GRAPHICS_TYPE_FLOAT;
|
||||
pAttr->m_Normalized = false;
|
||||
|
@ -980,7 +980,7 @@ void CMapLayers::OnMapLoad()
|
|||
|
||||
void CMapLayers::RenderTileLayer(int LayerIndex, ColorRGBA *pColor, CMapItemLayerTilemap *pTileLayer, CMapItemGroup *pGroup)
|
||||
{
|
||||
STileLayerVisuals &Visuals = *m_TileLayerVisuals[LayerIndex];
|
||||
STileLayerVisuals &Visuals = *m_vpTileLayerVisuals[LayerIndex];
|
||||
if(Visuals.m_BufferContainerIndex == -1)
|
||||
return; //no visuals were created
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ void CMapLayers::RenderTileBorderCornerTiles(int WidthOffsetToOrigin, int Height
|
|||
|
||||
void CMapLayers::RenderTileBorder(int LayerIndex, ColorRGBA *pColor, CMapItemLayerTilemap *pTileLayer, CMapItemGroup *pGroup, int BorderX0, int BorderY0, int BorderX1, int BorderY1, int ScreenWidthTileCount, int ScreenHeightTileCount)
|
||||
{
|
||||
STileLayerVisuals &Visuals = *m_TileLayerVisuals[LayerIndex];
|
||||
STileLayerVisuals &Visuals = *m_vpTileLayerVisuals[LayerIndex];
|
||||
|
||||
int Y0 = BorderY0;
|
||||
int X0 = BorderX0;
|
||||
|
@ -1249,7 +1249,7 @@ void CMapLayers::RenderTileBorder(int LayerIndex, ColorRGBA *pColor, CMapItemLay
|
|||
|
||||
void CMapLayers::RenderKillTileBorder(int LayerIndex, ColorRGBA *pColor, CMapItemLayerTilemap *pTileLayer, CMapItemGroup *pGroup)
|
||||
{
|
||||
STileLayerVisuals &Visuals = *m_TileLayerVisuals[LayerIndex];
|
||||
STileLayerVisuals &Visuals = *m_vpTileLayerVisuals[LayerIndex];
|
||||
if(Visuals.m_BufferContainerIndex == -1)
|
||||
return; //no visuals were created
|
||||
|
||||
|
@ -1361,7 +1361,7 @@ void CMapLayers::RenderKillTileBorder(int LayerIndex, ColorRGBA *pColor, CMapIte
|
|||
|
||||
void CMapLayers::RenderQuadLayer(int LayerIndex, CMapItemLayerQuads *pQuadLayer, CMapItemGroup *pGroup, bool Force)
|
||||
{
|
||||
SQuadLayerVisuals &Visuals = *m_QuadLayerVisuals[LayerIndex];
|
||||
SQuadLayerVisuals &Visuals = *m_vpQuadLayerVisuals[LayerIndex];
|
||||
if(Visuals.m_BufferContainerIndex == -1)
|
||||
return; //no visuals were created
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class CMapLayers : public CComponent
|
|||
int m_BufferContainerIndex;
|
||||
bool m_IsTextured;
|
||||
};
|
||||
std::vector<STileLayerVisuals *> m_TileLayerVisuals;
|
||||
std::vector<STileLayerVisuals *> m_vpTileLayerVisuals;
|
||||
|
||||
struct SQuadLayerVisuals
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ class CMapLayers : public CComponent
|
|||
int m_BufferContainerIndex;
|
||||
bool m_IsTextured;
|
||||
};
|
||||
std::vector<SQuadLayerVisuals *> m_QuadLayerVisuals;
|
||||
std::vector<SQuadLayerVisuals *> m_vpQuadLayerVisuals;
|
||||
|
||||
virtual class CCamera *GetCurCamera();
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ int CMenuBackground::ThemeScan(const char *pName, int IsDir, int DirType, void *
|
|||
return 0;
|
||||
|
||||
// try to edit an existing theme
|
||||
for(auto &Theme : pSelf->m_lThemes)
|
||||
for(auto &Theme : pSelf->m_vThemes)
|
||||
{
|
||||
if(str_comp(Theme.m_Name.c_str(), aThemeName) == 0)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ int CMenuBackground::ThemeScan(const char *pName, int IsDir, int DirType, void *
|
|||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "added theme %s from themes/%s", aThemeName, pName);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "game", aBuf);
|
||||
pSelf->m_lThemes.push_back(Theme);
|
||||
pSelf->m_vThemes.push_back(Theme);
|
||||
auto TimeNow = tw::time_get();
|
||||
if(TimeNow - pSelf->m_ThemeScanStartTime >= std::chrono::nanoseconds(1s) / 60)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ int CMenuBackground::ThemeIconScan(const char *pName, int IsDir, int DirType, vo
|
|||
str_truncate(aThemeName, sizeof(aThemeName), pName, pSuffix - pName);
|
||||
|
||||
// save icon for an existing theme
|
||||
for(CTheme &Theme : pSelf->m_lThemes) // bit slow but whatever
|
||||
for(CTheme &Theme : pSelf->m_vThemes) // bit slow but whatever
|
||||
{
|
||||
if(str_comp(Theme.m_Name.c_str(), aThemeName) == 0 || (Theme.m_Name.empty() && str_comp(aThemeName, "none") == 0))
|
||||
{
|
||||
|
@ -396,18 +396,18 @@ void CMenuBackground::ChangePosition(int PositionNumber)
|
|||
|
||||
std::vector<CTheme> &CMenuBackground::GetThemes()
|
||||
{
|
||||
if(m_lThemes.empty()) // not loaded yet
|
||||
if(m_vThemes.empty()) // not loaded yet
|
||||
{
|
||||
// when adding more here, make sure to change the value of PREDEFINED_THEMES_COUNT too
|
||||
m_lThemes.emplace_back("", true, true); // no theme
|
||||
m_lThemes.emplace_back("auto", true, true); // auto theme
|
||||
m_lThemes.emplace_back("rand", true, true); // random theme
|
||||
m_vThemes.emplace_back("", true, true); // no theme
|
||||
m_vThemes.emplace_back("auto", true, true); // auto theme
|
||||
m_vThemes.emplace_back("rand", true, true); // random theme
|
||||
|
||||
m_ThemeScanStartTime = tw::time_get();
|
||||
Storage()->ListDirectory(IStorage::TYPE_ALL, "themes", ThemeScan, (CMenuBackground *)this);
|
||||
Storage()->ListDirectory(IStorage::TYPE_ALL, "themes", ThemeIconScan, (CMenuBackground *)this);
|
||||
|
||||
std::sort(m_lThemes.begin() + PREDEFINED_THEMES_COUNT, m_lThemes.end());
|
||||
std::sort(m_vThemes.begin() + PREDEFINED_THEMES_COUNT, m_vThemes.end());
|
||||
}
|
||||
return m_lThemes;
|
||||
return m_vThemes;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
static int ThemeScan(const char *pName, int IsDir, int DirType, void *pUser);
|
||||
static int ThemeIconScan(const char *pName, int IsDir, int DirType, void *pUser);
|
||||
|
||||
std::vector<CTheme> m_lThemes;
|
||||
std::vector<CTheme> m_vThemes;
|
||||
|
||||
CMenuBackground();
|
||||
~CMenuBackground() override {}
|
||||
|
|
|
@ -1924,8 +1924,8 @@ int CMenus::Render()
|
|||
// delete demo
|
||||
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_vDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
if(Storage()->RemoveFile(aBuf, m_vDemos[m_DemolistSelectedIndex].m_StorageType))
|
||||
{
|
||||
DemolistPopulate();
|
||||
DemolistOnUpdate(false);
|
||||
|
@ -1960,14 +1960,14 @@ int CMenus::Render()
|
|||
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
|
||||
{
|
||||
char aBufOld[512];
|
||||
str_format(aBufOld, sizeof(aBufOld), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
str_format(aBufOld, sizeof(aBufOld), "%s/%s", m_aCurrentDemoFolder, m_vDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
int Length = str_length(m_aCurrentDemoFile);
|
||||
char aBufNew[512];
|
||||
if(Length <= 4 || m_aCurrentDemoFile[Length - 5] != '.' || str_comp_nocase(m_aCurrentDemoFile + Length - 4, "demo"))
|
||||
str_format(aBufNew, sizeof(aBufNew), "%s/%s.demo", m_aCurrentDemoFolder, m_aCurrentDemoFile);
|
||||
else
|
||||
str_format(aBufNew, sizeof(aBufNew), "%s/%s", m_aCurrentDemoFolder, m_aCurrentDemoFile);
|
||||
if(Storage()->RenameFile(aBufOld, aBufNew, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
|
||||
if(Storage()->RenameFile(aBufOld, aBufNew, m_vDemos[m_DemolistSelectedIndex].m_StorageType))
|
||||
{
|
||||
DemolistPopulate();
|
||||
DemolistOnUpdate(false);
|
||||
|
@ -2019,7 +2019,7 @@ int CMenus::Render()
|
|||
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
|
||||
{
|
||||
char aBufOld[512];
|
||||
str_format(aBufOld, sizeof(aBufOld), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
str_format(aBufOld, sizeof(aBufOld), "%s/%s", m_aCurrentDemoFolder, m_vDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
int Length = str_length(m_aCurrentDemoFile);
|
||||
char aBufNew[512];
|
||||
if(Length <= 3 || m_aCurrentDemoFile[Length - 4] != '.' || str_comp_nocase(m_aCurrentDemoFile + Length - 3, "mp4"))
|
||||
|
@ -2036,7 +2036,7 @@ int CMenus::Render()
|
|||
}
|
||||
else
|
||||
{
|
||||
const char *pError = Client()->DemoPlayer_Render(aBufOld, m_lDemos[m_DemolistSelectedIndex].m_StorageType, m_aCurrentDemoFile, m_Speed);
|
||||
const char *pError = Client()->DemoPlayer_Render(aBufOld, m_vDemos[m_DemolistSelectedIndex].m_StorageType, m_aCurrentDemoFile, m_Speed);
|
||||
m_Speed = 4;
|
||||
//Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "demo_render_path", aWholePath);
|
||||
if(pError)
|
||||
|
@ -2136,8 +2136,8 @@ int CMenus::Render()
|
|||
{
|
||||
m_Popup = POPUP_NONE;
|
||||
// render video
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
const char *pError = Client()->DemoPlayer_Render(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType, m_aCurrentDemoFile, m_Speed);
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_vDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
const char *pError = Client()->DemoPlayer_Render(aBuf, m_vDemos[m_DemolistSelectedIndex].m_StorageType, m_aCurrentDemoFile, m_Speed);
|
||||
m_Speed = 4;
|
||||
if(pError)
|
||||
PopupMessage(Localize("Error"), str_comp(pError, "error loading demo") ? pError : Localize("Error loading demo"), Localize("Ok"));
|
||||
|
@ -2167,8 +2167,8 @@ int CMenus::Render()
|
|||
// remove friend
|
||||
if(m_FriendlistSelectedIndex >= 0)
|
||||
{
|
||||
m_pClient->Friends()->RemoveFriend(m_lFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aName,
|
||||
m_lFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aClan);
|
||||
m_pClient->Friends()->RemoveFriend(m_vFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aName,
|
||||
m_vFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aClan);
|
||||
FriendlistOnUpdate();
|
||||
Client()->ServerBrowserUpdate();
|
||||
}
|
||||
|
|
|
@ -254,11 +254,11 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
std::vector<SCustomEntities> m_EntitiesList;
|
||||
std::vector<SCustomGame> m_GameList;
|
||||
std::vector<SCustomEmoticon> m_EmoticonList;
|
||||
std::vector<SCustomParticle> m_ParticlesList;
|
||||
std::vector<SCustomHud> m_HudList;
|
||||
std::vector<SCustomEntities> m_vEntitiesList;
|
||||
std::vector<SCustomGame> m_vGameList;
|
||||
std::vector<SCustomEmoticon> m_vEmoticonList;
|
||||
std::vector<SCustomParticle> m_vParticlesList;
|
||||
std::vector<SCustomHud> m_vHudList;
|
||||
|
||||
bool m_IsInit = false;
|
||||
|
||||
|
@ -471,7 +471,7 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
std::vector<CFriendItem> m_lFriends;
|
||||
std::vector<CFriendItem> m_vFriends;
|
||||
int m_FriendlistSelectedIndex;
|
||||
|
||||
void FriendlistOnUpdate();
|
||||
|
@ -620,7 +620,7 @@ public:
|
|||
|
||||
// DDRace
|
||||
int DoButton_CheckBox_DontCare(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
std::vector<CDemoItem> m_lDemos;
|
||||
std::vector<CDemoItem> m_vDemos;
|
||||
void DemolistPopulate();
|
||||
bool m_Dummy;
|
||||
|
||||
|
@ -645,7 +645,7 @@ public:
|
|||
bool HasFile() const { return m_aFilename[0]; }
|
||||
};
|
||||
|
||||
std::vector<CGhostItem> m_lGhosts;
|
||||
std::vector<CGhostItem> m_vGhosts;
|
||||
|
||||
std::chrono::nanoseconds m_GhostPopulateStartTime{0};
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
m_SelectedIndex = -1;
|
||||
|
||||
// reset friend counter
|
||||
for(auto &Friend : m_lFriends)
|
||||
for(auto &Friend : m_vFriends)
|
||||
Friend.m_NumFound = 0;
|
||||
|
||||
auto RenderBrowserIcons = [this](CUIElement::SUIElementRect &UIRect, CUIRect *pRect, const ColorRGBA &TextColor, const ColorRGBA &TextOutlineColor, const char *pText, ETextAlignment TextAlign, bool SmallFont = false) {
|
||||
|
@ -262,7 +262,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
{
|
||||
unsigned NameHash = str_quickhash(pItem->m_aClients[j].m_aName);
|
||||
unsigned ClanHash = str_quickhash(pItem->m_aClients[j].m_aClan);
|
||||
for(auto &Friend : m_lFriends)
|
||||
for(auto &Friend : m_vFriends)
|
||||
{
|
||||
if(((g_Config.m_ClFriendsIgnoreClan && Friend.m_pFriendInfo->m_aName[0]) || (ClanHash == Friend.m_pFriendInfo->m_ClanHash && !str_comp(Friend.m_pFriendInfo->m_aClan, pItem->m_aClients[j].m_aClan))) &&
|
||||
(!Friend.m_pFriendInfo->m_aName[0] || (NameHash == Friend.m_pFriendInfo->m_NameHash && !str_comp(Friend.m_pFriendInfo->m_aName, pItem->m_aClients[j].m_aName))))
|
||||
|
@ -1241,10 +1241,10 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
|
||||
void CMenus::FriendlistOnUpdate()
|
||||
{
|
||||
m_lFriends.clear();
|
||||
m_vFriends.clear();
|
||||
for(int i = 0; i < m_pClient->Friends()->NumFriends(); ++i)
|
||||
m_lFriends.emplace_back(m_pClient->Friends()->GetFriend(i));
|
||||
std::sort(m_lFriends.begin(), m_lFriends.end());
|
||||
m_vFriends.emplace_back(m_pClient->Friends()->GetFriend(i));
|
||||
std::sort(m_vFriends.begin(), m_vFriends.end());
|
||||
}
|
||||
|
||||
void CMenus::RenderServerbrowserFriends(CUIRect View)
|
||||
|
@ -1274,12 +1274,12 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
|
||||
// friends list(remove friend)
|
||||
static float s_ScrollValue = 0;
|
||||
if(m_FriendlistSelectedIndex >= (int)m_lFriends.size())
|
||||
m_FriendlistSelectedIndex = m_lFriends.size() - 1;
|
||||
UiDoListboxStart(&m_lFriends, &List, 30.0f, "", "", m_lFriends.size(), 1, m_FriendlistSelectedIndex, s_ScrollValue);
|
||||
if(m_FriendlistSelectedIndex >= (int)m_vFriends.size())
|
||||
m_FriendlistSelectedIndex = m_vFriends.size() - 1;
|
||||
UiDoListboxStart(&m_vFriends, &List, 30.0f, "", "", m_vFriends.size(), 1, m_FriendlistSelectedIndex, s_ScrollValue);
|
||||
|
||||
std::sort(m_lFriends.begin(), m_lFriends.end());
|
||||
for(auto &Friend : m_lFriends)
|
||||
std::sort(m_vFriends.begin(), m_vFriends.end());
|
||||
for(auto &Friend : m_vFriends)
|
||||
{
|
||||
CListboxItem Item = UiDoListboxNextItem(&Friend.m_NumFound, false, false);
|
||||
|
||||
|
@ -1308,7 +1308,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
m_FriendlistSelectedIndex = UiDoListboxEnd(&s_ScrollValue, &Activated);
|
||||
|
||||
// activate found server with friend
|
||||
if(Activated && !m_EnterPressed && m_lFriends[m_FriendlistSelectedIndex].m_NumFound)
|
||||
if(Activated && !m_EnterPressed && m_vFriends[m_FriendlistSelectedIndex].m_NumFound)
|
||||
{
|
||||
bool Found = false;
|
||||
int NumServers = ServerBrowser()->NumSortedServers();
|
||||
|
@ -1321,9 +1321,9 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
for(int j = 0; j < pItem->m_NumReceivedClients && !Found; ++j)
|
||||
{
|
||||
if(pItem->m_aClients[j].m_FriendState != IFriends::FRIEND_NO &&
|
||||
((g_Config.m_ClFriendsIgnoreClan && m_lFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aName[0]) || str_quickhash(pItem->m_aClients[j].m_aClan) == m_lFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_ClanHash) &&
|
||||
(!m_lFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aName[0] ||
|
||||
str_quickhash(pItem->m_aClients[j].m_aName) == m_lFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_NameHash))
|
||||
((g_Config.m_ClFriendsIgnoreClan && m_vFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aName[0]) || str_quickhash(pItem->m_aClients[j].m_aClan) == m_vFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_ClanHash) &&
|
||||
(!m_vFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_aName[0] ||
|
||||
str_quickhash(pItem->m_aClients[j].m_aName) == m_vFriends[m_FriendlistSelectedIndex].m_pFriendInfo->m_NameHash))
|
||||
{
|
||||
str_copy(g_Config.m_UiServerAddress, pItem->m_aAddress, sizeof(g_Config.m_UiServerAddress));
|
||||
m_ScrollOffset = ItemIndex;
|
||||
|
|
|
@ -117,7 +117,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
static int s_ButtonOk = 0;
|
||||
if(DoButton_Menu(&s_ButtonOk, Localize("Ok"), 0, &Ok) || m_EnterPressed)
|
||||
{
|
||||
if(str_comp(m_lDemos[m_DemolistSelectedIndex].m_aFilename, m_aCurrentDemoFile) == 0)
|
||||
if(str_comp(m_vDemos[m_DemolistSelectedIndex].m_aFilename, m_aCurrentDemoFile) == 0)
|
||||
str_copy(m_aDemoPlayerPopupHint, Localize("Please use a different name"), sizeof(m_aDemoPlayerPopupHint));
|
||||
else
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
static int s_SliceSaveButton = 0;
|
||||
if(DoButton_Sprite(&s_SliceSaveButton, IMAGE_FILEICONS, SPRITE_FILE_DEMO2, 0, &Button, CUI::CORNER_ALL))
|
||||
{
|
||||
str_copy(m_aCurrentDemoFile, m_lDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||
str_copy(m_aCurrentDemoFile, m_vDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||
m_aDemoPlayerPopupHint[0] = '\0';
|
||||
m_DemoPlayerState = DEMOPLAYER_SLICE_SAVE;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ int CMenus::DemolistFetchCallback(const CFsFileInfo *pInfo, int IsDir, int Stora
|
|||
}
|
||||
Item.m_IsDir = IsDir != 0;
|
||||
Item.m_StorageType = StorageType;
|
||||
pSelf->m_lDemos.push_back(Item);
|
||||
pSelf->m_vDemos.push_back(Item);
|
||||
|
||||
if(tw::time_get() - pSelf->m_DemoPopulateStartTime > 500ms)
|
||||
{
|
||||
|
@ -779,7 +779,7 @@ int CMenus::DemolistFetchCallback(const CFsFileInfo *pInfo, int IsDir, int Stora
|
|||
|
||||
void CMenus::DemolistPopulate()
|
||||
{
|
||||
m_lDemos.clear();
|
||||
m_vDemos.clear();
|
||||
if(!str_comp(m_aCurrentDemoFolder, "demos"))
|
||||
m_DemolistStorageType = IStorage::TYPE_ALL;
|
||||
m_DemoPopulateStartTime = tw::time_get();
|
||||
|
@ -788,7 +788,7 @@ void CMenus::DemolistPopulate()
|
|||
if(g_Config.m_BrDemoFetchInfo)
|
||||
FetchAllHeaders();
|
||||
|
||||
std::stable_sort(m_lDemos.begin(), m_lDemos.end());
|
||||
std::stable_sort(m_vDemos.begin(), m_vDemos.end());
|
||||
}
|
||||
|
||||
void CMenus::DemolistOnUpdate(bool Reset)
|
||||
|
@ -800,7 +800,7 @@ void CMenus::DemolistOnUpdate(bool Reset)
|
|||
bool Found = false;
|
||||
int SelectedIndex = -1;
|
||||
// search for selected index
|
||||
for(auto &Item : m_lDemos)
|
||||
for(auto &Item : m_vDemos)
|
||||
{
|
||||
SelectedIndex++;
|
||||
|
||||
|
@ -815,9 +815,9 @@ void CMenus::DemolistOnUpdate(bool Reset)
|
|||
m_DemolistSelectedIndex = SelectedIndex;
|
||||
}
|
||||
|
||||
m_DemolistSelectedIndex = Reset ? !m_lDemos.empty() ? 0 : -1 :
|
||||
m_DemolistSelectedIndex >= (int)m_lDemos.size() ? m_lDemos.size() - 1 : m_DemolistSelectedIndex;
|
||||
m_DemolistSelectedIsDir = m_DemolistSelectedIndex < 0 ? false : m_lDemos[m_DemolistSelectedIndex].m_IsDir;
|
||||
m_DemolistSelectedIndex = Reset ? !m_vDemos.empty() ? 0 : -1 :
|
||||
m_DemolistSelectedIndex >= (int)m_vDemos.size() ? m_vDemos.size() - 1 : m_DemolistSelectedIndex;
|
||||
m_DemolistSelectedIsDir = m_DemolistSelectedIndex < 0 ? false : m_vDemos[m_DemolistSelectedIndex].m_IsDir;
|
||||
}
|
||||
|
||||
bool CMenus::FetchHeader(CDemoItem &Item)
|
||||
|
@ -834,11 +834,11 @@ bool CMenus::FetchHeader(CDemoItem &Item)
|
|||
|
||||
void CMenus::FetchAllHeaders()
|
||||
{
|
||||
for(auto &Item : m_lDemos)
|
||||
for(auto &Item : m_vDemos)
|
||||
{
|
||||
FetchHeader(Item);
|
||||
}
|
||||
std::stable_sort(m_lDemos.begin(), m_lDemos.end());
|
||||
std::stable_sort(m_vDemos.begin(), m_vDemos.end());
|
||||
}
|
||||
|
||||
void CMenus::RenderDemoList(CUIRect MainView)
|
||||
|
@ -854,7 +854,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
char aFooterLabel[128] = {0};
|
||||
if(m_DemolistSelectedIndex >= 0)
|
||||
{
|
||||
CDemoItem &Item = m_lDemos[m_DemolistSelectedIndex];
|
||||
CDemoItem &Item = m_vDemos[m_DemolistSelectedIndex];
|
||||
if(str_comp(Item.m_aFilename, "..") == 0)
|
||||
str_copy(aFooterLabel, Localize("Parent Folder"), sizeof(aFooterLabel));
|
||||
else if(m_DemolistSelectedIsDir)
|
||||
|
@ -901,7 +901,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
MainView.VMargin(5.0f, &MainView);
|
||||
MainView.HSplitBottom(5.0f, &MainView, 0);
|
||||
RenderTools()->DrawUIRect(&MainView, ColorRGBA(0, 0, 0, 0.15f), CUI::CORNER_B, 4.0f);
|
||||
if(!m_DemolistSelectedIsDir && m_DemolistSelectedIndex >= 0 && m_lDemos[m_DemolistSelectedIndex].m_Valid)
|
||||
if(!m_DemolistSelectedIsDir && m_DemolistSelectedIndex >= 0 && m_vDemos[m_DemolistSelectedIndex].m_Valid)
|
||||
{
|
||||
CUIRect Left, Right, Labels;
|
||||
MainView.VMargin(20.0f, &MainView);
|
||||
|
@ -914,19 +914,19 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Left, Localize("Created:"), 14.0f, TEXTALIGN_LEFT);
|
||||
|
||||
char aTimestamp[256];
|
||||
str_timestamp_ex(m_lDemos[m_DemolistSelectedIndex].m_Date, aTimestamp, sizeof(aTimestamp), FORMAT_SPACE);
|
||||
str_timestamp_ex(m_vDemos[m_DemolistSelectedIndex].m_Date, aTimestamp, sizeof(aTimestamp), FORMAT_SPACE);
|
||||
|
||||
UI()->DoLabelScaled(&Right, aTimestamp, 14.0f, TEXTALIGN_LEFT);
|
||||
Labels.HSplitTop(5.0f, 0, &Labels);
|
||||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Type:"), 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aType, 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabelScaled(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aType, 14.0f, TEXTALIGN_LEFT);
|
||||
Labels.HSplitTop(5.0f, 0, &Labels);
|
||||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Length:"), 14.0f, TEXTALIGN_LEFT);
|
||||
int Length = m_lDemos[m_DemolistSelectedIndex].Length();
|
||||
int Length = m_vDemos[m_DemolistSelectedIndex].Length();
|
||||
char aBuf[64];
|
||||
str_time((int64_t)Length * 100, TIME_HOURS, aBuf, sizeof(aBuf));
|
||||
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
|
||||
|
@ -934,13 +934,13 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Version:"), 14.0f, TEXTALIGN_LEFT);
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_lDemos[m_DemolistSelectedIndex].m_Info.m_Version);
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].m_Info.m_Version);
|
||||
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
|
||||
Labels.HSplitTop(5.0f, 0, &Labels);
|
||||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Markers:"), 14.0f, TEXTALIGN_LEFT);
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_lDemos[m_DemolistSelectedIndex].NumMarkers());
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_vDemos[m_DemolistSelectedIndex].NumMarkers());
|
||||
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
|
||||
|
||||
// right side
|
||||
|
@ -948,12 +948,12 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Map:"), 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aMapName, 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabelScaled(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aMapName, 14.0f, TEXTALIGN_LEFT);
|
||||
Labels.HSplitTop(5.0f, 0, &Labels);
|
||||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Size:"), 14.0f, TEXTALIGN_LEFT);
|
||||
const float Size = m_lDemos[m_DemolistSelectedIndex].Size() / 1024.0f;
|
||||
const float Size = m_vDemos[m_DemolistSelectedIndex].Size() / 1024.0f;
|
||||
if(Size > 1024)
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%.2f MiB"), Size / 1024.0f);
|
||||
else
|
||||
|
@ -962,17 +962,17 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
Labels.HSplitTop(5.0f, 0, &Labels);
|
||||
Labels.HSplitTop(20.0f, &Left, &Labels);
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
if(m_lDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256 != SHA256_ZEROED)
|
||||
if(m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256 != SHA256_ZEROED)
|
||||
{
|
||||
UI()->DoLabelScaled(&Left, "SHA256:", 14.0f, TEXTALIGN_LEFT);
|
||||
char aSha[SHA256_MAXSTRSIZE];
|
||||
sha256_str(m_lDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256, aSha, sizeof(aSha) / 2);
|
||||
sha256_str(m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Sha256, aSha, sizeof(aSha) / 2);
|
||||
UI()->DoLabelScaled(&Right, aSha, Right.w > 235 ? 14.0f : 11.0f, TEXTALIGN_LEFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
UI()->DoLabelScaled(&Left, Localize("Crc:"), 14.0f, TEXTALIGN_LEFT);
|
||||
str_format(aBuf, sizeof(aBuf), "%08x", m_lDemos[m_DemolistSelectedIndex].m_MapInfo.m_Crc);
|
||||
str_format(aBuf, sizeof(aBuf), "%08x", m_vDemos[m_DemolistSelectedIndex].m_MapInfo.m_Crc);
|
||||
UI()->DoLabelScaled(&Right, aBuf, 14.0f, TEXTALIGN_LEFT);
|
||||
}
|
||||
Labels.HSplitTop(5.0f, 0, &Labels);
|
||||
|
@ -980,7 +980,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
|
||||
Left.VSplitLeft(150.0f, &Left, &Right);
|
||||
UI()->DoLabelScaled(&Left, Localize("Netversion:"), 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabelScaled(&Right, m_lDemos[m_DemolistSelectedIndex].m_Info.m_aNetversion, 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabelScaled(&Right, m_vDemos[m_DemolistSelectedIndex].m_Info.m_aNetversion, 14.0f, TEXTALIGN_LEFT);
|
||||
}
|
||||
|
||||
// demo list
|
||||
|
@ -1070,7 +1070,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
}
|
||||
|
||||
// Don't rescan in order to keep fetched headers, just resort
|
||||
std::stable_sort(m_lDemos.begin(), m_lDemos.end());
|
||||
std::stable_sort(m_vDemos.begin(), m_vDemos.end());
|
||||
DemolistOnUpdate(false);
|
||||
}
|
||||
}
|
||||
|
@ -1083,10 +1083,10 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
s_ScrollValue = UIEx()->DoScrollbarV(&s_ScrollValue, &Scroll, s_ScrollValue);
|
||||
|
||||
int PreviousIndex = m_DemolistSelectedIndex;
|
||||
HandleListInputs(ListBox, s_ScrollValue, 3.0f, &m_ScrollOffset, s_aCols[0].m_Rect.h, m_DemolistSelectedIndex, m_lDemos.size());
|
||||
HandleListInputs(ListBox, s_ScrollValue, 3.0f, &m_ScrollOffset, s_aCols[0].m_Rect.h, m_DemolistSelectedIndex, m_vDemos.size());
|
||||
if(PreviousIndex != m_DemolistSelectedIndex)
|
||||
{
|
||||
str_copy(g_Config.m_UiDemoSelected, m_lDemos[m_DemolistSelectedIndex].m_aName, sizeof(g_Config.m_UiDemoSelected));
|
||||
str_copy(g_Config.m_UiDemoSelected, m_vDemos[m_DemolistSelectedIndex].m_aName, sizeof(g_Config.m_UiDemoSelected));
|
||||
DemolistOnUpdate(false);
|
||||
}
|
||||
|
||||
|
@ -1095,13 +1095,13 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
|
||||
CUIRect OriginalView = ListBox;
|
||||
int Num = (int)(ListBox.h / s_aCols[0].m_Rect.h) + 1;
|
||||
int ScrollNum = maximum<int>(m_lDemos.size() - Num + 1, 0);
|
||||
int ScrollNum = maximum<int>(m_vDemos.size() - Num + 1, 0);
|
||||
ListBox.y -= s_ScrollValue * ScrollNum * s_aCols[0].m_Rect.h;
|
||||
|
||||
int ItemIndex = -1;
|
||||
bool DoubleClicked = false;
|
||||
|
||||
for(auto &Item : m_lDemos)
|
||||
for(auto &Item : m_vDemos)
|
||||
{
|
||||
ItemIndex++;
|
||||
|
||||
|
@ -1217,14 +1217,14 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
{
|
||||
if(m_DemolistSelectedIsDir) // folder
|
||||
{
|
||||
if(str_comp(m_lDemos[m_DemolistSelectedIndex].m_aFilename, "..") == 0) // parent folder
|
||||
if(str_comp(m_vDemos[m_DemolistSelectedIndex].m_aFilename, "..") == 0) // parent folder
|
||||
fs_parent_dir(m_aCurrentDemoFolder);
|
||||
else // sub folder
|
||||
{
|
||||
char aTemp[256];
|
||||
str_copy(aTemp, m_aCurrentDemoFolder, sizeof(aTemp));
|
||||
str_format(m_aCurrentDemoFolder, sizeof(m_aCurrentDemoFolder), "%s/%s", aTemp, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
m_DemolistStorageType = m_lDemos[m_DemolistSelectedIndex].m_StorageType;
|
||||
str_format(m_aCurrentDemoFolder, sizeof(m_aCurrentDemoFolder), "%s/%s", aTemp, m_vDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
m_DemolistStorageType = m_vDemos[m_DemolistSelectedIndex].m_StorageType;
|
||||
}
|
||||
DemolistPopulate();
|
||||
DemolistOnUpdate(true);
|
||||
|
@ -1232,8 +1232,8 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
else // file
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
const char *pError = Client()->DemoPlayer_Play(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType);
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_vDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
const char *pError = Client()->DemoPlayer_Play(aBuf, m_vDemos[m_DemolistSelectedIndex].m_StorageType);
|
||||
if(pError)
|
||||
PopupMessage(Localize("Error"), str_comp(pError, "error loading demo") ? pError : Localize("Error loading demo"), Localize("Ok"));
|
||||
else
|
||||
|
@ -1277,7 +1277,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
{
|
||||
UI()->SetActiveItem(nullptr);
|
||||
m_Popup = POPUP_RENAME_DEMO;
|
||||
str_copy(m_aCurrentDemoFile, m_lDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||
str_copy(m_aCurrentDemoFile, m_vDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1290,7 +1290,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
{
|
||||
UI()->SetActiveItem(nullptr);
|
||||
m_Popup = POPUP_RENDER_DEMO;
|
||||
str_copy(m_aCurrentDemoFile, m_lDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||
str_copy(m_aCurrentDemoFile, m_vDemos[m_DemolistSelectedIndex].m_aFilename, sizeof(m_aCurrentDemoFile));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -867,7 +867,7 @@ int CMenus::GhostlistFetchCallback(const char *pName, int IsDir, int StorageType
|
|||
str_copy(Item.m_aPlayer, Info.m_aOwner, sizeof(Item.m_aPlayer));
|
||||
Item.m_Time = Info.m_Time;
|
||||
if(Item.m_Time > 0)
|
||||
pSelf->m_lGhosts.push_back(Item);
|
||||
pSelf->m_vGhosts.push_back(Item);
|
||||
|
||||
if(tw::time_get() - pSelf->m_GhostPopulateStartTime > 500ms)
|
||||
{
|
||||
|
@ -879,13 +879,13 @@ int CMenus::GhostlistFetchCallback(const char *pName, int IsDir, int StorageType
|
|||
|
||||
void CMenus::GhostlistPopulate()
|
||||
{
|
||||
m_lGhosts.clear();
|
||||
m_vGhosts.clear();
|
||||
m_GhostPopulateStartTime = tw::time_get();
|
||||
Storage()->ListDirectory(IStorage::TYPE_ALL, m_pClient->m_Ghost.GetGhostDir(), GhostlistFetchCallback, this);
|
||||
std::sort(m_lGhosts.begin(), m_lGhosts.end());
|
||||
std::sort(m_vGhosts.begin(), m_vGhosts.end());
|
||||
|
||||
CGhostItem *pOwnGhost = 0;
|
||||
for(auto &Ghost : m_lGhosts)
|
||||
for(auto &Ghost : m_vGhosts)
|
||||
if(str_comp(Ghost.m_aPlayer, Client()->PlayerName()) == 0 && (!pOwnGhost || Ghost < *pOwnGhost))
|
||||
pOwnGhost = &Ghost;
|
||||
|
||||
|
@ -898,7 +898,7 @@ void CMenus::GhostlistPopulate()
|
|||
|
||||
CMenus::CGhostItem *CMenus::GetOwnGhost()
|
||||
{
|
||||
for(auto &Ghost : m_lGhosts)
|
||||
for(auto &Ghost : m_vGhosts)
|
||||
if(Ghost.m_Own)
|
||||
return &Ghost;
|
||||
return nullptr;
|
||||
|
@ -907,27 +907,27 @@ CMenus::CGhostItem *CMenus::GetOwnGhost()
|
|||
void CMenus::UpdateOwnGhost(CGhostItem Item)
|
||||
{
|
||||
int Own = -1;
|
||||
for(size_t i = 0; i < m_lGhosts.size(); i++)
|
||||
if(m_lGhosts[i].m_Own)
|
||||
for(size_t i = 0; i < m_vGhosts.size(); i++)
|
||||
if(m_vGhosts[i].m_Own)
|
||||
Own = i;
|
||||
|
||||
if(Own != -1)
|
||||
{
|
||||
m_lGhosts[Own].m_Slot = -1;
|
||||
m_lGhosts[Own].m_Own = false;
|
||||
if(Item.HasFile() || !m_lGhosts[Own].HasFile())
|
||||
m_vGhosts[Own].m_Slot = -1;
|
||||
m_vGhosts[Own].m_Own = false;
|
||||
if(Item.HasFile() || !m_vGhosts[Own].HasFile())
|
||||
DeleteGhostItem(Own);
|
||||
}
|
||||
|
||||
Item.m_Own = true;
|
||||
m_lGhosts.insert(std::lower_bound(m_lGhosts.begin(), m_lGhosts.end(), Item), Item);
|
||||
m_vGhosts.insert(std::lower_bound(m_vGhosts.begin(), m_vGhosts.end(), Item), Item);
|
||||
}
|
||||
|
||||
void CMenus::DeleteGhostItem(int Index)
|
||||
{
|
||||
if(m_lGhosts[Index].HasFile())
|
||||
Storage()->RemoveFile(m_lGhosts[Index].m_aFilename, IStorage::TYPE_SAVE);
|
||||
m_lGhosts.erase(m_lGhosts.begin() + Index);
|
||||
if(m_vGhosts[Index].HasFile())
|
||||
Storage()->RemoveFile(m_vGhosts[Index].m_aFilename, IStorage::TYPE_SAVE);
|
||||
m_vGhosts.erase(m_vGhosts.begin() + Index);
|
||||
}
|
||||
|
||||
void CMenus::RenderGhost(CUIRect MainView)
|
||||
|
@ -996,7 +996,7 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
static float s_ScrollValue = 0;
|
||||
s_ScrollValue = UIEx()->DoScrollbarV(&s_ScrollValue, &Scroll, s_ScrollValue);
|
||||
|
||||
int NumGhosts = m_lGhosts.size();
|
||||
int NumGhosts = m_vGhosts.size();
|
||||
static int s_SelectedIndex = 0;
|
||||
HandleListInputs(View, s_ScrollValue, 1.0f, nullptr, s_aCols[0].m_Rect.h, s_SelectedIndex, NumGhosts);
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
|
||||
for(int i = 0; i < NumGhosts; i++)
|
||||
{
|
||||
const CGhostItem *pItem = &m_lGhosts[i];
|
||||
const CGhostItem *pItem = &m_vGhosts[i];
|
||||
CUIRect Row;
|
||||
View.HSplitTop(17.0f, &Row, &View);
|
||||
|
||||
|
@ -1106,10 +1106,10 @@ void CMenus::RenderGhost(CUIRect MainView)
|
|||
GhostlistPopulate();
|
||||
}
|
||||
|
||||
if(s_SelectedIndex == -1 || s_SelectedIndex >= (int)m_lGhosts.size())
|
||||
if(s_SelectedIndex == -1 || s_SelectedIndex >= (int)m_vGhosts.size())
|
||||
return;
|
||||
|
||||
CGhostItem *pGhost = &m_lGhosts[s_SelectedIndex];
|
||||
CGhostItem *pGhost = &m_vGhosts[s_SelectedIndex];
|
||||
|
||||
CGhostItem *pOwnGhost = GetOwnGhost();
|
||||
int ReservedSlots = !pGhost->m_Own && !(pOwnGhost && pOwnGhost->Active());
|
||||
|
|
|
@ -1480,7 +1480,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
|
||||
// GPU list
|
||||
const auto &GPUList = Graphics()->GetGPUs();
|
||||
if(GPUList.m_GPUs.size() > 1)
|
||||
if(GPUList.m_vGPUs.size() > 1)
|
||||
{
|
||||
MainView.HSplitTop(10.0f, nullptr, &MainView);
|
||||
MainView.HSplitTop(20.0f, &Text, &MainView);
|
||||
|
@ -1493,7 +1493,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
static std::vector<const void *> vGPUIDPtrs;
|
||||
static std::vector<const char *> vGPUIDNames;
|
||||
|
||||
size_t GPUCount = GPUList.m_GPUs.size() + 1;
|
||||
size_t GPUCount = GPUList.m_vGPUs.size() + 1;
|
||||
vGPUIDs.resize(GPUCount);
|
||||
vGPUIDPtrs.resize(GPUCount);
|
||||
vGPUIDNames.resize(GPUCount);
|
||||
|
@ -1517,8 +1517,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
}
|
||||
else
|
||||
{
|
||||
vGPUIDNames[i] = GPUList.m_GPUs[i - 1].m_Name;
|
||||
if(str_comp(GPUList.m_GPUs[i - 1].m_Name, g_Config.m_GfxGPUName) == 0)
|
||||
vGPUIDNames[i] = GPUList.m_vGPUs[i - 1].m_Name;
|
||||
if(str_comp(GPUList.m_vGPUs[i - 1].m_Name, g_Config.m_GfxGPUName) == 0)
|
||||
{
|
||||
OldSelectedGPU = i;
|
||||
}
|
||||
|
@ -1537,7 +1537,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
if(NewGPU == 0)
|
||||
str_copy(g_Config.m_GfxGPUName, "auto", sizeof(g_Config.m_GfxGPUName));
|
||||
else
|
||||
str_copy(g_Config.m_GfxGPUName, GPUList.m_GPUs[NewGPU - 1].m_Name, sizeof(g_Config.m_GfxGPUName));
|
||||
str_copy(g_Config.m_GfxGPUName, GPUList.m_vGPUs[NewGPU - 1].m_Name, sizeof(g_Config.m_GfxGPUName));
|
||||
CheckSettings = true;
|
||||
s_GfxGPUChanged = NewGPU != s_OldSelectedGPU;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ int CMenus::EntitiesScan(const char *pName, int IsDir, int DirType, void *pUser)
|
|||
SCustomEntities EntitiesItem;
|
||||
str_copy(EntitiesItem.m_aName, pName, sizeof(EntitiesItem.m_aName));
|
||||
CMenus::LoadEntities(&EntitiesItem, pUser);
|
||||
pThis->m_EntitiesList.push_back(EntitiesItem);
|
||||
pThis->m_vEntitiesList.push_back(EntitiesItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ int CMenus::EntitiesScan(const char *pName, int IsDir, int DirType, void *pUser)
|
|||
SCustomEntities EntitiesItem;
|
||||
str_copy(EntitiesItem.m_aName, aName, sizeof(EntitiesItem.m_aName));
|
||||
CMenus::LoadEntities(&EntitiesItem, pUser);
|
||||
pThis->m_EntitiesList.push_back(EntitiesItem);
|
||||
pThis->m_vEntitiesList.push_back(EntitiesItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ int CMenus::GameScan(const char *pName, int IsDir, int DirType, void *pUser)
|
|||
auto *pRealUser = (SMenuAssetScanUser *)pUser;
|
||||
auto *pThis = (CMenus *)pRealUser->m_pUser;
|
||||
IGraphics *pGraphics = pThis->Graphics();
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_GameList, "game", pGraphics, pUser);
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_vGameList, "game", pGraphics, pUser);
|
||||
}
|
||||
|
||||
int CMenus::EmoticonsScan(const char *pName, int IsDir, int DirType, void *pUser)
|
||||
|
@ -212,7 +212,7 @@ int CMenus::EmoticonsScan(const char *pName, int IsDir, int DirType, void *pUser
|
|||
auto *pRealUser = (SMenuAssetScanUser *)pUser;
|
||||
auto *pThis = (CMenus *)pRealUser->m_pUser;
|
||||
IGraphics *pGraphics = pThis->Graphics();
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_EmoticonList, "emoticons", pGraphics, pUser);
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_vEmoticonList, "emoticons", pGraphics, pUser);
|
||||
}
|
||||
|
||||
int CMenus::ParticlesScan(const char *pName, int IsDir, int DirType, void *pUser)
|
||||
|
@ -220,7 +220,7 @@ int CMenus::ParticlesScan(const char *pName, int IsDir, int DirType, void *pUser
|
|||
auto *pRealUser = (SMenuAssetScanUser *)pUser;
|
||||
auto *pThis = (CMenus *)pRealUser->m_pUser;
|
||||
IGraphics *pGraphics = pThis->Graphics();
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_ParticlesList, "particles", pGraphics, pUser);
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_vParticlesList, "particles", pGraphics, pUser);
|
||||
}
|
||||
|
||||
int CMenus::HudScan(const char *pName, int IsDir, int DirType, void *pUser)
|
||||
|
@ -228,7 +228,7 @@ int CMenus::HudScan(const char *pName, int IsDir, int DirType, void *pUser)
|
|||
auto *pRealUser = (SMenuAssetScanUser *)pUser;
|
||||
auto *pThis = (CMenus *)pRealUser->m_pUser;
|
||||
IGraphics *pGraphics = pThis->Graphics();
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_HudList, "hud", pGraphics, pUser);
|
||||
return AssetScan(pName, IsDir, DirType, pThis->m_vHudList, "hud", pGraphics, pUser);
|
||||
}
|
||||
|
||||
static std::vector<const CMenus::SCustomEntities *> s_SearchEntitiesList;
|
||||
|
@ -282,7 +282,7 @@ void CMenus::ClearCustomItems(int CurTab)
|
|||
{
|
||||
if(CurTab == ASSETS_TAB_ENTITIES)
|
||||
{
|
||||
for(auto &Entity : m_EntitiesList)
|
||||
for(auto &Entity : m_vEntitiesList)
|
||||
{
|
||||
for(auto &Image : Entity.m_aImages)
|
||||
{
|
||||
|
@ -291,35 +291,35 @@ void CMenus::ClearCustomItems(int CurTab)
|
|||
Image.m_Texture = IGraphics::CTextureHandle();
|
||||
}
|
||||
}
|
||||
m_EntitiesList.clear();
|
||||
m_vEntitiesList.clear();
|
||||
|
||||
// reload current entities
|
||||
m_pClient->m_MapImages.ChangeEntitiesPath(g_Config.m_ClAssetsEntites);
|
||||
}
|
||||
else if(CurTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
ClearAssetList(m_GameList, Graphics());
|
||||
ClearAssetList(m_vGameList, Graphics());
|
||||
|
||||
// reload current game skin
|
||||
GameClient()->LoadGameSkin(g_Config.m_ClAssetGame);
|
||||
}
|
||||
else if(CurTab == ASSETS_TAB_EMOTICONS)
|
||||
{
|
||||
ClearAssetList(m_EmoticonList, Graphics());
|
||||
ClearAssetList(m_vEmoticonList, Graphics());
|
||||
|
||||
// reload current emoticons skin
|
||||
GameClient()->LoadEmoticonsSkin(g_Config.m_ClAssetEmoticons);
|
||||
}
|
||||
else if(CurTab == ASSETS_TAB_PARTICLES)
|
||||
{
|
||||
ClearAssetList(m_ParticlesList, Graphics());
|
||||
ClearAssetList(m_vParticlesList, Graphics());
|
||||
|
||||
// reload current particles skin
|
||||
GameClient()->LoadParticlesSkin(g_Config.m_ClAssetParticles);
|
||||
}
|
||||
else if(CurTab == ASSETS_TAB_HUD)
|
||||
{
|
||||
ClearAssetList(m_HudList, Graphics());
|
||||
ClearAssetList(m_vHudList, Graphics());
|
||||
|
||||
// reload current hud skin
|
||||
GameClient()->LoadHudSkin(g_Config.m_ClAssetHud);
|
||||
|
@ -396,35 +396,35 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
};
|
||||
if(s_CurCustomTab == ASSETS_TAB_ENTITIES)
|
||||
{
|
||||
if(m_EntitiesList.empty())
|
||||
if(m_vEntitiesList.empty())
|
||||
{
|
||||
SCustomEntities EntitiesItem;
|
||||
str_copy(EntitiesItem.m_aName, "default", sizeof(EntitiesItem.m_aName));
|
||||
LoadEntities(&EntitiesItem, &User);
|
||||
m_EntitiesList.push_back(EntitiesItem);
|
||||
m_vEntitiesList.push_back(EntitiesItem);
|
||||
|
||||
// load entities
|
||||
Storage()->ListDirectory(IStorage::TYPE_ALL, "assets/entities", EntitiesScan, &User);
|
||||
std::sort(m_EntitiesList.begin(), m_EntitiesList.end());
|
||||
std::sort(m_vEntitiesList.begin(), m_vEntitiesList.end());
|
||||
}
|
||||
if(m_EntitiesList.size() != s_CustomListSize[s_CurCustomTab])
|
||||
if(m_vEntitiesList.size() != s_CustomListSize[s_CurCustomTab])
|
||||
s_InitCustomList[s_CurCustomTab] = true;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
InitAssetList(m_GameList, "assets/game", "game", GameScan, Graphics(), Storage(), &User);
|
||||
InitAssetList(m_vGameList, "assets/game", "game", GameScan, Graphics(), Storage(), &User);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EMOTICONS)
|
||||
{
|
||||
InitAssetList(m_EmoticonList, "assets/emoticons", "emoticons", EmoticonsScan, Graphics(), Storage(), &User);
|
||||
InitAssetList(m_vEmoticonList, "assets/emoticons", "emoticons", EmoticonsScan, Graphics(), Storage(), &User);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_PARTICLES)
|
||||
{
|
||||
InitAssetList(m_ParticlesList, "assets/particles", "particles", ParticlesScan, Graphics(), Storage(), &User);
|
||||
InitAssetList(m_vParticlesList, "assets/particles", "particles", ParticlesScan, Graphics(), Storage(), &User);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_HUD)
|
||||
{
|
||||
InitAssetList(m_HudList, "assets/hud", "hud", HudScan, Graphics(), Storage(), &User);
|
||||
InitAssetList(m_vHudList, "assets/hud", "hud", HudScan, Graphics(), Storage(), &User);
|
||||
}
|
||||
|
||||
MainView.HSplitTop(10.0f, 0, &MainView);
|
||||
|
@ -438,10 +438,10 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
if(s_CurCustomTab == ASSETS_TAB_ENTITIES)
|
||||
{
|
||||
s_SearchEntitiesList.clear();
|
||||
ListSize = m_EntitiesList.size();
|
||||
ListSize = m_vEntitiesList.size();
|
||||
for(int i = 0; i < ListSize; ++i)
|
||||
{
|
||||
const SCustomEntities *s = &m_EntitiesList[i];
|
||||
const SCustomEntities *s = &m_vEntitiesList[i];
|
||||
|
||||
// filter quick search
|
||||
if(s_aFilterString[s_CurCustomTab][0] != '\0' && !str_utf8_find_nocase(s->m_aName, s_aFilterString[s_CurCustomTab]))
|
||||
|
@ -452,19 +452,19 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
ListSize = InitSearchList(s_SearchGamesList, m_GameList);
|
||||
ListSize = InitSearchList(s_SearchGamesList, m_vGameList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EMOTICONS)
|
||||
{
|
||||
ListSize = InitSearchList(s_SearchEmoticonsList, m_EmoticonList);
|
||||
ListSize = InitSearchList(s_SearchEmoticonsList, m_vEmoticonList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_PARTICLES)
|
||||
{
|
||||
ListSize = InitSearchList(s_SearchParticlesList, m_ParticlesList);
|
||||
ListSize = InitSearchList(s_SearchParticlesList, m_vParticlesList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_HUD)
|
||||
{
|
||||
ListSize = InitSearchList(s_SearchHudList, m_HudList);
|
||||
ListSize = InitSearchList(s_SearchHudList, m_vHudList);
|
||||
}
|
||||
s_InitCustomList[s_CurCustomTab] = false;
|
||||
s_CustomListSize[s_CurCustomTab] = ListSize;
|
||||
|
|
|
@ -27,7 +27,7 @@ struct CDemoItem
|
|||
struct CDemoListParam
|
||||
{
|
||||
const CRaceDemo *m_pThis;
|
||||
std::vector<CDemoItem> *m_plDemos;
|
||||
std::vector<CDemoItem> *m_pvDemos;
|
||||
const char *pMap;
|
||||
};
|
||||
|
||||
|
@ -219,7 +219,7 @@ int CRaceDemo::RaceDemolistFetchCallback(const CFsFileInfo *pInfo, int IsDir, in
|
|||
|
||||
Item.m_Time = CRaceHelper::TimeFromSecondsStr(pTime);
|
||||
if(Item.m_Time > 0)
|
||||
pParam->m_plDemos->push_back(Item);
|
||||
pParam->m_pvDemos->push_back(Item);
|
||||
|
||||
if(tw::time_get() - pRealUser->m_pThis->m_RaceDemosLoadStartTime > 500ms)
|
||||
{
|
||||
|
|
|
@ -294,7 +294,7 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "game", aBuf);
|
||||
}
|
||||
|
||||
m_aSkins.insert(std::lower_bound(m_aSkins.begin(), m_aSkins.end(), Skin), Skin);
|
||||
m_vSkins.insert(std::lower_bound(m_vSkins.begin(), m_vSkins.end(), Skin), Skin);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void CSkins::OnInit()
|
|||
|
||||
void CSkins::Refresh(TSkinLoadedCBFunc &&SkinLoadedFunc)
|
||||
{
|
||||
for(auto &Skin : m_aSkins)
|
||||
for(auto &Skin : m_vSkins)
|
||||
{
|
||||
Graphics()->UnloadTexture(&Skin.m_OriginalSkin.m_Body);
|
||||
Graphics()->UnloadTexture(&Skin.m_OriginalSkin.m_BodyOutline);
|
||||
|
@ -344,26 +344,26 @@ void CSkins::Refresh(TSkinLoadedCBFunc &&SkinLoadedFunc)
|
|||
Graphics()->UnloadTexture(&Eye);
|
||||
}
|
||||
|
||||
m_aSkins.clear();
|
||||
m_aDownloadSkins.clear();
|
||||
m_vSkins.clear();
|
||||
m_vDownloadSkins.clear();
|
||||
SSkinScanUser SkinScanUser;
|
||||
SkinScanUser.m_pThis = this;
|
||||
SkinScanUser.m_SkinLoadedFunc = SkinLoadedFunc;
|
||||
Storage()->ListDirectory(IStorage::TYPE_ALL, "skins", SkinScan, &SkinScanUser);
|
||||
if(m_aSkins.empty())
|
||||
if(m_vSkins.empty())
|
||||
{
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load skins. folder='skins/'");
|
||||
CSkin DummySkin;
|
||||
DummySkin.m_IsVanilla = true;
|
||||
str_copy(DummySkin.m_aName, "dummy", sizeof(DummySkin.m_aName));
|
||||
DummySkin.m_BloodColor = ColorRGBA(1.0f, 1.0f, 1.0f);
|
||||
m_aSkins.push_back(DummySkin);
|
||||
m_vSkins.push_back(DummySkin);
|
||||
}
|
||||
}
|
||||
|
||||
int CSkins::Num()
|
||||
{
|
||||
return m_aSkins.size();
|
||||
return m_vSkins.size();
|
||||
}
|
||||
|
||||
const CSkin *CSkins::Get(int Index)
|
||||
|
@ -375,7 +375,7 @@ const CSkin *CSkins::Get(int Index)
|
|||
if(Index < 0)
|
||||
Index = 0;
|
||||
}
|
||||
return &m_aSkins[Index % m_aSkins.size()];
|
||||
return &m_vSkins[Index % m_vSkins.size()];
|
||||
}
|
||||
|
||||
int CSkins::Find(const char *pName)
|
||||
|
@ -404,9 +404,9 @@ int CSkins::FindImpl(const char *pName)
|
|||
CSkin Needle;
|
||||
mem_zero(&Needle, sizeof(Needle));
|
||||
str_copy(Needle.m_aName, pName, sizeof(Needle.m_aName));
|
||||
auto Range = std::equal_range(m_aSkins.begin(), m_aSkins.end(), Needle);
|
||||
auto Range = std::equal_range(m_vSkins.begin(), m_vSkins.end(), Needle);
|
||||
if(std::distance(Range.first, Range.second) == 1)
|
||||
return Range.first - m_aSkins.begin();
|
||||
return Range.first - m_vSkins.begin();
|
||||
|
||||
if(str_comp(pName, "default") == 0)
|
||||
return -1;
|
||||
|
@ -420,7 +420,7 @@ int CSkins::FindImpl(const char *pName)
|
|||
CDownloadSkin DownloadNeedle;
|
||||
mem_zero(&DownloadNeedle, sizeof(DownloadNeedle));
|
||||
str_copy(DownloadNeedle.m_aName, pName, sizeof(DownloadNeedle.m_aName));
|
||||
const auto &[RangeBegin, RangeEnd] = std::equal_range(m_aDownloadSkins.begin(), m_aDownloadSkins.end(), DownloadNeedle);
|
||||
const auto &[RangeBegin, RangeEnd] = std::equal_range(m_vDownloadSkins.begin(), m_vDownloadSkins.end(), DownloadNeedle);
|
||||
if(std::distance(RangeBegin, RangeEnd) == 1)
|
||||
{
|
||||
if(RangeBegin->m_pTask && RangeBegin->m_pTask->State() == HTTP_DONE)
|
||||
|
@ -449,6 +449,6 @@ int CSkins::FindImpl(const char *pName)
|
|||
str_format(Skin.m_aPath, sizeof(Skin.m_aPath), "downloadedskins/%s", IStorage::FormatTmpPath(aBuf, sizeof(aBuf), pName));
|
||||
Skin.m_pTask = std::make_shared<CGetPngFile>(this, aUrl, Storage(), Skin.m_aPath);
|
||||
m_pClient->Engine()->AddJob(Skin.m_pTask);
|
||||
m_aDownloadSkins.insert(std::lower_bound(m_aDownloadSkins.begin(), m_aDownloadSkins.end(), Skin), Skin);
|
||||
m_vDownloadSkins.insert(std::lower_bound(m_vDownloadSkins.begin(), m_vDownloadSkins.end(), Skin), Skin);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
int Find(const char *pName);
|
||||
|
||||
private:
|
||||
std::vector<CSkin> m_aSkins;
|
||||
std::vector<CDownloadSkin> m_aDownloadSkins;
|
||||
std::vector<CSkin> m_vSkins;
|
||||
std::vector<CDownloadSkin> m_vDownloadSkins;
|
||||
char m_EventSkinPrefix[24];
|
||||
|
||||
bool LoadSkinPNG(CImageInfo &Info, const char *pName, const char *pPath, int DirType);
|
||||
|
|
|
@ -3252,7 +3252,7 @@ void CGameClient::SnapCollectEntities()
|
|||
std::sort(aItemEx.begin(), aItemEx.end(), CEntComparer());
|
||||
|
||||
// merge extended items with items they belong to
|
||||
m_aSnapEntities.clear();
|
||||
m_vSnapEntities.clear();
|
||||
|
||||
size_t IndexEx = 0;
|
||||
for(const CSnapEntities &Ent : aItemData)
|
||||
|
@ -3263,6 +3263,6 @@ void CGameClient::SnapCollectEntities()
|
|||
if(IndexEx < aItemEx.size() && aItemEx[IndexEx].m_Item.m_ID == Ent.m_Item.m_ID)
|
||||
pDataEx = (const CNetObj_EntityEx *)aItemEx[IndexEx].m_pData;
|
||||
|
||||
m_aSnapEntities.push_back({Ent.m_Item, Ent.m_pData, pDataEx});
|
||||
m_vSnapEntities.push_back({Ent.m_Item, Ent.m_pData, pDataEx});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -509,8 +509,8 @@ public:
|
|||
CGameWorld m_PredictedWorld;
|
||||
CGameWorld m_PrevPredictedWorld;
|
||||
|
||||
std::vector<SSwitchers> &Switchers() { return m_GameWorld.m_Core.m_aSwitchers; }
|
||||
std::vector<SSwitchers> &PredSwitchers() { return m_PredictedWorld.m_Core.m_aSwitchers; }
|
||||
std::vector<SSwitchers> &Switchers() { return m_GameWorld.m_Core.m_vSwitchers; }
|
||||
std::vector<SSwitchers> &PredSwitchers() { return m_PredictedWorld.m_Core.m_vSwitchers; }
|
||||
|
||||
void DummyResetInput() override;
|
||||
void Echo(const char *pString) override;
|
||||
|
@ -675,10 +675,10 @@ public:
|
|||
SClientHudSkin m_HudSkin;
|
||||
bool m_HudSkinLoaded;
|
||||
|
||||
const std::vector<CSnapEntities> &SnapEntities() { return m_aSnapEntities; }
|
||||
const std::vector<CSnapEntities> &SnapEntities() { return m_vSnapEntities; }
|
||||
|
||||
private:
|
||||
std::vector<CSnapEntities> m_aSnapEntities;
|
||||
std::vector<CSnapEntities> m_vSnapEntities;
|
||||
void SnapCollectEntities();
|
||||
|
||||
bool m_DDRaceMsgSent[NUM_DUMMIES];
|
||||
|
|
|
@ -551,7 +551,7 @@ void CGameWorld::CopyWorld(CGameWorld *pFrom)
|
|||
}
|
||||
m_pTuningList = pFrom->m_pTuningList;
|
||||
m_Teams = pFrom->m_Teams;
|
||||
m_Core.m_aSwitchers = pFrom->m_Core.m_aSwitchers;
|
||||
m_Core.m_vSwitchers = pFrom->m_Core.m_vSwitchers;
|
||||
// delete the previous entities
|
||||
for(auto &pFirstEntityType : m_apFirstEntityTypes)
|
||||
while(pFirstEntityType)
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
int GameTickSpeed() { return m_GameTickSpeed; }
|
||||
class CCollision *Collision() { return m_pCollision; }
|
||||
CTeamsCore *Teams() { return &m_Teams; }
|
||||
std::vector<SSwitchers> &Switchers() { return m_Core.m_aSwitchers; }
|
||||
std::vector<SSwitchers> &Switchers() { return m_Core.m_vSwitchers; }
|
||||
CTuningParams *Tuning();
|
||||
CEntity *GetEntity(int ID, int EntityType);
|
||||
class CCharacter *GetCharacterByID(int ID) { return (ID >= 0 && ID < MAX_CLIENTS) ? m_apCharacters[ID] : 0; }
|
||||
|
|
|
@ -14,13 +14,13 @@ void CUIElement::Init(CUI *pUI, int RequestedRectCount)
|
|||
{
|
||||
pUI->AddUIElement(this);
|
||||
if(RequestedRectCount > 0)
|
||||
m_UIRects.resize(RequestedRectCount);
|
||||
m_vUIRects.resize(RequestedRectCount);
|
||||
}
|
||||
|
||||
void CUIElement::InitRects(int RequestedRectCount)
|
||||
{
|
||||
dbg_assert(m_UIRects.empty(), "UI rects can only be initialized once, create another ui element instead.");
|
||||
m_UIRects.resize(RequestedRectCount);
|
||||
dbg_assert(m_vUIRects.empty(), "UI rects can only be initialized once, create another ui element instead.");
|
||||
m_vUIRects.resize(RequestedRectCount);
|
||||
}
|
||||
|
||||
CUIElement::SUIElementRect::SUIElementRect() { Reset(); }
|
||||
|
@ -78,30 +78,30 @@ CUI::CUI()
|
|||
|
||||
CUI::~CUI()
|
||||
{
|
||||
for(CUIElement *&pEl : m_OwnUIElements)
|
||||
for(CUIElement *&pEl : m_vpOwnUIElements)
|
||||
{
|
||||
delete pEl;
|
||||
}
|
||||
m_OwnUIElements.clear();
|
||||
m_vpOwnUIElements.clear();
|
||||
}
|
||||
|
||||
CUIElement *CUI::GetNewUIElement(int RequestedRectCount)
|
||||
{
|
||||
CUIElement *pNewEl = new CUIElement(this, RequestedRectCount);
|
||||
|
||||
m_OwnUIElements.push_back(pNewEl);
|
||||
m_vpOwnUIElements.push_back(pNewEl);
|
||||
|
||||
return pNewEl;
|
||||
}
|
||||
|
||||
void CUI::AddUIElement(CUIElement *pElement)
|
||||
{
|
||||
m_UIElements.push_back(pElement);
|
||||
m_vpUIElements.push_back(pElement);
|
||||
}
|
||||
|
||||
void CUI::ResetUIElement(CUIElement &UIElement)
|
||||
{
|
||||
for(CUIElement::SUIElementRect &Rect : UIElement.m_UIRects)
|
||||
for(CUIElement::SUIElementRect &Rect : UIElement.m_vUIRects)
|
||||
{
|
||||
if(Rect.m_UIRectQuadContainer != -1)
|
||||
Graphics()->DeleteQuadContainer(Rect.m_UIRectQuadContainer);
|
||||
|
@ -116,7 +116,7 @@ void CUI::ResetUIElement(CUIElement &UIElement)
|
|||
|
||||
void CUI::OnElementsReset()
|
||||
{
|
||||
for(CUIElement *pEl : m_UIElements)
|
||||
for(CUIElement *pEl : m_vpUIElements)
|
||||
{
|
||||
ResetUIElement(*pEl);
|
||||
}
|
||||
|
@ -230,11 +230,11 @@ void CUI::ClipEnable(const CUIRect *pRect)
|
|||
Intersection.y = std::max(pRect->y, pOldRect->y);
|
||||
Intersection.w = std::min(pRect->x + pRect->w, pOldRect->x + pOldRect->w) - pRect->x;
|
||||
Intersection.h = std::min(pRect->y + pRect->h, pOldRect->y + pOldRect->h) - pRect->y;
|
||||
m_Clips.push_back(Intersection);
|
||||
m_vClips.push_back(Intersection);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Clips.push_back(*pRect);
|
||||
m_vClips.push_back(*pRect);
|
||||
}
|
||||
UpdateClipping();
|
||||
}
|
||||
|
@ -242,14 +242,14 @@ void CUI::ClipEnable(const CUIRect *pRect)
|
|||
void CUI::ClipDisable()
|
||||
{
|
||||
dbg_assert(IsClipped(), "no clip region");
|
||||
m_Clips.pop_back();
|
||||
m_vClips.pop_back();
|
||||
UpdateClipping();
|
||||
}
|
||||
|
||||
const CUIRect *CUI::ClipArea() const
|
||||
{
|
||||
dbg_assert(IsClipped(), "no clip region");
|
||||
return &m_Clips.back();
|
||||
return &m_vClips.back();
|
||||
}
|
||||
|
||||
void CUI::UpdateClipping()
|
||||
|
|
|
@ -157,7 +157,7 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
std::vector<SUIElementRect> m_UIRects;
|
||||
std::vector<SUIElementRect> m_vUIRects;
|
||||
|
||||
// used for marquees or other user implemented things
|
||||
int64_t m_ElementTime;
|
||||
|
@ -169,12 +169,12 @@ public:
|
|||
|
||||
SUIElementRect *Get(size_t Index)
|
||||
{
|
||||
return &m_UIRects[Index];
|
||||
return &m_vUIRects[Index];
|
||||
}
|
||||
|
||||
bool AreRectsInit()
|
||||
{
|
||||
return !m_UIRects.empty();
|
||||
return !m_vUIRects.empty();
|
||||
}
|
||||
|
||||
void InitRects(int RequestedRectCount);
|
||||
|
@ -208,15 +208,15 @@ class CUI
|
|||
|
||||
CUIRect m_Screen;
|
||||
|
||||
std::vector<CUIRect> m_Clips;
|
||||
std::vector<CUIRect> m_vClips;
|
||||
void UpdateClipping();
|
||||
|
||||
class IInput *m_pInput;
|
||||
class IGraphics *m_pGraphics;
|
||||
class ITextRender *m_pTextRender;
|
||||
|
||||
std::vector<CUIElement *> m_OwnUIElements; // ui elements maintained by CUI class
|
||||
std::vector<CUIElement *> m_UIElements;
|
||||
std::vector<CUIElement *> m_vpOwnUIElements; // ui elements maintained by CUI class
|
||||
std::vector<CUIElement *> m_vpUIElements;
|
||||
|
||||
public:
|
||||
static float ms_FontmodHeight;
|
||||
|
@ -321,7 +321,7 @@ public:
|
|||
void ClipEnable(const CUIRect *pRect);
|
||||
void ClipDisable();
|
||||
const CUIRect *ClipArea() const;
|
||||
inline bool IsClipped() const { return !m_Clips.empty(); }
|
||||
inline bool IsClipped() const { return !m_vClips.empty(); }
|
||||
|
||||
// TODO: Refactor: Redo UI scaling
|
||||
void SetScale(float s);
|
||||
|
|
|
@ -76,26 +76,26 @@ void CAutoMapper::Load(const char *pTileName)
|
|||
NewConf.m_StartY = 0;
|
||||
NewConf.m_EndX = 0;
|
||||
NewConf.m_EndY = 0;
|
||||
m_lConfigs.push_back(NewConf);
|
||||
int ConfigurationID = m_lConfigs.size() - 1;
|
||||
pCurrentConf = &m_lConfigs[ConfigurationID];
|
||||
m_vConfigs.push_back(NewConf);
|
||||
int ConfigurationID = m_vConfigs.size() - 1;
|
||||
pCurrentConf = &m_vConfigs[ConfigurationID];
|
||||
str_copy(pCurrentConf->m_aName, pLine, str_length(pLine));
|
||||
|
||||
// add start run
|
||||
CRun NewRun;
|
||||
NewRun.m_AutomapCopy = true;
|
||||
pCurrentConf->m_aRuns.push_back(NewRun);
|
||||
int RunID = pCurrentConf->m_aRuns.size() - 1;
|
||||
pCurrentRun = &pCurrentConf->m_aRuns[RunID];
|
||||
pCurrentConf->m_vRuns.push_back(NewRun);
|
||||
int RunID = pCurrentConf->m_vRuns.size() - 1;
|
||||
pCurrentRun = &pCurrentConf->m_vRuns[RunID];
|
||||
}
|
||||
else if(str_startswith(pLine, "NewRun") && pCurrentConf)
|
||||
{
|
||||
// add new run
|
||||
CRun NewRun;
|
||||
NewRun.m_AutomapCopy = true;
|
||||
pCurrentConf->m_aRuns.push_back(NewRun);
|
||||
int RunID = pCurrentConf->m_aRuns.size() - 1;
|
||||
pCurrentRun = &pCurrentConf->m_aRuns[RunID];
|
||||
pCurrentConf->m_vRuns.push_back(NewRun);
|
||||
int RunID = pCurrentConf->m_vRuns.size() - 1;
|
||||
pCurrentRun = &pCurrentConf->m_vRuns[RunID];
|
||||
}
|
||||
else if(str_startswith(pLine, "Index") && pCurrentRun)
|
||||
{
|
||||
|
@ -146,9 +146,9 @@ void CAutoMapper::Load(const char *pTileName)
|
|||
}
|
||||
|
||||
// add the index rule object and make it current
|
||||
pCurrentRun->m_aIndexRules.push_back(NewIndexRule);
|
||||
int IndexRuleID = pCurrentRun->m_aIndexRules.size() - 1;
|
||||
pCurrentIndex = &pCurrentRun->m_aIndexRules[IndexRuleID];
|
||||
pCurrentRun->m_vIndexRules.push_back(NewIndexRule);
|
||||
int IndexRuleID = pCurrentRun->m_vIndexRules.size() - 1;
|
||||
pCurrentIndex = &pCurrentRun->m_vIndexRules[IndexRuleID];
|
||||
}
|
||||
else if(str_startswith(pLine, "Pos") && pCurrentIndex)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ void CAutoMapper::Load(const char *pTileName)
|
|||
if(Value != CPosRule::NORULE)
|
||||
{
|
||||
CPosRule NewPosRule = {x, y, Value, NewIndexList};
|
||||
pCurrentIndex->m_aRules.push_back(NewPosRule);
|
||||
pCurrentIndex->m_vRules.push_back(NewPosRule);
|
||||
|
||||
pCurrentConf->m_StartX = minimum(pCurrentConf->m_StartX, NewPosRule.m_X);
|
||||
pCurrentConf->m_StartY = minimum(pCurrentConf->m_StartY, NewPosRule.m_Y);
|
||||
|
@ -325,14 +325,14 @@ void CAutoMapper::Load(const char *pTileName)
|
|||
}
|
||||
|
||||
// add default rule for Pos 0 0 if there is none
|
||||
for(auto &Config : m_lConfigs)
|
||||
for(auto &Config : m_vConfigs)
|
||||
{
|
||||
for(auto &Run : Config.m_aRuns)
|
||||
for(auto &Run : Config.m_vRuns)
|
||||
{
|
||||
for(auto &IndexRule : Run.m_aIndexRules)
|
||||
for(auto &IndexRule : Run.m_vIndexRules)
|
||||
{
|
||||
bool Found = false;
|
||||
for(const auto &Rule : IndexRule.m_aRules)
|
||||
for(const auto &Rule : IndexRule.m_vRules)
|
||||
{
|
||||
if(Rule.m_X == 0 && Rule.m_Y == 0)
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ void CAutoMapper::Load(const char *pTileName)
|
|||
CIndexInfo NewIndexInfo = {0, 0, false};
|
||||
NewIndexList.push_back(NewIndexInfo);
|
||||
CPosRule NewPosRule = {0, 0, CPosRule::NOTINDEX, NewIndexList};
|
||||
IndexRule.m_aRules.push_back(NewPosRule);
|
||||
IndexRule.m_vRules.push_back(NewPosRule);
|
||||
|
||||
IndexRule.m_SkipEmpty = true;
|
||||
IndexRule.m_SkipFull = false;
|
||||
|
@ -370,15 +370,15 @@ void CAutoMapper::Load(const char *pTileName)
|
|||
|
||||
const char *CAutoMapper::GetConfigName(int Index)
|
||||
{
|
||||
if(Index < 0 || Index >= (int)m_lConfigs.size())
|
||||
if(Index < 0 || Index >= (int)m_vConfigs.size())
|
||||
return "";
|
||||
|
||||
return m_lConfigs[Index].m_aName;
|
||||
return m_vConfigs[Index].m_aName;
|
||||
}
|
||||
|
||||
void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed, int X, int Y, int Width, int Height)
|
||||
{
|
||||
if(!m_FileLoaded || pLayer->m_Readonly || ConfigID < 0 || ConfigID >= (int)m_lConfigs.size())
|
||||
if(!m_FileLoaded || pLayer->m_Readonly || ConfigID < 0 || ConfigID >= (int)m_vConfigs.size())
|
||||
return;
|
||||
|
||||
if(Width < 0)
|
||||
|
@ -387,7 +387,7 @@ void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed,
|
|||
if(Height < 0)
|
||||
Height = pLayer->m_Height;
|
||||
|
||||
CConfiguration *pConf = &m_lConfigs[ConfigID];
|
||||
CConfiguration *pConf = &m_vConfigs[ConfigID];
|
||||
|
||||
int CommitFromX = clamp(X + pConf->m_StartX, 0, pLayer->m_Width);
|
||||
int CommitFromY = clamp(Y + pConf->m_StartY, 0, pLayer->m_Height);
|
||||
|
@ -430,18 +430,18 @@ void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed,
|
|||
|
||||
void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedOffsetX, int SeedOffsetY)
|
||||
{
|
||||
if(!m_FileLoaded || pLayer->m_Readonly || ConfigID < 0 || ConfigID >= (int)m_lConfigs.size())
|
||||
if(!m_FileLoaded || pLayer->m_Readonly || ConfigID < 0 || ConfigID >= (int)m_vConfigs.size())
|
||||
return;
|
||||
|
||||
if(Seed == 0)
|
||||
Seed = rand();
|
||||
|
||||
CConfiguration *pConf = &m_lConfigs[ConfigID];
|
||||
CConfiguration *pConf = &m_vConfigs[ConfigID];
|
||||
|
||||
// for every run: copy tiles, automap, overwrite tiles
|
||||
for(size_t h = 0; h < pConf->m_aRuns.size(); ++h)
|
||||
for(size_t h = 0; h < pConf->m_vRuns.size(); ++h)
|
||||
{
|
||||
CRun *pRun = &pConf->m_aRuns[h];
|
||||
CRun *pRun = &pConf->m_vRuns[h];
|
||||
|
||||
// don't make copy if it's requested
|
||||
CLayerTiles *pReadLayer;
|
||||
|
@ -473,18 +473,18 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedO
|
|||
CTile *pTile = &(pLayer->m_pTiles[y * pLayer->m_Width + x]);
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
|
||||
for(size_t i = 0; i < pRun->m_aIndexRules.size(); ++i)
|
||||
for(size_t i = 0; i < pRun->m_vIndexRules.size(); ++i)
|
||||
{
|
||||
CIndexRule *pIndexRule = &pRun->m_aIndexRules[i];
|
||||
CIndexRule *pIndexRule = &pRun->m_vIndexRules[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;
|
||||
for(size_t j = 0; j < pIndexRule->m_aRules.size() && RespectRules; ++j)
|
||||
for(size_t j = 0; j < pIndexRule->m_vRules.size() && RespectRules; ++j)
|
||||
{
|
||||
CPosRule *pRule = &pIndexRule->m_aRules[j];
|
||||
CPosRule *pRule = &pIndexRule->m_vRules[j];
|
||||
|
||||
int CheckIndex, CheckFlags;
|
||||
int CheckX = x + pRule->m_X;
|
||||
|
@ -504,7 +504,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedO
|
|||
if(pRule->m_Value == CPosRule::INDEX)
|
||||
{
|
||||
RespectRules = false;
|
||||
for(auto &Index : pRule->m_aIndexList)
|
||||
for(auto &Index : pRule->m_vIndexList)
|
||||
{
|
||||
if(CheckIndex == Index.m_ID && (!Index.m_TestFlag || CheckFlags == Index.m_Flag))
|
||||
{
|
||||
|
@ -515,7 +515,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedO
|
|||
}
|
||||
else if(pRule->m_Value == CPosRule::NOTINDEX)
|
||||
{
|
||||
for(auto &Index : pRule->m_aIndexList)
|
||||
for(auto &Index : pRule->m_vIndexList)
|
||||
{
|
||||
if(CheckIndex == Index.m_ID && (!Index.m_TestFlag || CheckFlags == Index.m_Flag))
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ class CAutoMapper
|
|||
int m_X;
|
||||
int m_Y;
|
||||
int m_Value;
|
||||
std::vector<CIndexInfo> m_aIndexList;
|
||||
std::vector<CIndexInfo> m_vIndexList;
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ class CAutoMapper
|
|||
struct CIndexRule
|
||||
{
|
||||
int m_ID;
|
||||
std::vector<CPosRule> m_aRules;
|
||||
std::vector<CPosRule> m_vRules;
|
||||
int m_Flag;
|
||||
float m_RandomProbability;
|
||||
bool m_DefaultRule;
|
||||
|
@ -40,13 +40,13 @@ class CAutoMapper
|
|||
|
||||
struct CRun
|
||||
{
|
||||
std::vector<CIndexRule> m_aIndexRules;
|
||||
std::vector<CIndexRule> m_vIndexRules;
|
||||
bool m_AutomapCopy;
|
||||
};
|
||||
|
||||
struct CConfiguration
|
||||
{
|
||||
std::vector<CRun> m_aRuns;
|
||||
std::vector<CRun> m_vRuns;
|
||||
char m_aName[128];
|
||||
int m_StartX;
|
||||
int m_StartY;
|
||||
|
@ -61,13 +61,13 @@ public:
|
|||
void ProceedLocalized(class CLayerTiles *pLayer, int ConfigID, int Seed = 0, int X = 0, int Y = 0, int Width = -1, int Height = -1);
|
||||
void Proceed(class CLayerTiles *pLayer, int ConfigID, int Seed = 0, int SeedOffsetX = 0, int SeedOffsetY = 0);
|
||||
|
||||
int ConfigNamesNum() const { return m_lConfigs.size(); }
|
||||
int ConfigNamesNum() const { return m_vConfigs.size(); }
|
||||
const char *GetConfigName(int Index);
|
||||
|
||||
bool IsLoaded() const { return m_FileLoaded; }
|
||||
|
||||
private:
|
||||
std::vector<CConfiguration> m_lConfigs;
|
||||
std::vector<CConfiguration> m_vConfigs;
|
||||
class CEditor *m_pEditor;
|
||||
bool m_FileLoaded;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,7 +41,7 @@ class CEnvelope
|
|||
{
|
||||
public:
|
||||
int m_Channels;
|
||||
std::vector<CEnvPoint> m_lPoints;
|
||||
std::vector<CEnvPoint> m_vPoints;
|
||||
char m_aName[32];
|
||||
float m_Bottom, m_Top;
|
||||
bool m_Synchronized;
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
void Resort()
|
||||
{
|
||||
std::sort(m_lPoints.begin(), m_lPoints.end());
|
||||
std::sort(m_vPoints.begin(), m_vPoints.end());
|
||||
FindTopBottom(0xf);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
{
|
||||
m_Top = -1000000000.0f;
|
||||
m_Bottom = 1000000000.0f;
|
||||
for(auto &Point : m_lPoints)
|
||||
for(auto &Point : m_vPoints)
|
||||
{
|
||||
for(int c = 0; c < m_Channels; c++)
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
int Eval(float Time, float *pResult)
|
||||
{
|
||||
CRenderTools::RenderEvalEnvelope(&m_lPoints[0], m_lPoints.size(), m_Channels, std::chrono::nanoseconds((int64_t)((double)Time * (double)std::chrono::nanoseconds(1s).count())), pResult);
|
||||
CRenderTools::RenderEvalEnvelope(&m_vPoints[0], m_vPoints.size(), m_Channels, std::chrono::nanoseconds((int64_t)((double)Time * (double)std::chrono::nanoseconds(1s).count())), pResult);
|
||||
return m_Channels;
|
||||
}
|
||||
|
||||
|
@ -96,14 +96,14 @@ public:
|
|||
p.m_aValues[2] = v2;
|
||||
p.m_aValues[3] = v3;
|
||||
p.m_Curvetype = CURVETYPE_LINEAR;
|
||||
m_lPoints.push_back(p);
|
||||
m_vPoints.push_back(p);
|
||||
Resort();
|
||||
}
|
||||
|
||||
float EndTime() const
|
||||
{
|
||||
if(!m_lPoints.empty())
|
||||
return m_lPoints[m_lPoints.size() - 1].m_Time * (1.0f / 1000.0f);
|
||||
if(!m_vPoints.empty())
|
||||
return m_vPoints[m_vPoints.size() - 1].m_Time * (1.0f / 1000.0f);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
@ -171,7 +171,7 @@ class CLayerGroup
|
|||
public:
|
||||
class CEditorMap *m_pMap;
|
||||
|
||||
std::vector<CLayer *> m_lLayers;
|
||||
std::vector<CLayer *> m_vpLayers;
|
||||
|
||||
int m_OffsetX;
|
||||
int m_OffsetY;
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
|
||||
bool IsEmpty() const
|
||||
{
|
||||
return m_lLayers.size() == 0; // stupid function, since its bad for Fillselection: TODO add a function for Fillselection that returns whether a specific tile is used in the given layer
|
||||
return m_vpLayers.size() == 0; // stupid function, since its bad for Fillselection: TODO add a function for Fillselection that returns whether a specific tile is used in the given layer
|
||||
}
|
||||
|
||||
/*bool IsUsedInThisLayer(int Layer, int Index) // <--------- this is what i meant but cause i don't know which Indexes belongs to which layers i can't finish yet
|
||||
|
@ -245,26 +245,26 @@ public:
|
|||
|
||||
void Clear()
|
||||
{
|
||||
m_lLayers.clear();
|
||||
m_vpLayers.clear();
|
||||
}
|
||||
|
||||
void AddLayer(CLayer *l);
|
||||
|
||||
void ModifyImageIndex(INDEX_MODIFY_FUNC Func)
|
||||
{
|
||||
for(auto &pLayer : m_lLayers)
|
||||
for(auto &pLayer : m_vpLayers)
|
||||
pLayer->ModifyImageIndex(Func);
|
||||
}
|
||||
|
||||
void ModifyEnvelopeIndex(INDEX_MODIFY_FUNC Func)
|
||||
{
|
||||
for(auto &pLayer : m_lLayers)
|
||||
for(auto &pLayer : m_vpLayers)
|
||||
pLayer->ModifyEnvelopeIndex(Func);
|
||||
}
|
||||
|
||||
void ModifySoundIndex(INDEX_MODIFY_FUNC Func)
|
||||
{
|
||||
for(auto &pLayer : m_lLayers)
|
||||
for(auto &pLayer : m_vpLayers)
|
||||
pLayer->ModifySoundIndex(Func);
|
||||
}
|
||||
};
|
||||
|
@ -340,10 +340,10 @@ public:
|
|||
Clean();
|
||||
}
|
||||
|
||||
std::vector<CLayerGroup *> m_lGroups;
|
||||
std::vector<CEditorImage *> m_lImages;
|
||||
std::vector<CEnvelope *> m_lEnvelopes;
|
||||
std::vector<CEditorSound *> m_lSounds;
|
||||
std::vector<CLayerGroup *> m_vpGroups;
|
||||
std::vector<CEditorImage *> m_vpImages;
|
||||
std::vector<CEnvelope *> m_vpEnvelopes;
|
||||
std::vector<CEditorSound *> m_vpSounds;
|
||||
|
||||
class CMapInfo
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ public:
|
|||
{
|
||||
char m_aCommand[256];
|
||||
};
|
||||
std::vector<CSetting> m_lSettings;
|
||||
std::vector<CSetting> m_vSettings;
|
||||
|
||||
class CLayerGame *m_pGameLayer;
|
||||
CLayerGroup *m_pGameGroup;
|
||||
|
@ -386,7 +386,7 @@ public:
|
|||
{
|
||||
m_Modified = true;
|
||||
CEnvelope *e = new CEnvelope(Channels);
|
||||
m_lEnvelopes.push_back(e);
|
||||
m_vpEnvelopes.push_back(e);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
@ -397,50 +397,50 @@ public:
|
|||
m_Modified = true;
|
||||
CLayerGroup *g = new CLayerGroup;
|
||||
g->m_pMap = this;
|
||||
m_lGroups.push_back(g);
|
||||
m_vpGroups.push_back(g);
|
||||
return g;
|
||||
}
|
||||
|
||||
int SwapGroups(int Index0, int Index1)
|
||||
{
|
||||
if(Index0 < 0 || Index0 >= (int)m_lGroups.size())
|
||||
if(Index0 < 0 || Index0 >= (int)m_vpGroups.size())
|
||||
return Index0;
|
||||
if(Index1 < 0 || Index1 >= (int)m_lGroups.size())
|
||||
if(Index1 < 0 || Index1 >= (int)m_vpGroups.size())
|
||||
return Index0;
|
||||
if(Index0 == Index1)
|
||||
return Index0;
|
||||
m_Modified = true;
|
||||
std::swap(m_lGroups[Index0], m_lGroups[Index1]);
|
||||
std::swap(m_vpGroups[Index0], m_vpGroups[Index1]);
|
||||
return Index1;
|
||||
}
|
||||
|
||||
void DeleteGroup(int Index)
|
||||
{
|
||||
if(Index < 0 || Index >= (int)m_lGroups.size())
|
||||
if(Index < 0 || Index >= (int)m_vpGroups.size())
|
||||
return;
|
||||
m_Modified = true;
|
||||
delete m_lGroups[Index];
|
||||
m_lGroups.erase(m_lGroups.begin() + Index);
|
||||
delete m_vpGroups[Index];
|
||||
m_vpGroups.erase(m_vpGroups.begin() + Index);
|
||||
}
|
||||
|
||||
void ModifyImageIndex(INDEX_MODIFY_FUNC pfnFunc)
|
||||
{
|
||||
m_Modified = true;
|
||||
for(auto &pGroup : m_lGroups)
|
||||
for(auto &pGroup : m_vpGroups)
|
||||
pGroup->ModifyImageIndex(pfnFunc);
|
||||
}
|
||||
|
||||
void ModifyEnvelopeIndex(INDEX_MODIFY_FUNC pfnFunc)
|
||||
{
|
||||
m_Modified = true;
|
||||
for(auto &pGroup : m_lGroups)
|
||||
for(auto &pGroup : m_vpGroups)
|
||||
pGroup->ModifyEnvelopeIndex(pfnFunc);
|
||||
}
|
||||
|
||||
void ModifySoundIndex(INDEX_MODIFY_FUNC pfnFunc)
|
||||
{
|
||||
m_Modified = true;
|
||||
for(auto &pGroup : m_lGroups)
|
||||
for(auto &pGroup : m_vpGroups)
|
||||
pGroup->ModifySoundIndex(pfnFunc);
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ public:
|
|||
int Height = -1;
|
||||
int Color = 0;
|
||||
};
|
||||
static int RenderCommonProperties(SCommonPropState &State, CEditor *pEditor, CUIRect *pToolbox, std::vector<CLayerTiles *> &pLayers);
|
||||
static int RenderCommonProperties(SCommonPropState &State, CEditor *pEditor, CUIRect *pToolbox, std::vector<CLayerTiles *> &vpLayers);
|
||||
|
||||
void ModifyImageIndex(INDEX_MODIFY_FUNC pfnFunc) override;
|
||||
void ModifyEnvelopeIndex(INDEX_MODIFY_FUNC pfnFunc) override;
|
||||
|
@ -655,7 +655,7 @@ public:
|
|||
void GetSize(float *w, float *h) override;
|
||||
|
||||
int m_Image;
|
||||
std::vector<CQuad> m_lQuads;
|
||||
std::vector<CQuad> m_vQuads;
|
||||
};
|
||||
|
||||
class CLayerGame : public CLayerTiles
|
||||
|
@ -924,12 +924,12 @@ public:
|
|||
|
||||
bool operator<(const CFilelistItem &Other) const { return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false : m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false : str_comp_nocase(m_aFilename, Other.m_aFilename) < 0; }
|
||||
};
|
||||
std::vector<CFilelistItem> m_FileList;
|
||||
std::vector<CFilelistItem> m_vFileList;
|
||||
int m_FilesStartAt;
|
||||
int m_FilesCur;
|
||||
int m_FilesStopAt;
|
||||
|
||||
std::vector<std::string> m_SelectEntitiesFiles;
|
||||
std::vector<std::string> m_vSelectEntitiesFiles;
|
||||
std::string m_SelectEntitiesImage;
|
||||
|
||||
float m_WorldOffsetX;
|
||||
|
@ -959,8 +959,8 @@ public:
|
|||
bool m_ShowServerSettingsEditor;
|
||||
bool m_ShowPicker;
|
||||
|
||||
std::vector<int> m_lSelectedLayers;
|
||||
std::vector<int> m_lSelectedQuads;
|
||||
std::vector<int> m_vSelectedLayers;
|
||||
std::vector<int> m_vSelectedQuads;
|
||||
int m_SelectedQuadPoint;
|
||||
int m_SelectedQuadIndex;
|
||||
int m_SelectedGroup;
|
||||
|
@ -1031,7 +1031,7 @@ public:
|
|||
|
||||
struct CLayerPopupContext
|
||||
{
|
||||
std::vector<CLayerTiles *> m_aLayers;
|
||||
std::vector<CLayerTiles *> m_vpLayers;
|
||||
CLayerTiles::SCommonPropState m_CommonPropState;
|
||||
};
|
||||
static int PopupLayer(CEditor *pEditor, CUIRect View, void *pContext);
|
||||
|
@ -1068,7 +1068,7 @@ public:
|
|||
void PopupSelectSoundInvoke(int Current, float x, float y);
|
||||
int PopupSelectSoundResult();
|
||||
|
||||
void DoQuadEnvelopes(const std::vector<CQuad> &m_lQuads, IGraphics::CTextureHandle Texture = IGraphics::CTextureHandle());
|
||||
void DoQuadEnvelopes(const std::vector<CQuad> &vQuads, IGraphics::CTextureHandle Texture = IGraphics::CTextureHandle());
|
||||
void DoQuadEnvPoint(const CQuad *pQuad, int QIndex, int pIndex);
|
||||
void DoQuadPoint(CQuad *pQuad, int QuadIndex, int v);
|
||||
|
||||
|
@ -1328,7 +1328,7 @@ public:
|
|||
void ModifySoundIndex(INDEX_MODIFY_FUNC pfnFunc) override;
|
||||
|
||||
int m_Sound;
|
||||
std::vector<CSoundSource> m_lSources;
|
||||
std::vector<CSoundSource> m_vSources;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -79,17 +79,17 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
Item.m_License = -1;
|
||||
|
||||
Item.m_Settings = -1;
|
||||
if(!m_lSettings.empty())
|
||||
if(!m_vSettings.empty())
|
||||
{
|
||||
int Size = 0;
|
||||
for(const auto &Setting : m_lSettings)
|
||||
for(const auto &Setting : m_vSettings)
|
||||
{
|
||||
Size += str_length(Setting.m_aCommand) + 1;
|
||||
}
|
||||
|
||||
char *pSettings = (char *)malloc(maximum(Size, 1));
|
||||
char *pNext = pSettings;
|
||||
for(const auto &Setting : m_lSettings)
|
||||
for(const auto &Setting : m_vSettings)
|
||||
{
|
||||
int Length = str_length(Setting.m_aCommand) + 1;
|
||||
mem_copy(pNext, Setting.m_aCommand, Length);
|
||||
|
@ -103,9 +103,9 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
}
|
||||
|
||||
// save images
|
||||
for(size_t i = 0; i < m_lImages.size(); i++)
|
||||
for(size_t i = 0; i < m_vpImages.size(); i++)
|
||||
{
|
||||
CEditorImage *pImg = m_lImages[i];
|
||||
CEditorImage *pImg = m_vpImages[i];
|
||||
|
||||
// analyse the image for when saving (should be done when we load the image)
|
||||
// TODO!
|
||||
|
@ -146,9 +146,9 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
}
|
||||
|
||||
// save sounds
|
||||
for(size_t i = 0; i < m_lSounds.size(); i++)
|
||||
for(size_t i = 0; i < m_vpSounds.size(); i++)
|
||||
{
|
||||
CEditorSound *pSound = m_lSounds[i];
|
||||
CEditorSound *pSound = m_vpSounds[i];
|
||||
|
||||
CMapItemSound Item;
|
||||
Item.m_Version = 1;
|
||||
|
@ -164,7 +164,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
// save layers
|
||||
int LayerCount = 0, GroupCount = 0;
|
||||
int AutomapperCount = 0;
|
||||
for(const auto &pGroup : m_lGroups)
|
||||
for(const auto &pGroup : m_vpGroups)
|
||||
{
|
||||
CMapItemGroup GItem;
|
||||
GItem.m_Version = CMapItemGroup::CURRENT_VERSION;
|
||||
|
@ -184,7 +184,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
// save group name
|
||||
StrToInts(GItem.m_aName, sizeof(GItem.m_aName) / sizeof(int), pGroup->m_aName);
|
||||
|
||||
for(const auto &pLayer : pGroup->m_lLayers)
|
||||
for(const auto &pLayer : pGroup->m_vpLayers)
|
||||
{
|
||||
if(pLayer->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
|
@ -279,7 +279,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
{
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving quads layer");
|
||||
CLayerQuads *pLayerQuads = (CLayerQuads *)pLayer;
|
||||
if(!pLayerQuads->m_lQuads.empty())
|
||||
if(!pLayerQuads->m_vQuads.empty())
|
||||
{
|
||||
CMapItemLayerQuads Item;
|
||||
Item.m_Version = 2;
|
||||
|
@ -289,8 +289,8 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
Item.m_Image = pLayerQuads->m_Image;
|
||||
|
||||
// add the data
|
||||
Item.m_NumQuads = pLayerQuads->m_lQuads.size();
|
||||
Item.m_Data = df.AddDataSwapped(pLayerQuads->m_lQuads.size() * sizeof(CQuad), &pLayerQuads->m_lQuads[0]);
|
||||
Item.m_NumQuads = pLayerQuads->m_vQuads.size();
|
||||
Item.m_Data = df.AddDataSwapped(pLayerQuads->m_vQuads.size() * sizeof(CQuad), &pLayerQuads->m_vQuads[0]);
|
||||
|
||||
// save layer name
|
||||
StrToInts(Item.m_aName, sizeof(Item.m_aName) / sizeof(int), pLayerQuads->m_aName);
|
||||
|
@ -308,7 +308,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
{
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving sounds layer");
|
||||
CLayerSounds *pLayerSounds = (CLayerSounds *)pLayer;
|
||||
if(!pLayerSounds->m_lSources.empty())
|
||||
if(!pLayerSounds->m_vSources.empty())
|
||||
{
|
||||
CMapItemLayerSounds Item;
|
||||
Item.m_Version = CMapItemLayerSounds::CURRENT_VERSION;
|
||||
|
@ -318,8 +318,8 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
Item.m_Sound = pLayerSounds->m_Sound;
|
||||
|
||||
// add the data
|
||||
Item.m_NumSources = pLayerSounds->m_lSources.size();
|
||||
Item.m_Data = df.AddDataSwapped(pLayerSounds->m_lSources.size() * sizeof(CSoundSource), &pLayerSounds->m_lSources[0]);
|
||||
Item.m_NumSources = pLayerSounds->m_vSources.size();
|
||||
Item.m_Data = df.AddDataSwapped(pLayerSounds->m_vSources.size() * sizeof(CSoundSource), &pLayerSounds->m_vSources[0]);
|
||||
|
||||
// save layer name
|
||||
StrToInts(Item.m_aName, sizeof(Item.m_aName) / sizeof(int), pLayerSounds->m_aName);
|
||||
|
@ -336,15 +336,15 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
|
||||
// save envelopes
|
||||
int PointCount = 0;
|
||||
for(size_t e = 0; e < m_lEnvelopes.size(); e++)
|
||||
for(size_t e = 0; e < m_vpEnvelopes.size(); e++)
|
||||
{
|
||||
CMapItemEnvelope Item;
|
||||
Item.m_Version = CMapItemEnvelope::CURRENT_VERSION;
|
||||
Item.m_Channels = m_lEnvelopes[e]->m_Channels;
|
||||
Item.m_Channels = m_vpEnvelopes[e]->m_Channels;
|
||||
Item.m_StartPoint = PointCount;
|
||||
Item.m_NumPoints = m_lEnvelopes[e]->m_lPoints.size();
|
||||
Item.m_Synchronized = m_lEnvelopes[e]->m_Synchronized;
|
||||
StrToInts(Item.m_aName, sizeof(Item.m_aName) / sizeof(int), m_lEnvelopes[e]->m_aName);
|
||||
Item.m_NumPoints = m_vpEnvelopes[e]->m_vPoints.size();
|
||||
Item.m_Synchronized = m_vpEnvelopes[e]->m_Synchronized;
|
||||
StrToInts(Item.m_aName, sizeof(Item.m_aName) / sizeof(int), m_vpEnvelopes[e]->m_aName);
|
||||
|
||||
df.AddItem(MAPITEMTYPE_ENVELOPE, e, sizeof(Item), &Item);
|
||||
PointCount += Item.m_NumPoints;
|
||||
|
@ -355,10 +355,10 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
|||
CEnvPoint *pPoints = (CEnvPoint *)calloc(maximum(PointCount, 1), sizeof(*pPoints));
|
||||
PointCount = 0;
|
||||
|
||||
for(const auto &pEnvelope : m_lEnvelopes)
|
||||
for(const auto &pEnvelope : m_vpEnvelopes)
|
||||
{
|
||||
int Count = pEnvelope->m_lPoints.size();
|
||||
mem_copy(&pPoints[PointCount], &pEnvelope->m_lPoints[0], sizeof(CEnvPoint) * Count);
|
||||
int Count = pEnvelope->m_vPoints.size();
|
||||
mem_copy(&pPoints[PointCount], &pEnvelope->m_vPoints[0], sizeof(CEnvPoint) * Count);
|
||||
PointCount += Count;
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
int StrSize = str_length(pNext) + 1;
|
||||
CSetting Setting;
|
||||
str_copy(Setting.m_aCommand, pNext, sizeof(Setting.m_aCommand));
|
||||
m_lSettings.push_back(Setting);
|
||||
m_vSettings.push_back(Setting);
|
||||
pNext += StrSize;
|
||||
}
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
// load auto mapper file
|
||||
pImg->m_AutoMapper.Load(pImg->m_aName);
|
||||
|
||||
m_lImages.push_back(pImg);
|
||||
m_vpImages.push_back(pImg);
|
||||
|
||||
// unload image
|
||||
DataFile.UnloadData(pItem->m_ImageData);
|
||||
|
@ -578,7 +578,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
if(pName)
|
||||
str_copy(pSound->m_aName, pName, sizeof(pSound->m_aName));
|
||||
|
||||
m_lSounds.push_back(pSound);
|
||||
m_vpSounds.push_back(pSound);
|
||||
|
||||
// unload image
|
||||
DataFile.UnloadData(pItem->m_SoundData);
|
||||
|
@ -851,7 +851,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
pQuads->m_pEditor = m_pEditor;
|
||||
pLayer = pQuads;
|
||||
pQuads->m_Image = pQuadsItem->m_Image;
|
||||
if(pQuads->m_Image < -1 || pQuads->m_Image >= (int)m_lImages.size())
|
||||
if(pQuads->m_Image < -1 || pQuads->m_Image >= (int)m_vpImages.size())
|
||||
pQuads->m_Image = -1;
|
||||
|
||||
// load layer name
|
||||
|
@ -860,8 +860,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
|
||||
void *pData = DataFile.GetDataSwapped(pQuadsItem->m_Data);
|
||||
pGroup->AddLayer(pQuads);
|
||||
pQuads->m_lQuads.resize(pQuadsItem->m_NumQuads);
|
||||
mem_copy(&pQuads->m_lQuads[0], pData, sizeof(CQuad) * pQuadsItem->m_NumQuads);
|
||||
pQuads->m_vQuads.resize(pQuadsItem->m_NumQuads);
|
||||
mem_copy(&pQuads->m_vQuads[0], pData, sizeof(CQuad) * pQuadsItem->m_NumQuads);
|
||||
DataFile.UnloadData(pQuadsItem->m_Data);
|
||||
}
|
||||
else if(pLayerItem->m_Type == LAYERTYPE_SOUNDS)
|
||||
|
@ -876,7 +876,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
pSounds->m_Sound = pSoundsItem->m_Sound;
|
||||
|
||||
// validate m_Sound
|
||||
if(pSounds->m_Sound < -1 || pSounds->m_Sound >= (int)m_lSounds.size())
|
||||
if(pSounds->m_Sound < -1 || pSounds->m_Sound >= (int)m_vpSounds.size())
|
||||
pSounds->m_Sound = -1;
|
||||
|
||||
// load layer name
|
||||
|
@ -886,8 +886,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
// load data
|
||||
void *pData = DataFile.GetDataSwapped(pSoundsItem->m_Data);
|
||||
pGroup->AddLayer(pSounds);
|
||||
pSounds->m_lSources.resize(pSoundsItem->m_NumSources);
|
||||
mem_copy(&pSounds->m_lSources[0], pData, sizeof(CSoundSource) * pSoundsItem->m_NumSources);
|
||||
pSounds->m_vSources.resize(pSoundsItem->m_NumSources);
|
||||
mem_copy(&pSounds->m_vSources[0], pData, sizeof(CSoundSource) * pSoundsItem->m_NumSources);
|
||||
DataFile.UnloadData(pSoundsItem->m_Data);
|
||||
}
|
||||
else if(pLayerItem->m_Type == LAYERTYPE_SOUNDS_DEPRECATED)
|
||||
|
@ -903,7 +903,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
pSounds->m_Sound = pSoundsItem->m_Sound;
|
||||
|
||||
// validate m_Sound
|
||||
if(pSounds->m_Sound < -1 || pSounds->m_Sound >= (int)m_lSounds.size())
|
||||
if(pSounds->m_Sound < -1 || pSounds->m_Sound >= (int)m_vpSounds.size())
|
||||
pSounds->m_Sound = -1;
|
||||
|
||||
// load layer name
|
||||
|
@ -913,13 +913,13 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
// load data
|
||||
CSoundSource_DEPRECATED *pData = (CSoundSource_DEPRECATED *)DataFile.GetDataSwapped(pSoundsItem->m_Data);
|
||||
pGroup->AddLayer(pSounds);
|
||||
pSounds->m_lSources.resize(pSoundsItem->m_NumSources);
|
||||
pSounds->m_vSources.resize(pSoundsItem->m_NumSources);
|
||||
|
||||
for(int i = 0; i < pSoundsItem->m_NumSources; i++)
|
||||
{
|
||||
CSoundSource_DEPRECATED *pOldSource = &pData[i];
|
||||
|
||||
CSoundSource &Source = pSounds->m_lSources[i];
|
||||
CSoundSource &Source = pSounds->m_vSources[i];
|
||||
Source.m_Position = pOldSource->m_Position;
|
||||
Source.m_Loop = pOldSource->m_Loop;
|
||||
Source.m_Pan = true;
|
||||
|
@ -961,11 +961,11 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
{
|
||||
CMapItemEnvelope *pItem = (CMapItemEnvelope *)DataFile.GetItem(Start + e, 0, 0);
|
||||
CEnvelope *pEnv = new CEnvelope(pItem->m_Channels);
|
||||
pEnv->m_lPoints.resize(pItem->m_NumPoints);
|
||||
mem_copy(&pEnv->m_lPoints[0], &pPoints[pItem->m_StartPoint], sizeof(CEnvPoint) * pItem->m_NumPoints);
|
||||
pEnv->m_vPoints.resize(pItem->m_NumPoints);
|
||||
mem_copy(&pEnv->m_vPoints[0], &pPoints[pItem->m_StartPoint], sizeof(CEnvPoint) * pItem->m_NumPoints);
|
||||
if(pItem->m_aName[0] != -1) // compatibility with old maps
|
||||
IntsToStr(pItem->m_aName, sizeof(pItem->m_aName) / sizeof(int), pEnv->m_aName);
|
||||
m_lEnvelopes.push_back(pEnv);
|
||||
m_vpEnvelopes.push_back(pEnv);
|
||||
if(pItem->m_Version >= 2)
|
||||
pEnv->m_Synchronized = pItem->m_Synchronized;
|
||||
}
|
||||
|
@ -979,13 +979,13 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
CMapItemAutoMapperConfig *pItem = (CMapItemAutoMapperConfig *)DataFile.GetItem(Start + i, 0, 0);
|
||||
if(pItem->m_Version == CMapItemAutoMapperConfig::CURRENT_VERSION)
|
||||
{
|
||||
if(pItem->m_GroupId >= 0 && (size_t)pItem->m_GroupId < m_lGroups.size() &&
|
||||
pItem->m_LayerId >= 0 && (size_t)pItem->m_LayerId < m_lGroups[pItem->m_GroupId]->m_lLayers.size())
|
||||
if(pItem->m_GroupId >= 0 && (size_t)pItem->m_GroupId < m_vpGroups.size() &&
|
||||
pItem->m_LayerId >= 0 && (size_t)pItem->m_LayerId < m_vpGroups[pItem->m_GroupId]->m_vpLayers.size())
|
||||
{
|
||||
CLayer *pLayer = m_lGroups[pItem->m_GroupId]->m_lLayers[pItem->m_LayerId];
|
||||
CLayer *pLayer = m_vpGroups[pItem->m_GroupId]->m_vpLayers[pItem->m_LayerId];
|
||||
if(pLayer->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
CLayerTiles *pTiles = (CLayerTiles *)m_lGroups[pItem->m_GroupId]->m_lLayers[pItem->m_LayerId];
|
||||
CLayerTiles *pTiles = (CLayerTiles *)m_vpGroups[pItem->m_GroupId]->m_vpLayers[pItem->m_LayerId];
|
||||
// only load auto mappers for tile layers (not physics layers)
|
||||
if(!(pTiles->m_Game || pTiles->m_Tele || pTiles->m_Speedup ||
|
||||
pTiles->m_Front || pTiles->m_Switch || pTiles->m_Tune))
|
||||
|
@ -1025,35 +1025,35 @@ int CEditor::Append(const char *pFileName, int StorageType)
|
|||
return Err;
|
||||
|
||||
// modify indecies
|
||||
gs_ModifyAddAmount = m_Map.m_lImages.size();
|
||||
gs_ModifyAddAmount = m_Map.m_vpImages.size();
|
||||
NewMap.ModifyImageIndex(ModifyAdd);
|
||||
|
||||
gs_ModifyAddAmount = m_Map.m_lEnvelopes.size();
|
||||
gs_ModifyAddAmount = m_Map.m_vpEnvelopes.size();
|
||||
NewMap.ModifyEnvelopeIndex(ModifyAdd);
|
||||
|
||||
// transfer images
|
||||
for(const auto &pImage : NewMap.m_lImages)
|
||||
m_Map.m_lImages.push_back(pImage);
|
||||
NewMap.m_lImages.clear();
|
||||
for(const auto &pImage : NewMap.m_vpImages)
|
||||
m_Map.m_vpImages.push_back(pImage);
|
||||
NewMap.m_vpImages.clear();
|
||||
|
||||
// transfer envelopes
|
||||
for(const auto &pEnvelope : NewMap.m_lEnvelopes)
|
||||
m_Map.m_lEnvelopes.push_back(pEnvelope);
|
||||
NewMap.m_lEnvelopes.clear();
|
||||
for(const auto &pEnvelope : NewMap.m_vpEnvelopes)
|
||||
m_Map.m_vpEnvelopes.push_back(pEnvelope);
|
||||
NewMap.m_vpEnvelopes.clear();
|
||||
|
||||
// transfer groups
|
||||
|
||||
for(const auto &pGroup : NewMap.m_lGroups)
|
||||
for(const auto &pGroup : NewMap.m_vpGroups)
|
||||
{
|
||||
if(pGroup == NewMap.m_pGameGroup)
|
||||
delete pGroup;
|
||||
else
|
||||
{
|
||||
pGroup->m_pMap = &m_Map;
|
||||
m_Map.m_lGroups.push_back(pGroup);
|
||||
m_Map.m_vpGroups.push_back(pGroup);
|
||||
}
|
||||
}
|
||||
NewMap.m_lGroups.clear();
|
||||
NewMap.m_vpGroups.clear();
|
||||
|
||||
// all done \o/
|
||||
return 0;
|
||||
|
|
|
@ -19,21 +19,21 @@ CLayerQuads::~CLayerQuads() = default;
|
|||
void CLayerQuads::Render(bool QuadPicker)
|
||||
{
|
||||
Graphics()->TextureClear();
|
||||
if(m_Image >= 0 && (size_t)m_Image < m_pEditor->m_Map.m_lImages.size())
|
||||
Graphics()->TextureSet(m_pEditor->m_Map.m_lImages[m_Image]->m_Texture);
|
||||
if(m_Image >= 0 && (size_t)m_Image < m_pEditor->m_Map.m_vpImages.size())
|
||||
Graphics()->TextureSet(m_pEditor->m_Map.m_vpImages[m_Image]->m_Texture);
|
||||
|
||||
Graphics()->BlendNone();
|
||||
m_pEditor->RenderTools()->ForceRenderQuads(&m_lQuads[0], m_lQuads.size(), LAYERRENDERFLAG_OPAQUE, m_pEditor->EnvelopeEval, m_pEditor);
|
||||
m_pEditor->RenderTools()->ForceRenderQuads(&m_vQuads[0], m_vQuads.size(), LAYERRENDERFLAG_OPAQUE, m_pEditor->EnvelopeEval, m_pEditor);
|
||||
Graphics()->BlendNormal();
|
||||
m_pEditor->RenderTools()->ForceRenderQuads(&m_lQuads[0], m_lQuads.size(), LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor);
|
||||
m_pEditor->RenderTools()->ForceRenderQuads(&m_vQuads[0], m_vQuads.size(), LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor);
|
||||
}
|
||||
|
||||
CQuad *CLayerQuads::NewQuad(int x, int y, int Width, int Height)
|
||||
{
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
|
||||
m_lQuads.emplace_back();
|
||||
CQuad *q = &m_lQuads[m_lQuads.size() - 1];
|
||||
m_vQuads.emplace_back();
|
||||
CQuad *q = &m_vQuads[m_vQuads.size() - 1];
|
||||
|
||||
q->m_PosEnv = -1;
|
||||
q->m_ColorEnv = -1;
|
||||
|
@ -109,7 +109,7 @@ int CLayerQuads::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pBrush->AddLayer(pGrabbed);
|
||||
|
||||
//dbg_msg("", "%f %f %f %f", rect.x, rect.y, rect.w, rect.h);
|
||||
for(const auto &Quad : m_lQuads)
|
||||
for(const auto &Quad : m_vQuads)
|
||||
{
|
||||
float px = fx2f(Quad.m_aPoints[4].x);
|
||||
float py = fx2f(Quad.m_aPoints[4].y);
|
||||
|
@ -124,17 +124,17 @@ int CLayerQuads::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
Point.y -= f2fx(Rect.y);
|
||||
}
|
||||
|
||||
pGrabbed->m_lQuads.push_back(n);
|
||||
pGrabbed->m_vQuads.push_back(n);
|
||||
}
|
||||
}
|
||||
|
||||
return pGrabbed->m_lQuads.empty() ? 0 : 1;
|
||||
return pGrabbed->m_vQuads.empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
void CLayerQuads::BrushPlace(CLayer *pBrush, float wx, float wy)
|
||||
{
|
||||
CLayerQuads *l = (CLayerQuads *)pBrush;
|
||||
for(const auto &Quad : l->m_lQuads)
|
||||
for(const auto &Quad : l->m_vQuads)
|
||||
{
|
||||
CQuad n = Quad;
|
||||
|
||||
|
@ -144,14 +144,14 @@ void CLayerQuads::BrushPlace(CLayer *pBrush, float wx, float wy)
|
|||
Point.y += f2fx(wy);
|
||||
}
|
||||
|
||||
m_lQuads.push_back(n);
|
||||
m_vQuads.push_back(n);
|
||||
}
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
}
|
||||
|
||||
void CLayerQuads::BrushFlipX()
|
||||
{
|
||||
for(auto &Quad : m_lQuads)
|
||||
for(auto &Quad : m_vQuads)
|
||||
{
|
||||
std::swap(Quad.m_aPoints[0], Quad.m_aPoints[1]);
|
||||
std::swap(Quad.m_aPoints[2], Quad.m_aPoints[3]);
|
||||
|
@ -161,7 +161,7 @@ void CLayerQuads::BrushFlipX()
|
|||
|
||||
void CLayerQuads::BrushFlipY()
|
||||
{
|
||||
for(auto &Quad : m_lQuads)
|
||||
for(auto &Quad : m_vQuads)
|
||||
{
|
||||
std::swap(Quad.m_aPoints[0], Quad.m_aPoints[2]);
|
||||
std::swap(Quad.m_aPoints[1], Quad.m_aPoints[3]);
|
||||
|
@ -184,7 +184,7 @@ void CLayerQuads::BrushRotate(float Amount)
|
|||
Center.x /= 2;
|
||||
Center.y /= 2;
|
||||
|
||||
for(auto &Quad : m_lQuads)
|
||||
for(auto &Quad : m_vQuads)
|
||||
{
|
||||
for(auto &Point : Quad.m_aPoints)
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ void CLayerQuads::GetSize(float *w, float *h)
|
|||
*w = 0;
|
||||
*h = 0;
|
||||
|
||||
for(const auto &Quad : m_lQuads)
|
||||
for(const auto &Quad : m_vQuads)
|
||||
{
|
||||
for(const auto &Point : Quad.m_aPoints)
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ int CLayerQuads::RenderProperties(CUIRect *pToolBox)
|
|||
if(Prop == PROP_IMAGE)
|
||||
{
|
||||
if(NewVal >= 0)
|
||||
m_Image = NewVal % m_pEditor->m_Map.m_lImages.size();
|
||||
m_Image = NewVal % m_pEditor->m_Map.m_vpImages.size();
|
||||
else
|
||||
m_Image = -1;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ void CLayerQuads::ModifyImageIndex(INDEX_MODIFY_FUNC Func)
|
|||
|
||||
void CLayerQuads::ModifyEnvelopeIndex(INDEX_MODIFY_FUNC Func)
|
||||
{
|
||||
for(auto &Quad : m_lQuads)
|
||||
for(auto &Quad : m_vQuads)
|
||||
{
|
||||
Func(&Quad.m_PosEnv);
|
||||
Func(&Quad.m_ColorEnv);
|
||||
|
|
|
@ -23,7 +23,7 @@ void CLayerSounds::Render(bool Tileset)
|
|||
|
||||
// draw falloff distance
|
||||
Graphics()->SetColor(0.6f, 0.8f, 1.0f, 0.4f);
|
||||
for(const auto &Source : m_lSources)
|
||||
for(const auto &Source : m_vSources)
|
||||
{
|
||||
float OffsetX = 0;
|
||||
float OffsetY = 0;
|
||||
|
@ -73,7 +73,7 @@ void CLayerSounds::Render(bool Tileset)
|
|||
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
m_pEditor->RenderTools()->SelectSprite(SPRITE_AUDIO_SOURCE);
|
||||
for(const auto &Source : m_lSources)
|
||||
for(const auto &Source : m_vSources)
|
||||
{
|
||||
float OffsetX = 0;
|
||||
float OffsetY = 0;
|
||||
|
@ -96,8 +96,8 @@ CSoundSource *CLayerSounds::NewSource(int x, int y)
|
|||
{
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
|
||||
m_lSources.emplace_back();
|
||||
CSoundSource *pSource = &m_lSources[m_lSources.size() - 1];
|
||||
m_vSources.emplace_back();
|
||||
CSoundSource *pSource = &m_vSources[m_vSources.size() - 1];
|
||||
|
||||
pSource->m_Position.x = f2fx(x);
|
||||
pSource->m_Position.y = f2fx(y);
|
||||
|
@ -141,7 +141,7 @@ int CLayerSounds::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_Sound = m_Sound;
|
||||
pBrush->AddLayer(pGrabbed);
|
||||
|
||||
for(const auto &Source : m_lSources)
|
||||
for(const auto &Source : m_vSources)
|
||||
{
|
||||
float px = fx2f(Source.m_Position.x);
|
||||
float py = fx2f(Source.m_Position.y);
|
||||
|
@ -153,24 +153,24 @@ int CLayerSounds::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
n.m_Position.x -= f2fx(Rect.x);
|
||||
n.m_Position.y -= f2fx(Rect.y);
|
||||
|
||||
pGrabbed->m_lSources.push_back(n);
|
||||
pGrabbed->m_vSources.push_back(n);
|
||||
}
|
||||
}
|
||||
|
||||
return pGrabbed->m_lSources.empty() ? 0 : 1;
|
||||
return pGrabbed->m_vSources.empty() ? 0 : 1;
|
||||
}
|
||||
|
||||
void CLayerSounds::BrushPlace(CLayer *pBrush, float wx, float wy)
|
||||
{
|
||||
CLayerSounds *l = (CLayerSounds *)pBrush;
|
||||
for(const auto &Source : l->m_lSources)
|
||||
for(const auto &Source : l->m_vSources)
|
||||
{
|
||||
CSoundSource n = Source;
|
||||
|
||||
n.m_Position.x += f2fx(wx);
|
||||
n.m_Position.y += f2fx(wy);
|
||||
|
||||
m_lSources.push_back(n);
|
||||
m_vSources.push_back(n);
|
||||
}
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ int CLayerSounds::RenderProperties(CUIRect *pToolBox)
|
|||
if(Prop == PROP_SOUND)
|
||||
{
|
||||
if(NewVal >= 0)
|
||||
m_Sound = NewVal % m_pEditor->m_Map.m_lSounds.size();
|
||||
m_Sound = NewVal % m_pEditor->m_Map.m_vpSounds.size();
|
||||
else
|
||||
m_Sound = -1;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void CLayerSounds::ModifySoundIndex(INDEX_MODIFY_FUNC Func)
|
|||
|
||||
void CLayerSounds::ModifyEnvelopeIndex(INDEX_MODIFY_FUNC Func)
|
||||
{
|
||||
for(auto &Source : m_lSources)
|
||||
for(auto &Source : m_vSources)
|
||||
{
|
||||
Func(&Source.m_SoundEnv);
|
||||
Func(&Source.m_PosEnv);
|
||||
|
|
|
@ -65,7 +65,7 @@ void CLayerTiles::PrepareForSave()
|
|||
{
|
||||
for(int y = 0; y < m_Height; y++)
|
||||
for(int x = 0; x < m_Width; x++)
|
||||
m_pTiles[y * m_Width + x].m_Flags |= m_pEditor->m_Map.m_lImages[m_Image]->m_aTileFlags[m_pTiles[y * m_Width + x].m_Index];
|
||||
m_pTiles[y * m_Width + x].m_Flags |= m_pEditor->m_Map.m_vpImages[m_Image]->m_aTileFlags[m_pTiles[y * m_Width + x].m_Index];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,8 +78,8 @@ void CLayerTiles::MakePalette()
|
|||
|
||||
void CLayerTiles::Render(bool Tileset)
|
||||
{
|
||||
if(m_Image >= 0 && (size_t)m_Image < m_pEditor->m_Map.m_lImages.size())
|
||||
m_Texture = m_pEditor->m_Map.m_lImages[m_Image]->m_Texture;
|
||||
if(m_Image >= 0 && (size_t)m_Image < m_pEditor->m_Map.m_vpImages.size())
|
||||
m_Texture = m_pEditor->m_Map.m_vpImages[m_Image]->m_Texture;
|
||||
Graphics()->TextureSet(m_Texture);
|
||||
ColorRGBA Color = ColorRGBA(m_Color.r / 255.0f, m_Color.g / 255.0f, m_Color.b / 255.0f, m_Color.a / 255.0f);
|
||||
Graphics()->BlendNone();
|
||||
|
@ -653,7 +653,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
|
||||
bool IsGameLayer = (m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this || m_pEditor->m_Map.m_pTuneLayer == this);
|
||||
|
||||
CLayerGroup *pGroup = m_pEditor->m_Map.m_lGroups[m_pEditor->m_SelectedGroup];
|
||||
CLayerGroup *pGroup = m_pEditor->m_Map.m_vpGroups[m_pEditor->m_SelectedGroup];
|
||||
|
||||
// Game tiles can only be constructed if the layer is relative to the game layer
|
||||
if(!IsGameLayer && !(pGroup->m_OffsetX % 32) && !(pGroup->m_OffsetY % 32) && pGroup->m_ParallaxX == 100 && pGroup->m_ParallaxY == 100)
|
||||
|
@ -754,7 +754,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
|
||||
if(m_pEditor->m_Map.m_pGameLayer != this)
|
||||
{
|
||||
if(m_Image >= 0 && (size_t)m_Image < m_pEditor->m_Map.m_lImages.size() && m_pEditor->m_Map.m_lImages[m_Image]->m_AutoMapper.IsLoaded() &&
|
||||
if(m_Image >= 0 && (size_t)m_Image < m_pEditor->m_Map.m_vpImages.size() && m_pEditor->m_Map.m_vpImages[m_Image]->m_AutoMapper.IsLoaded() &&
|
||||
m_AutoMapperConfig != -1)
|
||||
{
|
||||
static int s_AutoMapperButton = 0;
|
||||
|
@ -774,7 +774,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
}
|
||||
if(m_pEditor->DoButton_Editor(&s_AutoMapperButton, "Automap", 0, &Button, 0, "Run the automapper"))
|
||||
{
|
||||
m_pEditor->m_Map.m_lImages[m_Image]->m_AutoMapper.Proceed(this, m_AutoMapperConfig, m_Seed);
|
||||
m_pEditor->m_Map.m_vpImages[m_Image]->m_AutoMapper.Proceed(this, m_AutoMapperConfig, m_Seed);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -865,10 +865,10 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_Image = NewVal % m_pEditor->m_Map.m_lImages.size();
|
||||
m_Image = NewVal % m_pEditor->m_Map.m_vpImages.size();
|
||||
m_AutoMapperConfig = -1;
|
||||
|
||||
if(m_pEditor->m_Map.m_lImages[m_Image]->m_Width % 16 != 0 || m_pEditor->m_Map.m_lImages[m_Image]->m_Height % 16 != 0)
|
||||
if(m_pEditor->m_Map.m_vpImages[m_Image]->m_Width % 16 != 0 || m_pEditor->m_Map.m_vpImages[m_Image]->m_Height % 16 != 0)
|
||||
{
|
||||
m_pEditor->m_PopupEventType = m_pEditor->POPEVENT_IMAGEDIV16;
|
||||
m_pEditor->m_PopupEventActivated = true;
|
||||
|
@ -887,12 +887,12 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
}
|
||||
if(Prop == PROP_COLOR_ENV)
|
||||
{
|
||||
int Index = clamp(NewVal - 1, -1, (int)m_pEditor->m_Map.m_lEnvelopes.size() - 1);
|
||||
int Index = clamp(NewVal - 1, -1, (int)m_pEditor->m_Map.m_vpEnvelopes.size() - 1);
|
||||
int Step = (Index - m_ColorEnv) % 2;
|
||||
if(Step != 0)
|
||||
{
|
||||
for(; Index >= -1 && Index < (int)m_pEditor->m_Map.m_lEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || m_pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 4)
|
||||
for(; Index >= -1 && Index < (int)m_pEditor->m_Map.m_vpEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || m_pEditor->m_Map.m_vpEnvelopes[Index]->m_Channels == 4)
|
||||
{
|
||||
m_ColorEnv = Index;
|
||||
break;
|
||||
|
@ -905,8 +905,8 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
m_Seed = NewVal;
|
||||
else if(Prop == PROP_AUTOMAPPER)
|
||||
{
|
||||
if(m_Image >= 0 && m_pEditor->m_Map.m_lImages[m_Image]->m_AutoMapper.ConfigNamesNum() > 0 && NewVal >= 0)
|
||||
m_AutoMapperConfig = NewVal % m_pEditor->m_Map.m_lImages[m_Image]->m_AutoMapper.ConfigNamesNum();
|
||||
if(m_Image >= 0 && m_pEditor->m_Map.m_vpImages[m_Image]->m_AutoMapper.ConfigNamesNum() > 0 && NewVal >= 0)
|
||||
m_AutoMapperConfig = NewVal % m_pEditor->m_Map.m_vpImages[m_Image]->m_AutoMapper.ConfigNamesNum();
|
||||
else
|
||||
m_AutoMapperConfig = -1;
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CLayerTiles::RenderCommonProperties(SCommonPropState &State, CEditor *pEditor, CUIRect *pToolbox, std::vector<CLayerTiles *> &pLayers)
|
||||
int CLayerTiles::RenderCommonProperties(SCommonPropState &State, CEditor *pEditor, CUIRect *pToolbox, std::vector<CLayerTiles *> &vpLayers)
|
||||
{
|
||||
if(State.Modified)
|
||||
{
|
||||
|
@ -928,7 +928,7 @@ int CLayerTiles::RenderCommonProperties(SCommonPropState &State, CEditor *pEdito
|
|||
if(pEditor->DoButton_Editor(&s_CommitButton, "Commit", 0, &Commit, 0, "Applies the changes"))
|
||||
{
|
||||
dbg_msg("editor", "applying changes");
|
||||
for(auto &pLayer : pLayers)
|
||||
for(auto &pLayer : vpLayers)
|
||||
{
|
||||
pLayer->Resize(State.Width, State.Height);
|
||||
|
||||
|
@ -944,7 +944,7 @@ int CLayerTiles::RenderCommonProperties(SCommonPropState &State, CEditor *pEdito
|
|||
}
|
||||
else
|
||||
{
|
||||
for(auto &pLayer : pLayers)
|
||||
for(auto &pLayer : vpLayers)
|
||||
{
|
||||
if(pLayer->m_Width > State.Width)
|
||||
State.Width = pLayer->m_Width;
|
||||
|
@ -1011,7 +1011,7 @@ int CLayerTiles::RenderCommonProperties(SCommonPropState &State, CEditor *pEdito
|
|||
}
|
||||
else if(Prop == PROP_SHIFT)
|
||||
{
|
||||
for(auto &pLayer : pLayers)
|
||||
for(auto &pLayer : vpLayers)
|
||||
pLayer->Shift(NewVal);
|
||||
}
|
||||
else if(Prop == PROP_SHIFT_BY)
|
||||
|
@ -1034,7 +1034,7 @@ void CLayerTiles::FlagModified(int x, int y, int w, int h)
|
|||
m_pEditor->m_Map.m_Modified = true;
|
||||
if(m_Seed != 0 && m_AutoMapperConfig != -1 && m_AutoAutoMap && m_Image >= 0)
|
||||
{
|
||||
m_pEditor->m_Map.m_lImages[m_Image]->m_AutoMapper.ProceedLocalized(this, m_AutoMapperConfig, m_Seed, x, y, w, h);
|
||||
m_pEditor->m_Map.m_vpImages[m_Image]->m_AutoMapper.ProceedLocalized(this, m_AutoMapperConfig, m_Seed, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
// gather all tile layers
|
||||
std::vector<CLayerTiles *> Layers;
|
||||
for(auto &pLayer : pEditor->m_Map.m_pGameGroup->m_lLayers)
|
||||
for(auto &pLayer : pEditor->m_Map.m_pGameGroup->m_vpLayers)
|
||||
{
|
||||
if(pLayer != pEditor->m_Map.m_pGameLayer && pLayer->m_Type == LAYERTYPE_TILES)
|
||||
Layers.push_back(static_cast<CLayerTiles *>(pLayer));
|
||||
|
@ -184,8 +184,8 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerTele(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeTeleLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerSpeedup(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeSpeedupLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -218,8 +218,8 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerTune(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeTuneLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -235,8 +235,8 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerFront(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeFrontLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerSwitch(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeSwitchLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerQuads;
|
||||
l->m_pEditor = pEditor;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -281,9 +281,9 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerTiles(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
l->m_pEditor = pEditor;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -295,9 +295,9 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
{
|
||||
CLayer *l = new CLayerSounds;
|
||||
l->m_pEditor = pEditor;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size() - 1);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pEditor->UI()->DoLabel(&Button, "Name:", 10.0f, TEXTALIGN_LEFT);
|
||||
Button.VSplitLeft(40.0f, 0, &Button);
|
||||
static float s_Name = 0;
|
||||
if(pEditor->DoEditBox(&s_Name, &Button, pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_aName, sizeof(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_aName), 10.0f, &s_Name))
|
||||
if(pEditor->DoEditBox(&s_Name, &Button, pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_aName, sizeof(pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_aName), 10.0f, &s_Name))
|
||||
pEditor->m_Map.m_Modified = true;
|
||||
}
|
||||
|
||||
|
@ -329,17 +329,17 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
};
|
||||
|
||||
CProperty aProps[] = {
|
||||
{"Order", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, (int)pEditor->m_Map.m_lGroups.size() - 1},
|
||||
{"Pos X", -pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_OffsetX, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Pos Y", -pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_OffsetY, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Para X", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ParallaxX, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Para Y", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ParallaxY, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Order", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, (int)pEditor->m_Map.m_vpGroups.size() - 1},
|
||||
{"Pos X", -pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_OffsetX, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Pos Y", -pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_OffsetY, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Para X", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ParallaxX, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Para Y", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ParallaxY, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
|
||||
{"Use Clipping", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_UseClipping, PROPTYPE_BOOL, 0, 1},
|
||||
{"Clip X", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipX, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Clip Y", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipY, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Clip W", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipW, PROPTYPE_INT_SCROLL, 0, 1000000},
|
||||
{"Clip H", pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipH, PROPTYPE_INT_SCROLL, 0, 1000000},
|
||||
{"Use Clipping", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_UseClipping, PROPTYPE_BOOL, 0, 1},
|
||||
{"Clip X", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipX, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Clip Y", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipY, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Clip W", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipW, PROPTYPE_INT_SCROLL, 0, 1000000},
|
||||
{"Clip H", pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipH, PROPTYPE_INT_SCROLL, 0, 1000000},
|
||||
{0},
|
||||
};
|
||||
|
||||
|
@ -361,23 +361,23 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
if(!pEditor->GetSelectedGroup()->m_GameGroup)
|
||||
{
|
||||
if(Prop == PROP_PARA_X)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ParallaxX = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ParallaxX = NewVal;
|
||||
else if(Prop == PROP_PARA_Y)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ParallaxY = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ParallaxY = NewVal;
|
||||
else if(Prop == PROP_POS_X)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_OffsetX = -NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_OffsetX = -NewVal;
|
||||
else if(Prop == PROP_POS_Y)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_OffsetY = -NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_OffsetY = -NewVal;
|
||||
else if(Prop == PROP_USE_CLIPPING)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_UseClipping = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_UseClipping = NewVal;
|
||||
else if(Prop == PROP_CLIP_X)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipX = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipX = NewVal;
|
||||
else if(Prop == PROP_CLIP_Y)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipY = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipY = NewVal;
|
||||
else if(Prop == PROP_CLIP_W)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipW = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipW = NewVal;
|
||||
else if(Prop == PROP_CLIP_H)
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_ClipH = NewVal;
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_ClipH = NewVal;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -392,9 +392,9 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
View.HSplitBottom(12.0f, &View, &Button);
|
||||
static int s_DeleteButton = 0;
|
||||
|
||||
if(pPopup->m_aLayers.size() > 1)
|
||||
if(pPopup->m_vpLayers.size() > 1)
|
||||
{
|
||||
return CLayerTiles::RenderCommonProperties(pPopup->m_CommonPropState, pEditor, &View, pPopup->m_aLayers);
|
||||
return CLayerTiles::RenderCommonProperties(pPopup->m_CommonPropState, pEditor, &View, pPopup->m_vpLayers);
|
||||
}
|
||||
|
||||
// don't allow deletion of game layer
|
||||
|
@ -411,7 +411,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pEditor->m_Map.m_pSwitchLayer = 0x0;
|
||||
if(pEditor->GetSelectedLayer(0) == pEditor->m_Map.m_pTuneLayer)
|
||||
pEditor->m_Map.m_pTuneLayer = 0x0;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->DeleteLayer(pEditor->m_lSelectedLayers[0]);
|
||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->DeleteLayer(pEditor->m_vSelectedLayers[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
View.HSplitBottom(10.0f, &View, 0);
|
||||
|
||||
CLayerGroup *pCurrentGroup = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup];
|
||||
CLayerGroup *pCurrentGroup = pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup];
|
||||
CLayer *pCurrentLayer = pEditor->GetSelectedLayer(0);
|
||||
|
||||
enum
|
||||
|
@ -442,8 +442,8 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
};
|
||||
|
||||
CProperty aProps[] = {
|
||||
{"Group", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, (int)pEditor->m_Map.m_lGroups.size() - 1},
|
||||
{"Order", pEditor->m_lSelectedLayers[0], PROPTYPE_INT_STEP, 0, (int)pCurrentGroup->m_lLayers.size()},
|
||||
{"Group", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, (int)pEditor->m_Map.m_vpGroups.size() - 1},
|
||||
{"Order", pEditor->m_vSelectedLayers[0], PROPTYPE_INT_STEP, 0, (int)pCurrentGroup->m_vpLayers.size()},
|
||||
{"Detail", pCurrentLayer && pCurrentLayer->m_Flags & LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1},
|
||||
{0},
|
||||
};
|
||||
|
@ -462,17 +462,17 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pEditor->m_Map.m_Modified = true;
|
||||
|
||||
if(Prop == PROP_ORDER)
|
||||
pEditor->SelectLayer(pCurrentGroup->SwapLayers(pEditor->m_lSelectedLayers[0], NewVal));
|
||||
pEditor->SelectLayer(pCurrentGroup->SwapLayers(pEditor->m_vSelectedLayers[0], NewVal));
|
||||
else if(Prop == PROP_GROUP && pCurrentLayer && pCurrentLayer->m_Type != LAYERTYPE_GAME)
|
||||
{
|
||||
if(NewVal >= 0 && (size_t)NewVal < pEditor->m_Map.m_lGroups.size())
|
||||
if(NewVal >= 0 && (size_t)NewVal < pEditor->m_Map.m_vpGroups.size())
|
||||
{
|
||||
auto Position = std::find(pCurrentGroup->m_lLayers.begin(), pCurrentGroup->m_lLayers.end(), pCurrentLayer);
|
||||
if(Position != pCurrentGroup->m_lLayers.end())
|
||||
pCurrentGroup->m_lLayers.erase(Position);
|
||||
pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.push_back(pCurrentLayer);
|
||||
auto Position = std::find(pCurrentGroup->m_vpLayers.begin(), pCurrentGroup->m_vpLayers.end(), pCurrentLayer);
|
||||
if(Position != pCurrentGroup->m_vpLayers.end())
|
||||
pCurrentGroup->m_vpLayers.erase(Position);
|
||||
pEditor->m_Map.m_vpGroups[NewVal]->m_vpLayers.push_back(pCurrentLayer);
|
||||
pEditor->m_SelectedGroup = NewVal;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.size() - 1);
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_vpGroups[NewVal]->m_vpLayers.size() - 1);
|
||||
}
|
||||
}
|
||||
else if(Prop == PROP_HQ && pCurrentLayer)
|
||||
|
@ -512,7 +512,7 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
View.HSplitBottom(10.0f, &View, &Button);
|
||||
View.HSplitBottom(12.0f, &View, &Button);
|
||||
CLayerQuads *pLayer = (CLayerQuads *)pEditor->GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(pLayer && pLayer->m_Image >= 0 && (size_t)pLayer->m_Image < pEditor->m_Map.m_lImages.size())
|
||||
if(pLayer && pLayer->m_Image >= 0 && (size_t)pLayer->m_Image < pEditor->m_Map.m_vpImages.size())
|
||||
{
|
||||
static int s_AspectRatioButton = 0;
|
||||
if(pEditor->DoButton_Editor(&s_AspectRatioButton, "Aspect ratio", 0, &Button, 0, "Resizes the current Quad based on the aspect ratio of the image"))
|
||||
|
@ -533,7 +533,7 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
Right = pQuad->m_aPoints[k].x;
|
||||
}
|
||||
|
||||
int Height = (Right - Left) * pEditor->m_Map.m_lImages[pLayer->m_Image]->m_Height / pEditor->m_Map.m_lImages[pLayer->m_Image]->m_Width;
|
||||
int Height = (Right - Left) * pEditor->m_Map.m_vpImages[pLayer->m_Image]->m_Height / pEditor->m_Map.m_vpImages[pLayer->m_Image]->m_Width;
|
||||
|
||||
pQuad->m_aPoints[0].x = Left;
|
||||
pQuad->m_aPoints[0].y = Top;
|
||||
|
@ -661,12 +661,12 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
}
|
||||
if(Prop == PROP_POS_ENV)
|
||||
{
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_lEnvelopes.size() - 1);
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_vpEnvelopes.size() - 1);
|
||||
int Step = (Index - pQuad->m_PosEnv) % 2;
|
||||
if(Step != 0)
|
||||
{
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_lEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 3)
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_vpEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_vpEnvelopes[Index]->m_Channels == 3)
|
||||
{
|
||||
pQuad->m_PosEnv = Index;
|
||||
break;
|
||||
|
@ -677,12 +677,12 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pQuad->m_PosEnvOffset = NewVal;
|
||||
if(Prop == PROP_COLOR_ENV)
|
||||
{
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_lEnvelopes.size() - 1);
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_vpEnvelopes.size() - 1);
|
||||
int Step = (Index - pQuad->m_ColorEnv) % 2;
|
||||
if(Step != 0)
|
||||
{
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_lEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 4)
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_vpEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_vpEnvelopes[Index]->m_Channels == 4)
|
||||
{
|
||||
pQuad->m_ColorEnv = Index;
|
||||
break;
|
||||
|
@ -711,7 +711,7 @@ int CEditor::PopupSource(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
if(pLayer)
|
||||
{
|
||||
pEditor->m_Map.m_Modified = true;
|
||||
pLayer->m_lSources.erase(pLayer->m_lSources.begin() + pEditor->m_SelectedSource);
|
||||
pLayer->m_vSources.erase(pLayer->m_vSources.begin() + pEditor->m_SelectedSource);
|
||||
pEditor->m_SelectedSource--;
|
||||
}
|
||||
return 1;
|
||||
|
@ -800,12 +800,12 @@ int CEditor::PopupSource(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pSource->m_Falloff = NewVal;
|
||||
if(Prop == PROP_POS_ENV)
|
||||
{
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_lEnvelopes.size() - 1);
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_vpEnvelopes.size() - 1);
|
||||
int Step = (Index - pSource->m_PosEnv) % 2;
|
||||
if(Step != 0)
|
||||
{
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_lEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 3)
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_vpEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_vpEnvelopes[Index]->m_Channels == 3)
|
||||
{
|
||||
pSource->m_PosEnv = Index;
|
||||
break;
|
||||
|
@ -816,12 +816,12 @@ int CEditor::PopupSource(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
pSource->m_PosEnvOffset = NewVal;
|
||||
if(Prop == PROP_SOUND_ENV)
|
||||
{
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_lEnvelopes.size() - 1);
|
||||
int Index = clamp(NewVal - 1, -1, (int)pEditor->m_Map.m_vpEnvelopes.size() - 1);
|
||||
int Step = (Index - pSource->m_SoundEnv) % 2;
|
||||
if(Step != 0)
|
||||
{
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_lEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_lEnvelopes[Index]->m_Channels == 1)
|
||||
for(; Index >= -1 && Index < (int)pEditor->m_Map.m_vpEnvelopes.size(); Index += Step)
|
||||
if(Index == -1 || pEditor->m_Map.m_vpEnvelopes[Index]->m_Channels == 1)
|
||||
{
|
||||
pSource->m_SoundEnv = Index;
|
||||
break;
|
||||
|
@ -925,7 +925,7 @@ int CEditor::PopupPoint(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
CProperty aProps[] = {
|
||||
{"Pos X", x, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Pos Y", y, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Color", Color, PROPTYPE_COLOR, -1, (int)pEditor->m_Map.m_lEnvelopes.size()},
|
||||
{"Color", Color, PROPTYPE_COLOR, -1, (int)pEditor->m_Map.m_vpEnvelopes.size()},
|
||||
{"Tex U", tu, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{"Tex V", tv, PROPTYPE_INT_SCROLL, -1000000, 1000000},
|
||||
{0},
|
||||
|
@ -1225,10 +1225,10 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
int ShowImage = g_SelectImageCurrent;
|
||||
|
||||
static float s_ScrollValue = 0;
|
||||
float ImagesHeight = pEditor->m_Map.m_lImages.size() * 14;
|
||||
float ImagesHeight = pEditor->m_Map.m_vpImages.size() * 14;
|
||||
float ScrollDifference = ImagesHeight - ButtonBar.h;
|
||||
|
||||
if(pEditor->m_Map.m_lImages.size() > 20) // Do we need a scrollbar?
|
||||
if(pEditor->m_Map.m_vpImages.size() > 20) // Do we need a scrollbar?
|
||||
{
|
||||
CUIRect Scroll;
|
||||
ButtonBar.VSplitRight(20.0f, &ButtonBar, &Scroll);
|
||||
|
@ -1253,7 +1253,7 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
float ImageStopAt = ImagesHeight - ScrollDifference * (1 - s_ScrollValue);
|
||||
float ImageCur = 0.0f;
|
||||
for(int i = -1; i < (int)pEditor->m_Map.m_lImages.size(); i++)
|
||||
for(int i = -1; i < (int)pEditor->m_Map.m_vpImages.size(); i++)
|
||||
{
|
||||
if(ImageCur > ImageStopAt)
|
||||
break;
|
||||
|
@ -1272,26 +1272,26 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
if(i == -1)
|
||||
{
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_lImages[i], "None", i == g_SelectImageCurrent, &Button))
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_vpImages[i], "None", i == g_SelectImageCurrent, &Button))
|
||||
g_SelectImageSelected = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_lImages[i], pEditor->m_Map.m_lImages[i]->m_aName, i == g_SelectImageCurrent, &Button))
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_vpImages[i], pEditor->m_Map.m_vpImages[i]->m_aName, i == g_SelectImageCurrent, &Button))
|
||||
g_SelectImageSelected = i;
|
||||
}
|
||||
}
|
||||
|
||||
if(ShowImage >= 0 && (size_t)ShowImage < pEditor->m_Map.m_lImages.size())
|
||||
if(ShowImage >= 0 && (size_t)ShowImage < pEditor->m_Map.m_vpImages.size())
|
||||
{
|
||||
if(ImageView.h < ImageView.w)
|
||||
ImageView.w = ImageView.h;
|
||||
else
|
||||
ImageView.h = ImageView.w;
|
||||
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_Texture);
|
||||
float Max = (float)(maximum(pEditor->m_Map.m_vpImages[ShowImage]->m_Width, pEditor->m_Map.m_vpImages[ShowImage]->m_Height));
|
||||
ImageView.w *= pEditor->m_Map.m_vpImages[ShowImage]->m_Width / Max;
|
||||
ImageView.h *= pEditor->m_Map.m_vpImages[ShowImage]->m_Height / Max;
|
||||
pEditor->Graphics()->TextureSet(pEditor->m_Map.m_vpImages[ShowImage]->m_Texture);
|
||||
pEditor->Graphics()->BlendNormal();
|
||||
pEditor->Graphics()->WrapClamp();
|
||||
pEditor->Graphics()->QuadsBegin();
|
||||
|
@ -1332,10 +1332,10 @@ int CEditor::PopupSelectSound(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
View.Margin(10.0f, &SoundView);
|
||||
|
||||
static float s_ScrollValue = 0;
|
||||
float SoundsHeight = pEditor->m_Map.m_lSounds.size() * 14;
|
||||
float SoundsHeight = pEditor->m_Map.m_vpSounds.size() * 14;
|
||||
float ScrollDifference = SoundsHeight - ButtonBar.h;
|
||||
|
||||
if(pEditor->m_Map.m_lSounds.size() > 20) // Do we need a scrollbar?
|
||||
if(pEditor->m_Map.m_vpSounds.size() > 20) // Do we need a scrollbar?
|
||||
{
|
||||
CUIRect Scroll;
|
||||
ButtonBar.VSplitRight(20.0f, &ButtonBar, &Scroll);
|
||||
|
@ -1360,7 +1360,7 @@ int CEditor::PopupSelectSound(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
float SoundStopAt = SoundsHeight - ScrollDifference * (1 - s_ScrollValue);
|
||||
float SoundCur = 0.0f;
|
||||
for(int i = -1; i < (int)pEditor->m_Map.m_lSounds.size(); i++)
|
||||
for(int i = -1; i < (int)pEditor->m_Map.m_vpSounds.size(); i++)
|
||||
{
|
||||
if(SoundCur > SoundStopAt)
|
||||
break;
|
||||
|
@ -1379,12 +1379,12 @@ int CEditor::PopupSelectSound(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
if(i == -1)
|
||||
{
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_lSounds[i], "None", i == g_SelectSoundCurrent, &Button))
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_vpSounds[i], "None", i == g_SelectSoundCurrent, &Button))
|
||||
g_SelectSoundSelected = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_lSounds[i], pEditor->m_Map.m_lSounds[i]->m_aName, i == g_SelectSoundCurrent, &Button))
|
||||
if(pEditor->DoButton_MenuItem(&pEditor->m_Map.m_vpSounds[i], pEditor->m_Map.m_vpSounds[i]->m_aName, i == g_SelectSoundCurrent, &Button))
|
||||
g_SelectSoundSelected = i;
|
||||
}
|
||||
}
|
||||
|
@ -1468,7 +1468,7 @@ int CEditor::PopupSelectConfigAutoMap(CEditor *pEditor, CUIRect View, void *pCon
|
|||
CLayerTiles *pLayer = static_cast<CLayerTiles *>(pEditor->GetSelectedLayer(0));
|
||||
CUIRect Button;
|
||||
static int s_AutoMapperConfigButtons[256];
|
||||
CAutoMapper *pAutoMapper = &pEditor->m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper;
|
||||
CAutoMapper *pAutoMapper = &pEditor->m_Map.m_vpImages[pLayer->m_Image]->m_AutoMapper;
|
||||
|
||||
const float ButtonHeight = 12.0f;
|
||||
const float ButtonMargin = 2.0f;
|
||||
|
@ -1540,7 +1540,7 @@ void CEditor::PopupSelectConfigAutoMapInvoke(int Current, float x, float y)
|
|||
s_AutoMapConfigSelected = -100;
|
||||
s_AutoMapConfigCurrent = Current;
|
||||
CLayerTiles *pLayer = static_cast<CLayerTiles *>(GetSelectedLayer(0));
|
||||
int ItemCount = m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper.ConfigNamesNum();
|
||||
int ItemCount = m_Map.m_vpImages[pLayer->m_Image]->m_AutoMapper.ConfigNamesNum();
|
||||
if(ItemCount > 10)
|
||||
ItemCount = 10;
|
||||
// Width for buttons is 120, 15 is the scrollbar width, 2 is the margin between both.
|
||||
|
@ -1864,18 +1864,18 @@ int CEditor::PopupColorPicker(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
int CEditor::PopupEntities(CEditor *pEditor, CUIRect View, void *pContext)
|
||||
{
|
||||
for(int i = 0; i < (int)pEditor->m_SelectEntitiesFiles.size(); i++)
|
||||
for(int i = 0; i < (int)pEditor->m_vSelectEntitiesFiles.size(); i++)
|
||||
{
|
||||
CUIRect Button;
|
||||
View.HSplitTop(14.0f, &Button, &View);
|
||||
|
||||
const char *Name = pEditor->m_SelectEntitiesFiles[i].c_str();
|
||||
const char *Name = pEditor->m_vSelectEntitiesFiles[i].c_str();
|
||||
|
||||
if(pEditor->DoButton_MenuItem(Name, Name, pEditor->m_SelectEntitiesFiles[i] == pEditor->m_SelectEntitiesImage, &Button))
|
||||
if(pEditor->DoButton_MenuItem(Name, Name, pEditor->m_vSelectEntitiesFiles[i] == pEditor->m_SelectEntitiesImage, &Button))
|
||||
{
|
||||
if(pEditor->m_SelectEntitiesFiles[i] != pEditor->m_SelectEntitiesImage)
|
||||
if(pEditor->m_vSelectEntitiesFiles[i] != pEditor->m_SelectEntitiesImage)
|
||||
{
|
||||
pEditor->m_SelectEntitiesImage = pEditor->m_SelectEntitiesFiles[i];
|
||||
pEditor->m_SelectEntitiesImage = pEditor->m_vSelectEntitiesFiles[i];
|
||||
pEditor->m_AllowPlaceUnusedTiles = pEditor->m_SelectEntitiesImage == "DDNet" ? 0 : -1;
|
||||
pEditor->m_PreventUnusedTilesWasWarned = false;
|
||||
|
||||
|
|
|
@ -652,20 +652,20 @@ void CCharacterCore::SetTeleOuts(std::map<int, std::vector<vec2>> *pTeleOuts)
|
|||
bool CCharacterCore::IsSwitchActiveCb(int Number, void *pUser)
|
||||
{
|
||||
CCharacterCore *pThis = (CCharacterCore *)pUser;
|
||||
if(pThis->m_pWorld && !pThis->m_pWorld->m_aSwitchers.empty())
|
||||
if(pThis->m_pWorld && !pThis->m_pWorld->m_vSwitchers.empty())
|
||||
if(pThis->m_Id != -1 && pThis->m_pTeams->Team(pThis->m_Id) != (pThis->m_pTeams->m_IsDDRace16 ? VANILLA_TEAM_SUPER : TEAM_SUPER))
|
||||
return pThis->m_pWorld->m_aSwitchers[Number].m_Status[pThis->m_pTeams->Team(pThis->m_Id)];
|
||||
return pThis->m_pWorld->m_vSwitchers[Number].m_Status[pThis->m_pTeams->Team(pThis->m_Id)];
|
||||
return false;
|
||||
}
|
||||
|
||||
void CWorldCore::InitSwitchers(int HighestSwitchNumber)
|
||||
{
|
||||
if(HighestSwitchNumber > 0)
|
||||
m_aSwitchers.resize(HighestSwitchNumber + 1);
|
||||
m_vSwitchers.resize(HighestSwitchNumber + 1);
|
||||
else
|
||||
m_aSwitchers.clear();
|
||||
m_vSwitchers.clear();
|
||||
|
||||
for(auto &Switcher : m_aSwitchers)
|
||||
for(auto &Switcher : m_vSwitchers)
|
||||
{
|
||||
Switcher.m_Initial = true;
|
||||
for(int j = 0; j < MAX_CLIENTS; j++)
|
||||
|
|
|
@ -209,7 +209,7 @@ public:
|
|||
CPrng *m_pPrng;
|
||||
|
||||
void InitSwitchers(int HighestSwitchNumber);
|
||||
std::vector<SSwitchers> m_aSwitchers;
|
||||
std::vector<SSwitchers> m_vSwitchers;
|
||||
};
|
||||
|
||||
class CCharacterCore
|
||||
|
|
|
@ -37,7 +37,7 @@ CLocalizationDatabase::CLocalizationDatabase()
|
|||
|
||||
void CLocalizationDatabase::AddString(const char *pOrgStr, const char *pNewStr, const char *pContext)
|
||||
{
|
||||
m_Strings.emplace_back(str_quickhash(pOrgStr), str_quickhash(pContext), m_StringsHeap.StoreString(*pNewStr ? pNewStr : pOrgStr));
|
||||
m_vStrings.emplace_back(str_quickhash(pOrgStr), str_quickhash(pContext), m_StringsHeap.StoreString(*pNewStr ? pNewStr : pOrgStr));
|
||||
}
|
||||
|
||||
bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, IConsole *pConsole)
|
||||
|
@ -45,7 +45,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon
|
|||
// empty string means unload
|
||||
if(pFilename[0] == 0)
|
||||
{
|
||||
m_Strings.clear();
|
||||
m_vStrings.clear();
|
||||
m_StringsHeap.Reset();
|
||||
m_CurrentVersion = 0;
|
||||
return true;
|
||||
|
@ -58,7 +58,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon
|
|||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "loaded '%s'", pFilename);
|
||||
pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "localization", aBuf);
|
||||
m_Strings.clear();
|
||||
m_vStrings.clear();
|
||||
m_StringsHeap.Reset();
|
||||
|
||||
char aContext[512];
|
||||
|
@ -113,7 +113,7 @@ bool CLocalizationDatabase::Load(const char *pFilename, IStorage *pStorage, ICon
|
|||
AddString(aOrigin, pReplacement, aContext);
|
||||
}
|
||||
io_close(IoHandle);
|
||||
std::sort(m_Strings.begin(), m_Strings.end());
|
||||
std::sort(m_vStrings.begin(), m_vStrings.end());
|
||||
|
||||
m_CurrentVersion = ++m_VersionCounter;
|
||||
return true;
|
||||
|
@ -125,7 +125,7 @@ const char *CLocalizationDatabase::FindString(unsigned Hash, unsigned ContextHas
|
|||
String.m_Hash = Hash;
|
||||
String.m_ContextHash = ContextHash;
|
||||
String.m_pReplacement = 0x0;
|
||||
auto Range1 = std::equal_range(m_Strings.begin(), m_Strings.end(), String);
|
||||
auto Range1 = std::equal_range(m_vStrings.begin(), m_vStrings.end(), String);
|
||||
if(std::distance(Range1.first, Range1.second) == 1)
|
||||
return Range1.first->m_pReplacement;
|
||||
|
||||
|
@ -134,7 +134,7 @@ const char *CLocalizationDatabase::FindString(unsigned Hash, unsigned ContextHas
|
|||
{
|
||||
// Do another lookup with the default context hash
|
||||
String.m_ContextHash = DefaultHash;
|
||||
auto Range2 = std::equal_range(m_Strings.begin(), m_Strings.end(), String);
|
||||
auto Range2 = std::equal_range(m_vStrings.begin(), m_vStrings.end(), String);
|
||||
if(std::distance(Range2.first, Range2.second) == 1)
|
||||
return Range2.first->m_pReplacement;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class CLocalizationDatabase
|
|||
bool operator==(const CString &Other) const { return m_Hash == Other.m_Hash && m_ContextHash == Other.m_ContextHash; }
|
||||
};
|
||||
|
||||
std::vector<CString> m_Strings;
|
||||
std::vector<CString> m_vStrings;
|
||||
CHeap m_StringsHeap;
|
||||
int m_VersionCounter;
|
||||
int m_CurrentVersion;
|
||||
|
|
|
@ -58,7 +58,7 @@ public: // TODO: Maybe make protected
|
|||
virtual ~CEntity();
|
||||
|
||||
/* Objects */
|
||||
std::vector<SSwitchers> &Switchers() { return m_pGameWorld->m_Core.m_aSwitchers; }
|
||||
std::vector<SSwitchers> &Switchers() { return m_pGameWorld->m_Core.m_vSwitchers; }
|
||||
class CGameWorld *GameWorld() { return m_pGameWorld; }
|
||||
class CConfig *Config() { return m_pGameWorld->Config(); }
|
||||
class CGameContext *GameServer() { return m_pGameWorld->GameServer(); }
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
// helper functions
|
||||
class CCharacter *GetPlayerChar(int ClientID);
|
||||
bool EmulateBug(int Bug);
|
||||
std::vector<SSwitchers> &Switchers() { return m_World.m_Core.m_aSwitchers; }
|
||||
std::vector<SSwitchers> &Switchers() { return m_World.m_Core.m_vSwitchers; }
|
||||
|
||||
// voting
|
||||
void StartVote(const char *pDesc, const char *pCommand, const char *pReason, const char *pSixupDesc);
|
||||
|
|
|
@ -63,8 +63,8 @@ void CScore::GeneratePassphrase(char *pBuf, int BufSize)
|
|||
if(i != 0)
|
||||
str_append(pBuf, " ", BufSize);
|
||||
// TODO: decide if the slight bias towards lower numbers is ok
|
||||
int Rand = m_Prng.RandomBits() % m_aWordlist.size();
|
||||
str_append(pBuf, m_aWordlist[Rand].c_str(), BufSize);
|
||||
int Rand = m_Prng.RandomBits() % m_vWordlist.size();
|
||||
str_append(pBuf, m_vWordlist[Rand].c_str(), BufSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,17 +93,17 @@ CScore::CScore(CGameContext *pGameServer, CDbConnectionPool *pPool) :
|
|||
char aWord[32] = {0};
|
||||
sscanf(pLine, "%*s %31s", aWord);
|
||||
aWord[31] = 0;
|
||||
m_aWordlist.emplace_back(aWord);
|
||||
m_vWordlist.emplace_back(aWord);
|
||||
}
|
||||
io_close(File);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbg_msg("sql", "failed to open wordlist, using fallback");
|
||||
m_aWordlist.assign(std::begin(g_aFallbackWordlist), std::end(g_aFallbackWordlist));
|
||||
m_vWordlist.assign(std::begin(g_aFallbackWordlist), std::end(g_aFallbackWordlist));
|
||||
}
|
||||
|
||||
if(m_aWordlist.size() < 1000)
|
||||
if(m_vWordlist.size() < 1000)
|
||||
{
|
||||
dbg_msg("sql", "too few words in wordlist");
|
||||
Server()->SetErrorShutdown("sql too few words in wordlist");
|
||||
|
|
|
@ -19,7 +19,7 @@ class CScore
|
|||
CGameContext *m_pGameServer;
|
||||
IServer *m_pServer;
|
||||
|
||||
std::vector<std::string> m_aWordlist;
|
||||
std::vector<std::string> m_vWordlist;
|
||||
CPrng m_Prng;
|
||||
void GeneratePassphrase(char *pBuf, int BufSize);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class CTestCollectData
|
|||
{
|
||||
public:
|
||||
char m_aCurrentDir[IO_MAX_PATH_LENGTH];
|
||||
std::vector<CTestInfoPath> *m_paEntries;
|
||||
std::vector<CTestInfoPath> *m_pvEntries;
|
||||
};
|
||||
|
||||
int TestCollect(const char *pName, int IsDir, int Unused, void *pUser)
|
||||
|
@ -62,12 +62,12 @@ int TestCollect(const char *pName, int IsDir, int Unused, void *pUser)
|
|||
CTestInfoPath Path;
|
||||
Path.m_IsDirectory = IsDir;
|
||||
str_format(Path.m_aData, sizeof(Path.m_aData), "%s/%s", pData->m_aCurrentDir, pName);
|
||||
pData->m_paEntries->push_back(Path);
|
||||
pData->m_pvEntries->push_back(Path);
|
||||
if(Path.m_IsDirectory)
|
||||
{
|
||||
CTestCollectData DataRecursive;
|
||||
str_copy(DataRecursive.m_aCurrentDir, Path.m_aData, sizeof(DataRecursive.m_aCurrentDir));
|
||||
DataRecursive.m_paEntries = pData->m_paEntries;
|
||||
DataRecursive.m_pvEntries = pData->m_pvEntries;
|
||||
fs_listdir(DataRecursive.m_aCurrentDir, TestCollect, 0, &DataRecursive);
|
||||
}
|
||||
return 0;
|
||||
|
@ -78,7 +78,7 @@ void TestDeleteTestStorageFiles(const char *pPath)
|
|||
std::vector<CTestInfoPath> aEntries;
|
||||
CTestCollectData Data;
|
||||
str_copy(Data.m_aCurrentDir, pPath, sizeof(Data.m_aCurrentDir));
|
||||
Data.m_paEntries = &aEntries;
|
||||
Data.m_pvEntries = &aEntries;
|
||||
fs_listdir(Data.m_aCurrentDir, TestCollect, 0, &Data);
|
||||
|
||||
CTestInfoPath Path;
|
||||
|
|
Loading…
Reference in a new issue