mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5545
5545: Format name accordingly r=heinrich5991 a=Chairn I think i got almost all the misstyped name. I did let some because they made sense to me. I think, only generated code remains to be formatted (and src/base and websockets, but those seems to have an exception). ## 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 - [x] 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
5345e55b94
|
@ -447,9 +447,9 @@ Messages = [
|
|||
], teehistorian=False),
|
||||
|
||||
NetMessage("Cl_CallVote", [
|
||||
NetStringStrict("m_Type"),
|
||||
NetStringStrict("m_Value"),
|
||||
NetStringStrict("m_Reason"),
|
||||
NetStringStrict("m_pType"),
|
||||
NetStringStrict("m_pValue"),
|
||||
NetStringStrict("m_pReason"),
|
||||
], teehistorian=False),
|
||||
|
||||
NetMessage("Cl_IsDDNetLegacy", []),
|
||||
|
|
|
@ -424,9 +424,9 @@ Messages = [
|
|||
]),
|
||||
|
||||
NetMessage("Cl_CallVote", [
|
||||
NetStringStrict("m_Type"),
|
||||
NetStringStrict("m_Value"),
|
||||
NetStringStrict("m_Reason"),
|
||||
NetStringStrict("m_pType"),
|
||||
NetStringStrict("m_pValue"),
|
||||
NetStringStrict("m_pReason"),
|
||||
NetBool("m_Force"),
|
||||
]),
|
||||
|
||||
|
@ -458,18 +458,18 @@ Messages = [
|
|||
]),
|
||||
|
||||
NetMessage("Sv_CommandInfo", [
|
||||
NetStringStrict("m_Name"),
|
||||
NetStringStrict("m_ArgsFormat"),
|
||||
NetStringStrict("m_HelpText")
|
||||
NetStringStrict("m_pName"),
|
||||
NetStringStrict("m_pArgsFormat"),
|
||||
NetStringStrict("m_pHelpText")
|
||||
]),
|
||||
|
||||
NetMessage("Sv_CommandInfoRemove", [
|
||||
NetStringStrict("m_Name")
|
||||
NetStringStrict("m_pName")
|
||||
]),
|
||||
|
||||
NetMessage("Cl_Command", [
|
||||
NetStringStrict("m_Name"),
|
||||
NetStringStrict("m_Arguments")
|
||||
NetStringStrict("m_pName"),
|
||||
NetStringStrict("m_pArguments")
|
||||
]),
|
||||
|
||||
]
|
||||
|
|
|
@ -74,14 +74,14 @@ protected:
|
|||
int64_t m_StateStartTime;
|
||||
|
||||
// quick access to time variables
|
||||
int m_PrevGameTick[NUM_DUMMIES];
|
||||
int m_CurGameTick[NUM_DUMMIES];
|
||||
float m_GameIntraTick[NUM_DUMMIES];
|
||||
float m_GameTickTime[NUM_DUMMIES];
|
||||
float m_GameIntraTickSincePrev[NUM_DUMMIES];
|
||||
int m_aPrevGameTick[NUM_DUMMIES];
|
||||
int m_aCurGameTick[NUM_DUMMIES];
|
||||
float m_aGameIntraTick[NUM_DUMMIES];
|
||||
float m_aGameTickTime[NUM_DUMMIES];
|
||||
float m_aGameIntraTickSincePrev[NUM_DUMMIES];
|
||||
|
||||
int m_PredTick[NUM_DUMMIES];
|
||||
float m_PredIntraTick[NUM_DUMMIES];
|
||||
int m_aPredTick[NUM_DUMMIES];
|
||||
float m_aPredIntraTick[NUM_DUMMIES];
|
||||
|
||||
float m_LocalTime;
|
||||
float m_RenderFrameTime;
|
||||
|
@ -134,13 +134,13 @@ public:
|
|||
void SetMapLoadingCBFunc(TMapLoadingCallbackFunc &&Func) { m_MapLoadingCBFunc = std::move(Func); }
|
||||
|
||||
// tick time access
|
||||
inline int PrevGameTick(int Conn) const { return m_PrevGameTick[Conn]; }
|
||||
inline int GameTick(int Conn) const { return m_CurGameTick[Conn]; }
|
||||
inline int PredGameTick(int Conn) const { return m_PredTick[Conn]; }
|
||||
inline float IntraGameTick(int Conn) const { return m_GameIntraTick[Conn]; }
|
||||
inline float PredIntraGameTick(int Conn) const { return m_PredIntraTick[Conn]; }
|
||||
inline float IntraGameTickSincePrev(int Conn) const { return m_GameIntraTickSincePrev[Conn]; }
|
||||
inline float GameTickTime(int Conn) const { return m_GameTickTime[Conn]; }
|
||||
inline int PrevGameTick(int Conn) const { return m_aPrevGameTick[Conn]; }
|
||||
inline int GameTick(int Conn) const { return m_aCurGameTick[Conn]; }
|
||||
inline int PredGameTick(int Conn) const { return m_aPredTick[Conn]; }
|
||||
inline float IntraGameTick(int Conn) const { return m_aGameIntraTick[Conn]; }
|
||||
inline float PredIntraGameTick(int Conn) const { return m_aPredIntraTick[Conn]; }
|
||||
inline float IntraGameTickSincePrev(int Conn) const { return m_aGameIntraTickSincePrev[Conn]; }
|
||||
inline float GameTickTime(int Conn) const { return m_aGameTickTime[Conn]; }
|
||||
inline int GameTickSpeed() const { return m_GameTickSpeed; }
|
||||
|
||||
// other time access
|
||||
|
|
|
@ -273,15 +273,15 @@ static const char *GetGLSeverity(GLenum Type)
|
|||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
GfxOpenGLMessageCallback(GLenum source,
|
||||
GLenum type,
|
||||
GLuint id,
|
||||
GLenum severity,
|
||||
GLsizei length,
|
||||
const GLchar *message,
|
||||
const void *userParam)
|
||||
GfxOpenGLMessageCallback(GLenum Source,
|
||||
GLenum Type,
|
||||
GLuint Id,
|
||||
GLenum Severity,
|
||||
GLsizei Length,
|
||||
const GLchar *pMsg,
|
||||
const void *pUserParam)
|
||||
{
|
||||
dbg_msg("gfx", "[%s] (importance: %s) %s", GetGLErrorName(type), GetGLSeverity(severity), message);
|
||||
dbg_msg("gfx", "[%s] (importance: %s) %s", GetGLErrorName(Type), GetGLSeverity(Severity), pMsg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1925,12 +1925,12 @@ void CCommandProcessorFragment_OpenGL2::Cmd_CopyBufferObject(const CCommandBuffe
|
|||
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);
|
||||
mem_copy(((uint8_t *)WriteBufferObject.m_pData) + (ptrdiff_t)pCommand->m_WriteOffset, ((uint8_t *)ReadBufferObject.m_pData) + (ptrdiff_t)pCommand->m_ReadOffset, pCommand->m_CopySize);
|
||||
|
||||
if(m_HasShaders)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, WriteBufferObject.m_BufferObjectID);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, (GLintptr)(pCommand->m_pWriteOffset), (GLsizeiptr)(pCommand->m_CopySize), ((uint8_t *)WriteBufferObject.m_pData) + (ptrdiff_t)pCommand->m_pWriteOffset);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, (GLintptr)(pCommand->m_WriteOffset), (GLsizeiptr)(pCommand->m_CopySize), ((uint8_t *)WriteBufferObject.m_pData) + (ptrdiff_t)pCommand->m_WriteOffset);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ void CCommandProcessorFragment_OpenGL3_3::InitPrimExProgram(CGLSLPrimitiveExProg
|
|||
pProgram->m_LocVertciesColor = pProgram->GetUniformLoc("gVerticesColor");
|
||||
|
||||
pProgram->SetUniform(pProgram->m_LocRotation, 0.0f);
|
||||
float Center[2] = {0.f, 0.f};
|
||||
pProgram->SetUniformVec2(pProgram->m_LocCenter, 1, Center);
|
||||
float aCenter[2] = {0.f, 0.f};
|
||||
pProgram->SetUniformVec2(pProgram->m_LocCenter, 1, aCenter);
|
||||
}
|
||||
|
||||
bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand)
|
||||
|
@ -123,7 +123,7 @@ bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
|
|||
GLint CapVal;
|
||||
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, &CapVal);
|
||||
|
||||
m_MaxQuadsAtOnce = minimum<int>(((CapVal - 20) / (3 * 4)), m_MaxQuadsPossible);
|
||||
m_MaxQuadsAtOnce = minimum<int>(((CapVal - 20) / (3 * 4)), ms_MaxQuadsPossible);
|
||||
|
||||
{
|
||||
CGLSL PrimitiveVertexShader;
|
||||
|
@ -408,21 +408,21 @@ bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
|
|||
m_pSpriteProgramMultiple->m_LocCenter = m_pSpriteProgramMultiple->GetUniformLoc("gCenter");
|
||||
m_pSpriteProgramMultiple->m_LocVertciesColor = m_pSpriteProgramMultiple->GetUniformLoc("gVerticesColor");
|
||||
|
||||
float Center[2] = {0.f, 0.f};
|
||||
m_pSpriteProgramMultiple->SetUniformVec2(m_pSpriteProgramMultiple->m_LocCenter, 1, Center);
|
||||
float aCenter[2] = {0.f, 0.f};
|
||||
m_pSpriteProgramMultiple->SetUniformVec2(m_pSpriteProgramMultiple->m_LocCenter, 1, aCenter);
|
||||
}
|
||||
|
||||
m_LastStreamBuffer = 0;
|
||||
|
||||
glGenBuffers(MAX_STREAM_BUFFER_COUNT, m_PrimitiveDrawBufferID);
|
||||
glGenVertexArrays(MAX_STREAM_BUFFER_COUNT, m_PrimitiveDrawVertexID);
|
||||
glGenBuffers(MAX_STREAM_BUFFER_COUNT, m_aPrimitiveDrawBufferID);
|
||||
glGenVertexArrays(MAX_STREAM_BUFFER_COUNT, m_aPrimitiveDrawVertexID);
|
||||
glGenBuffers(1, &m_PrimitiveDrawBufferIDTex3D);
|
||||
glGenVertexArrays(1, &m_PrimitiveDrawVertexIDTex3D);
|
||||
|
||||
for(int i = 0; i < MAX_STREAM_BUFFER_COUNT; ++i)
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_PrimitiveDrawBufferID[i]);
|
||||
glBindVertexArray(m_PrimitiveDrawVertexID[i]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_aPrimitiveDrawBufferID[i]);
|
||||
glBindVertexArray(m_aPrimitiveDrawVertexID[i]);
|
||||
glEnableVertexAttribArray(0);
|
||||
glEnableVertexAttribArray(1);
|
||||
glEnableVertexAttribArray(2);
|
||||
|
@ -431,7 +431,7 @@ bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
|
|||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(CCommandBuffer::SVertex), (void *)(sizeof(float) * 2));
|
||||
glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(CCommandBuffer::SVertex), (void *)(sizeof(float) * 4));
|
||||
|
||||
m_LastIndexBufferBound[i] = 0;
|
||||
m_aLastIndexBufferBound[i] = 0;
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_PrimitiveDrawBufferIDTex3D);
|
||||
|
@ -451,19 +451,19 @@ bool CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
|
|||
glGenBuffers(1, &m_QuadDrawIndexBufferID);
|
||||
glBindBuffer(BUFFER_INIT_INDEX_TARGET, m_QuadDrawIndexBufferID);
|
||||
|
||||
unsigned int Indices[CCommandBuffer::MAX_VERTICES / 4 * 6];
|
||||
unsigned int aIndices[CCommandBuffer::MAX_VERTICES / 4 * 6];
|
||||
int Primq = 0;
|
||||
for(int i = 0; i < CCommandBuffer::MAX_VERTICES / 4 * 6; i += 6)
|
||||
{
|
||||
Indices[i] = Primq;
|
||||
Indices[i + 1] = Primq + 1;
|
||||
Indices[i + 2] = Primq + 2;
|
||||
Indices[i + 3] = Primq;
|
||||
Indices[i + 4] = Primq + 2;
|
||||
Indices[i + 5] = Primq + 3;
|
||||
aIndices[i] = Primq;
|
||||
aIndices[i + 1] = Primq + 1;
|
||||
aIndices[i + 2] = Primq + 2;
|
||||
aIndices[i + 3] = Primq;
|
||||
aIndices[i + 4] = Primq + 2;
|
||||
aIndices[i + 5] = Primq + 3;
|
||||
Primq += 4;
|
||||
}
|
||||
glBufferData(BUFFER_INIT_INDEX_TARGET, sizeof(unsigned int) * CCommandBuffer::MAX_VERTICES / 4 * 6, Indices, GL_STATIC_DRAW);
|
||||
glBufferData(BUFFER_INIT_INDEX_TARGET, sizeof(unsigned int) * CCommandBuffer::MAX_VERTICES / 4 * 6, aIndices, GL_STATIC_DRAW);
|
||||
|
||||
m_CurrentIndicesInBuffer = CCommandBuffer::MAX_VERTICES / 4 * 6;
|
||||
|
||||
|
@ -521,9 +521,9 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Shutdown(const SCommand_Shutdown *
|
|||
delete m_pSpriteProgramMultiple;
|
||||
|
||||
glBindVertexArray(0);
|
||||
glDeleteBuffers(MAX_STREAM_BUFFER_COUNT, m_PrimitiveDrawBufferID);
|
||||
glDeleteBuffers(MAX_STREAM_BUFFER_COUNT, m_aPrimitiveDrawBufferID);
|
||||
glDeleteBuffers(1, &m_QuadDrawIndexBufferID);
|
||||
glDeleteVertexArrays(MAX_STREAM_BUFFER_COUNT, m_PrimitiveDrawVertexID);
|
||||
glDeleteVertexArrays(MAX_STREAM_BUFFER_COUNT, m_aPrimitiveDrawVertexID);
|
||||
glDeleteBuffers(1, &m_PrimitiveDrawBufferIDTex3D);
|
||||
glDeleteVertexArrays(1, &m_PrimitiveDrawVertexIDTex3D);
|
||||
|
||||
|
@ -790,7 +790,7 @@ void CCommandProcessorFragment_OpenGL3_3::UploadStreamBufferData(unsigned int Pr
|
|||
if(AsTex3D)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_PrimitiveDrawBufferIDTex3D);
|
||||
else
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_PrimitiveDrawBufferID[m_LastStreamBuffer]);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_aPrimitiveDrawBufferID[m_LastStreamBuffer]);
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, VertSize * Count, pVertices, GL_STREAM_DRAW);
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Render(const CCommandBuffer::SComm
|
|||
|
||||
UploadStreamBufferData(pCommand->m_PrimType, pCommand->m_pVertices, sizeof(CCommandBuffer::SVertex), pCommand->m_PrimCount);
|
||||
|
||||
glBindVertexArray(m_PrimitiveDrawVertexID[m_LastStreamBuffer]);
|
||||
glBindVertexArray(m_aPrimitiveDrawVertexID[m_LastStreamBuffer]);
|
||||
|
||||
switch(pCommand->m_PrimType)
|
||||
{
|
||||
|
@ -817,10 +817,10 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Render(const CCommandBuffer::SComm
|
|||
glDrawArrays(GL_TRIANGLES, 0, pCommand->m_PrimCount * 3);
|
||||
break;
|
||||
case CCommandBuffer::PRIMTYPE_QUADS:
|
||||
if(m_LastIndexBufferBound[m_LastStreamBuffer] != m_QuadDrawIndexBufferID)
|
||||
if(m_aLastIndexBufferBound[m_LastStreamBuffer] != m_QuadDrawIndexBufferID)
|
||||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_QuadDrawIndexBufferID);
|
||||
m_LastIndexBufferBound[m_LastStreamBuffer] = m_QuadDrawIndexBufferID;
|
||||
m_aLastIndexBufferBound[m_LastStreamBuffer] = m_QuadDrawIndexBufferID;
|
||||
}
|
||||
glDrawElements(GL_TRIANGLES, pCommand->m_PrimCount * 6, GL_UNSIGNED_INT, 0);
|
||||
break;
|
||||
|
@ -883,16 +883,16 @@ void CCommandProcessorFragment_OpenGL3_3::AppendIndices(unsigned int NewIndicesC
|
|||
if(NewIndicesCount <= m_CurrentIndicesInBuffer)
|
||||
return;
|
||||
unsigned int AddCount = NewIndicesCount - m_CurrentIndicesInBuffer;
|
||||
unsigned int *Indices = new unsigned int[AddCount];
|
||||
unsigned int *pIndices = new unsigned int[AddCount];
|
||||
int Primq = (m_CurrentIndicesInBuffer / 6) * 4;
|
||||
for(unsigned int i = 0; i < AddCount; i += 6)
|
||||
{
|
||||
Indices[i] = Primq;
|
||||
Indices[i + 1] = Primq + 1;
|
||||
Indices[i + 2] = Primq + 2;
|
||||
Indices[i + 3] = Primq;
|
||||
Indices[i + 4] = Primq + 2;
|
||||
Indices[i + 5] = Primq + 3;
|
||||
pIndices[i] = Primq;
|
||||
pIndices[i + 1] = Primq + 1;
|
||||
pIndices[i + 2] = Primq + 2;
|
||||
pIndices[i + 3] = Primq;
|
||||
pIndices[i + 4] = Primq + 2;
|
||||
pIndices[i + 5] = Primq + 3;
|
||||
Primq += 4;
|
||||
}
|
||||
|
||||
|
@ -903,14 +903,14 @@ void CCommandProcessorFragment_OpenGL3_3::AppendIndices(unsigned int NewIndicesC
|
|||
GLsizeiptr size = sizeof(unsigned int);
|
||||
glBufferData(BUFFER_INIT_INDEX_TARGET, (GLsizeiptr)NewIndicesCount * size, NULL, GL_STATIC_DRAW);
|
||||
glCopyBufferSubData(GL_COPY_READ_BUFFER, BUFFER_INIT_INDEX_TARGET, 0, 0, (GLsizeiptr)m_CurrentIndicesInBuffer * size);
|
||||
glBufferSubData(BUFFER_INIT_INDEX_TARGET, (GLsizeiptr)m_CurrentIndicesInBuffer * size, (GLsizeiptr)AddCount * size, Indices);
|
||||
glBufferSubData(BUFFER_INIT_INDEX_TARGET, (GLsizeiptr)m_CurrentIndicesInBuffer * size, (GLsizeiptr)AddCount * size, pIndices);
|
||||
glBindBuffer(BUFFER_INIT_INDEX_TARGET, 0);
|
||||
glBindBuffer(GL_COPY_READ_BUFFER, 0);
|
||||
|
||||
glDeleteBuffers(1, &m_QuadDrawIndexBufferID);
|
||||
m_QuadDrawIndexBufferID = NewIndexBufferID;
|
||||
|
||||
for(unsigned int &i : m_LastIndexBufferBound)
|
||||
for(unsigned int &i : m_aLastIndexBufferBound)
|
||||
i = 0;
|
||||
for(auto &BufferContainer : m_vBufferContainers)
|
||||
{
|
||||
|
@ -918,7 +918,7 @@ void CCommandProcessorFragment_OpenGL3_3::AppendIndices(unsigned int NewIndicesC
|
|||
}
|
||||
|
||||
m_CurrentIndicesInBuffer = NewIndicesCount;
|
||||
delete[] Indices;
|
||||
delete[] pIndices;
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_CreateBufferObject(const CCommandBuffer::SCommand_CreateBufferObject *pCommand)
|
||||
|
@ -977,7 +977,7 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_CopyBufferObject(const CCommandBuf
|
|||
|
||||
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);
|
||||
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, (GLsizeiptr)(pCommand->m_ReadOffset), (GLsizeiptr)(pCommand->m_WriteOffset), (GLsizeiptr)pCommand->m_CopySize);
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_DeleteBufferObject(const CCommandBuffer::SCommand_DeleteBufferObject *pCommand)
|
||||
|
@ -1220,9 +1220,9 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_RenderQuadLayer(const CCommandBuff
|
|||
// the extra offset is not related to the information from the command, but an actual offset in the buffer
|
||||
size_t QuadOffsetExtra = pCommand->m_QuadOffset;
|
||||
|
||||
vec4 aColors[m_MaxQuadsPossible];
|
||||
vec2 aOffsets[m_MaxQuadsPossible];
|
||||
float aRotations[m_MaxQuadsPossible];
|
||||
vec4 aColors[ms_MaxQuadsPossible];
|
||||
vec2 aOffsets[ms_MaxQuadsPossible];
|
||||
float aRotations[ms_MaxQuadsPossible];
|
||||
|
||||
while(QuadsLeft > 0)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ class CCommandProcessorFragment_OpenGL3_3 : public CCommandProcessorFragment_Ope
|
|||
{
|
||||
protected:
|
||||
int m_MaxQuadsAtOnce;
|
||||
static const int m_MaxQuadsPossible = 256;
|
||||
static const int ms_MaxQuadsPossible = 256;
|
||||
|
||||
CGLSLPrimitiveProgram *m_pPrimitiveProgram;
|
||||
CGLSLPrimitiveProgram *m_pPrimitiveProgramTextured;
|
||||
|
@ -43,12 +43,12 @@ protected:
|
|||
|
||||
TWGLuint m_LastProgramID;
|
||||
|
||||
TWGLuint m_PrimitiveDrawVertexID[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_aPrimitiveDrawVertexID[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_PrimitiveDrawVertexIDTex3D;
|
||||
TWGLuint m_PrimitiveDrawBufferID[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_aPrimitiveDrawBufferID[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_PrimitiveDrawBufferIDTex3D;
|
||||
|
||||
TWGLuint m_LastIndexBufferBound[MAX_STREAM_BUFFER_COUNT];
|
||||
TWGLuint m_aLastIndexBufferBound[MAX_STREAM_BUFFER_COUNT];
|
||||
|
||||
int m_LastStreamBuffer;
|
||||
|
||||
|
|
|
@ -83,11 +83,11 @@ bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char
|
|||
|
||||
CLineReader LineReader;
|
||||
LineReader.Init(f);
|
||||
char *ReadLine = NULL;
|
||||
while((ReadLine = LineReader.Get()))
|
||||
char *pReadLine = NULL;
|
||||
while((pReadLine = LineReader.Get()))
|
||||
{
|
||||
std::string Line;
|
||||
pCompiler->ParseLine(Line, ReadLine, Type == GL_FRAGMENT_SHADER ? GLSL_SHADER_COMPILER_TYPE_FRAGMENT : GLSL_SHADER_COMPILER_TYPE_VERTEX);
|
||||
pCompiler->ParseLine(Line, pReadLine, Type == GL_FRAGMENT_SHADER ? GLSL_SHADER_COMPILER_TYPE_FRAGMENT : GLSL_SHADER_COMPILER_TYPE_VERTEX);
|
||||
Line.append("\r\n");
|
||||
vLines.push_back(Line);
|
||||
}
|
||||
|
@ -112,14 +112,14 @@ bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char
|
|||
|
||||
if(CompilationStatus == GL_FALSE)
|
||||
{
|
||||
char buff[3000];
|
||||
char aBuf[3000];
|
||||
|
||||
TWGLint maxLength = 0;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
|
||||
glGetShaderInfoLog(shader, maxLength, &maxLength, buff);
|
||||
glGetShaderInfoLog(shader, maxLength, &maxLength, aBuf);
|
||||
|
||||
dbg_msg("glsl", "%s: %s", pFile, buff);
|
||||
dbg_msg("glsl", "%s: %s", pFile, aBuf);
|
||||
glDeleteShader(shader);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -56,12 +56,12 @@ void CGLSLProgram::LinkProgram()
|
|||
m_IsLinked = LinkStatus == GL_TRUE;
|
||||
if(!m_IsLinked)
|
||||
{
|
||||
char sInfoLog[1024];
|
||||
char sFinalMessage[1536];
|
||||
char aInfoLog[1024];
|
||||
char aFinalMessage[1536];
|
||||
int iLogLength;
|
||||
glGetProgramInfoLog(m_ProgramID, 1024, &iLogLength, sInfoLog);
|
||||
str_format(sFinalMessage, 1536, "Error! Shader program wasn't linked! The linker returned:\n\n%s", sInfoLog);
|
||||
dbg_msg("glslprogram", "%s", sFinalMessage);
|
||||
glGetProgramInfoLog(m_ProgramID, 1024, &iLogLength, aInfoLog);
|
||||
str_format(aFinalMessage, sizeof(aFinalMessage), "Error! Shader program wasn't linked! The linker returned:\n\n%s", aInfoLog);
|
||||
dbg_msg("glslprogram", "%s", aFinalMessage);
|
||||
}
|
||||
|
||||
//detach all shaders attached to this program
|
||||
|
@ -119,9 +119,9 @@ void CGLSLProgram::SetUniform(int Loc, const bool Value)
|
|||
glUniform1i(Loc, (int)Value);
|
||||
}
|
||||
|
||||
int CGLSLProgram::GetUniformLoc(const char *Name)
|
||||
int CGLSLProgram::GetUniformLoc(const char *pName)
|
||||
{
|
||||
return glGetUniformLocation(m_ProgramID, Name);
|
||||
return glGetUniformLocation(m_ProgramID, pName);
|
||||
}
|
||||
|
||||
void CGLSLProgram::UseProgram()
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
void SetUniform(int Loc, int Count, const float *pValues);
|
||||
|
||||
//for performance reason we do not use SetUniform with using strings... save the Locations of the variables instead
|
||||
int GetUniformLoc(const char *Name);
|
||||
int GetUniformLoc(const char *pName);
|
||||
|
||||
CGLSLProgram();
|
||||
virtual ~CGLSLProgram();
|
||||
|
|
|
@ -3576,7 +3576,7 @@ public:
|
|||
STWGraphicGPU::ETWGraphicsGPUType GPUType = VKGPUTypeToGraphicsGPUType(DeviceProp.deviceType);
|
||||
|
||||
STWGraphicGPU::STWGraphicGPUItem NewGPU;
|
||||
str_copy(NewGPU.m_Name, DeviceProp.deviceName, minimum(sizeof(DeviceProp.deviceName), sizeof(NewGPU.m_Name)));
|
||||
str_copy(NewGPU.m_aName, DeviceProp.deviceName, minimum(sizeof(DeviceProp.deviceName), sizeof(NewGPU.m_aName)));
|
||||
NewGPU.m_GPUType = GPUType;
|
||||
m_pGPUList->m_vGPUs.push_back(NewGPU);
|
||||
|
||||
|
@ -3587,7 +3587,7 @@ public:
|
|||
|
||||
if(GPUType < AutoGPUType && (DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)))
|
||||
{
|
||||
str_copy(m_pGPUList->m_AutoGPU.m_Name, DeviceProp.deviceName, minimum(sizeof(DeviceProp.deviceName), sizeof(m_pGPUList->m_AutoGPU.m_Name)));
|
||||
str_copy(m_pGPUList->m_AutoGPU.m_aName, DeviceProp.deviceName, minimum(sizeof(DeviceProp.deviceName), sizeof(m_pGPUList->m_AutoGPU.m_aName)));
|
||||
m_pGPUList->m_AutoGPU.m_GPUType = GPUType;
|
||||
|
||||
AutoGPUType = GPUType;
|
||||
|
@ -6689,8 +6689,8 @@ public:
|
|||
VkBuffer WriteBuffer = WriteMemBlock.m_Buffer;
|
||||
|
||||
VkDeviceSize DataSize = (VkDeviceSize)pCommand->m_CopySize;
|
||||
VkDeviceSize ReadOffset = (VkDeviceSize)pCommand->m_pReadOffset + ReadMemBlock.m_HeapData.m_OffsetToAlign;
|
||||
VkDeviceSize WriteOffset = (VkDeviceSize)pCommand->m_pWriteOffset + WriteMemBlock.m_HeapData.m_OffsetToAlign;
|
||||
VkDeviceSize ReadOffset = (VkDeviceSize)pCommand->m_ReadOffset + ReadMemBlock.m_HeapData.m_OffsetToAlign;
|
||||
VkDeviceSize WriteOffset = (VkDeviceSize)pCommand->m_WriteOffset + WriteMemBlock.m_HeapData.m_OffsetToAlign;
|
||||
|
||||
MemoryBarrier(ReadBuffer, ReadOffset, DataSize, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, true);
|
||||
MemoryBarrier(WriteBuffer, WriteOffset, DataSize, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, true);
|
||||
|
|
|
@ -762,7 +762,7 @@ void CGraphicsBackend_SDL_GL::GetVideoModes(CVideoMode *pModes, int MaxModes, in
|
|||
dbg_msg("gfx", "unable to get display mode: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
static constexpr int ModeCount = 256;
|
||||
constexpr int ModeCount = 256;
|
||||
SDL_DisplayMode aModes[ModeCount];
|
||||
int NumModes = 0;
|
||||
for(int i = 0; i < maxModes && NumModes < ModeCount; i++)
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
|
||||
struct SVersion
|
||||
{
|
||||
int m_Parts[VERSION_PARTS];
|
||||
int m_aParts[VERSION_PARTS];
|
||||
|
||||
bool operator<=(const SVersion &Other) const
|
||||
{
|
||||
for(int i = 0; i < VERSION_PARTS; i++)
|
||||
{
|
||||
if(m_Parts[i] < Other.m_Parts[i])
|
||||
if(m_aParts[i] < Other.m_aParts[i])
|
||||
return true;
|
||||
if(m_Parts[i] > Other.m_Parts[i])
|
||||
if(m_aParts[i] > Other.m_aParts[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -68,7 +68,7 @@ const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVe
|
|||
char aVersionStrHelper[512]; // the size is random, but shouldn't be too small probably
|
||||
|
||||
SVersion Version;
|
||||
for(int &VersionPart : Version.m_Parts)
|
||||
for(int &VersionPart : Version.m_aParts)
|
||||
{
|
||||
pVersionStrStart = str_next_token(pVersionStrStart, ".", aVersionStrHelper, sizeof(aVersionStrHelper));
|
||||
if(pVersionStrStart == NULL)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -120,9 +120,9 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
IDiscord *m_pDiscord;
|
||||
ISteam *m_pSteam;
|
||||
|
||||
CNetClient m_NetClient[NUM_CONNS];
|
||||
CNetClient m_aNetClient[NUM_CONNS];
|
||||
CDemoPlayer m_DemoPlayer;
|
||||
CDemoRecorder m_DemoRecorder[RECORDER_MAX];
|
||||
CDemoRecorder m_aDemoRecorder[RECORDER_MAX];
|
||||
CDemoEditor m_DemoEditor;
|
||||
CGhostRecorder m_GhostRecorder;
|
||||
CGhostLoader m_GhostLoader;
|
||||
|
@ -138,7 +138,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
bool m_HaveGlobalTcpAddr = false;
|
||||
NETADDR m_GlobalTcpAddr;
|
||||
|
||||
uint64_t m_SnapshotParts[NUM_DUMMIES];
|
||||
uint64_t m_aSnapshotParts[NUM_DUMMIES];
|
||||
int64_t m_LocalStartTime;
|
||||
|
||||
IGraphics::CTextureHandle m_DebugFont;
|
||||
|
@ -158,12 +158,12 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
bool m_SoundInitFailed;
|
||||
bool m_ResortServerBrowser;
|
||||
|
||||
int m_AckGameTick[NUM_DUMMIES];
|
||||
int m_CurrentRecvTick[NUM_DUMMIES];
|
||||
int m_RconAuthed[NUM_DUMMIES];
|
||||
char m_RconPassword[32];
|
||||
int m_aAckGameTick[NUM_DUMMIES];
|
||||
int m_aCurrentRecvTick[NUM_DUMMIES];
|
||||
int m_aRconAuthed[NUM_DUMMIES];
|
||||
char m_aRconPassword[32];
|
||||
int m_UseTempRconCommands;
|
||||
char m_Password[32];
|
||||
char m_aPassword[32];
|
||||
bool m_SendPassword;
|
||||
bool m_ButtonRender = false;
|
||||
|
||||
|
@ -177,7 +177,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
char m_aCurrentMapPath[IO_MAX_PATH_LENGTH];
|
||||
|
||||
char m_aTimeoutCodes[NUM_DUMMIES][32];
|
||||
bool m_CodeRunAfterJoin[NUM_DUMMIES];
|
||||
bool m_aCodeRunAfterJoin[NUM_DUMMIES];
|
||||
bool m_GenerateTimeoutSeed;
|
||||
|
||||
//
|
||||
|
@ -207,7 +207,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
std::shared_ptr<CHttpRequest> m_pDDNetInfoTask;
|
||||
|
||||
// time
|
||||
CSmoothTime m_GameTime[NUM_DUMMIES];
|
||||
CSmoothTime m_aGameTime[NUM_DUMMIES];
|
||||
CSmoothTime m_PredictedTime;
|
||||
|
||||
// input
|
||||
|
@ -220,7 +220,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
int64_t m_Time;
|
||||
} m_aInputs[NUM_DUMMIES][200];
|
||||
|
||||
int m_CurrentInput[NUM_DUMMIES];
|
||||
int m_aCurrentInput[NUM_DUMMIES];
|
||||
bool m_LastDummy;
|
||||
bool m_DummySendConnInfo;
|
||||
|
||||
|
@ -230,19 +230,19 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
CGraph m_FpsGraph;
|
||||
|
||||
// the game snapshots are modifiable by the game
|
||||
CSnapshotStorage m_SnapshotStorage[NUM_DUMMIES];
|
||||
CSnapshotStorage::CHolder *m_aSnapshots[NUM_DUMMIES][NUM_SNAPSHOT_TYPES];
|
||||
CSnapshotStorage m_aSnapshotStorage[NUM_DUMMIES];
|
||||
CSnapshotStorage::CHolder *m_aapSnapshots[NUM_DUMMIES][NUM_SNAPSHOT_TYPES];
|
||||
|
||||
int m_ReceivedSnapshots[NUM_DUMMIES];
|
||||
char m_aSnapshotIncomingData[NUM_DUMMIES][CSnapshot::MAX_SIZE];
|
||||
int m_SnapshotIncomingDataSize[NUM_DUMMIES];
|
||||
int m_aReceivedSnapshots[NUM_DUMMIES];
|
||||
char m_aaSnapshotIncomingData[NUM_DUMMIES][CSnapshot::MAX_SIZE];
|
||||
int m_aSnapshotIncomingDataSize[NUM_DUMMIES];
|
||||
|
||||
CSnapshotStorage::CHolder m_aDemorecSnapshotHolders[NUM_SNAPSHOT_TYPES];
|
||||
char *m_aDemorecSnapshotData[NUM_SNAPSHOT_TYPES][2][CSnapshot::MAX_SIZE];
|
||||
char *m_aaapDemorecSnapshotData[NUM_SNAPSHOT_TYPES][2][CSnapshot::MAX_SIZE];
|
||||
|
||||
CSnapshotDelta m_SnapshotDelta;
|
||||
|
||||
std::list<std::shared_ptr<CDemoEdit>> m_EditJobs;
|
||||
std::list<std::shared_ptr<CDemoEdit>> m_lpEditJobs;
|
||||
|
||||
//
|
||||
bool m_CanReceiveServerCapabilities;
|
||||
|
@ -320,7 +320,7 @@ public:
|
|||
void SendReady();
|
||||
void SendMapRequest();
|
||||
|
||||
bool RconAuthed() const override { return m_RconAuthed[g_Config.m_ClDummy] != 0; }
|
||||
bool RconAuthed() const override { return m_aRconAuthed[g_Config.m_ClDummy] != 0; }
|
||||
bool UseTempRconCommands() const override { return m_UseTempRconCommands != 0; }
|
||||
void RconAuth(const char *pName, const char *pPassword) override;
|
||||
void Rcon(const char *pCmd) override;
|
||||
|
|
|
@ -1212,7 +1212,7 @@ void CGraphics_Threaded::QuadsText(float x, float y, float Size, const char *pTe
|
|||
}
|
||||
}
|
||||
|
||||
void CGraphics_Threaded::RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *IndicedVertexDrawNum, size_t NumIndicesOffset)
|
||||
void CGraphics_Threaded::RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *pIndicedVertexDrawNum, size_t NumIndicesOffset)
|
||||
{
|
||||
if(NumIndicesOffset == 0)
|
||||
return;
|
||||
|
@ -1224,32 +1224,32 @@ void CGraphics_Threaded::RenderTileLayer(int BufferContainerIndex, const ColorRG
|
|||
Cmd.m_BufferContainerIndex = BufferContainerIndex;
|
||||
Cmd.m_Color = Color;
|
||||
|
||||
void *Data = m_pCommandBuffer->AllocData((sizeof(char *) + sizeof(unsigned int)) * NumIndicesOffset);
|
||||
if(Data == 0x0)
|
||||
void *pData = m_pCommandBuffer->AllocData((sizeof(char *) + sizeof(unsigned int)) * NumIndicesOffset);
|
||||
if(pData == 0x0)
|
||||
{
|
||||
// kick command buffer and try again
|
||||
KickCommandBuffer();
|
||||
|
||||
Data = m_pCommandBuffer->AllocData((sizeof(char *) + sizeof(unsigned int)) * NumIndicesOffset);
|
||||
if(Data == 0x0)
|
||||
pData = m_pCommandBuffer->AllocData((sizeof(char *) + sizeof(unsigned int)) * NumIndicesOffset);
|
||||
if(pData == 0x0)
|
||||
{
|
||||
dbg_msg("graphics", "failed to allocate data for vertices");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Cmd.m_pIndicesOffsets = (char **)Data;
|
||||
Cmd.m_pDrawCount = (unsigned int *)(((char *)Data) + (sizeof(char *) * NumIndicesOffset));
|
||||
Cmd.m_pIndicesOffsets = (char **)pData;
|
||||
Cmd.m_pDrawCount = (unsigned int *)(((char *)pData) + (sizeof(char *) * NumIndicesOffset));
|
||||
|
||||
if(!AddCmd(
|
||||
Cmd, [&] {
|
||||
Data = m_pCommandBuffer->AllocData((sizeof(char *) + sizeof(unsigned int)) * NumIndicesOffset);
|
||||
if(Data == 0x0)
|
||||
pData = m_pCommandBuffer->AllocData((sizeof(char *) + sizeof(unsigned int)) * NumIndicesOffset);
|
||||
if(pData == 0x0)
|
||||
{
|
||||
dbg_msg("graphics", "failed to allocate data for vertices");
|
||||
return false;
|
||||
}
|
||||
Cmd.m_pIndicesOffsets = (char **)Data;
|
||||
Cmd.m_pDrawCount = (unsigned int *)(((char *)Data) + (sizeof(char *) * NumIndicesOffset));
|
||||
Cmd.m_pIndicesOffsets = (char **)pData;
|
||||
Cmd.m_pDrawCount = (unsigned int *)(((char *)pData) + (sizeof(char *) * NumIndicesOffset));
|
||||
return true;
|
||||
},
|
||||
"failed to allocate memory for render command"))
|
||||
|
@ -1258,7 +1258,7 @@ void CGraphics_Threaded::RenderTileLayer(int BufferContainerIndex, const ColorRG
|
|||
}
|
||||
|
||||
mem_copy(Cmd.m_pIndicesOffsets, pOffsets, sizeof(char *) * NumIndicesOffset);
|
||||
mem_copy(Cmd.m_pDrawCount, IndicedVertexDrawNum, sizeof(unsigned int) * NumIndicesOffset);
|
||||
mem_copy(Cmd.m_pDrawCount, pIndicedVertexDrawNum, sizeof(unsigned int) * NumIndicesOffset);
|
||||
|
||||
m_pCommandBuffer->AddRenderCalls(NumIndicesOffset);
|
||||
// todo max indices group check!!
|
||||
|
@ -2058,8 +2058,8 @@ void CGraphics_Threaded::CopyBufferObjectInternal(int WriteBufferIndex, int Read
|
|||
CCommandBuffer::SCommand_CopyBufferObject Cmd;
|
||||
Cmd.m_WriteBufferIndex = WriteBufferIndex;
|
||||
Cmd.m_ReadBufferIndex = ReadBufferIndex;
|
||||
Cmd.m_pWriteOffset = WriteOffset;
|
||||
Cmd.m_pReadOffset = ReadOffset;
|
||||
Cmd.m_WriteOffset = WriteOffset;
|
||||
Cmd.m_ReadOffset = ReadOffset;
|
||||
Cmd.m_CopySize = CopyDataSize;
|
||||
|
||||
if(!AddCmd(
|
||||
|
@ -2093,14 +2093,14 @@ int CGraphics_Threaded::CreateBufferContainer(SBufferContainerInfo *pContainerIn
|
|||
int Index = -1;
|
||||
if(m_FirstFreeVertexArrayInfo == -1)
|
||||
{
|
||||
Index = m_VertexArrayInfo.size();
|
||||
m_VertexArrayInfo.emplace_back();
|
||||
Index = m_vVertexArrayInfo.size();
|
||||
m_vVertexArrayInfo.emplace_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
Index = m_FirstFreeVertexArrayInfo;
|
||||
m_FirstFreeVertexArrayInfo = m_VertexArrayInfo[Index].m_FreeIndex;
|
||||
m_VertexArrayInfo[Index].m_FreeIndex = Index;
|
||||
m_FirstFreeVertexArrayInfo = m_vVertexArrayInfo[Index].m_FreeIndex;
|
||||
m_vVertexArrayInfo[Index].m_FreeIndex = Index;
|
||||
}
|
||||
|
||||
CCommandBuffer::SCommand_CreateBufferContainer Cmd;
|
||||
|
@ -2130,7 +2130,7 @@ int CGraphics_Threaded::CreateBufferContainer(SBufferContainerInfo *pContainerIn
|
|||
|
||||
mem_copy(Cmd.m_pAttributes, pContainerInfo->m_vAttributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
|
||||
|
||||
m_VertexArrayInfo[Index].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
m_vVertexArrayInfo[Index].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
|
||||
return Index;
|
||||
}
|
||||
|
@ -2152,7 +2152,7 @@ void CGraphics_Threaded::DeleteBufferContainer(int ContainerIndex, bool DestroyA
|
|||
if(DestroyAllBO)
|
||||
{
|
||||
// delete all associated references
|
||||
int BufferObjectIndex = m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex;
|
||||
int BufferObjectIndex = m_vVertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex;
|
||||
if(BufferObjectIndex != -1)
|
||||
{
|
||||
// clear the buffer object index
|
||||
|
@ -2160,10 +2160,10 @@ void CGraphics_Threaded::DeleteBufferContainer(int ContainerIndex, bool DestroyA
|
|||
m_FirstFreeBufferObjectIndex = BufferObjectIndex;
|
||||
}
|
||||
}
|
||||
m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex = -1;
|
||||
m_vVertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex = -1;
|
||||
|
||||
// also clear the buffer object index
|
||||
m_VertexArrayInfo[ContainerIndex].m_FreeIndex = m_FirstFreeVertexArrayInfo;
|
||||
m_vVertexArrayInfo[ContainerIndex].m_FreeIndex = m_FirstFreeVertexArrayInfo;
|
||||
m_FirstFreeVertexArrayInfo = ContainerIndex;
|
||||
}
|
||||
|
||||
|
@ -2196,7 +2196,7 @@ void CGraphics_Threaded::UpdateBufferContainerInternal(int ContainerIndex, SBuff
|
|||
|
||||
mem_copy(Cmd.m_pAttributes, pContainerInfo->m_vAttributes.data(), Cmd.m_AttrCount * sizeof(SBufferContainerInfo::SAttribute));
|
||||
|
||||
m_VertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
m_vVertexArrayInfo[ContainerIndex].m_AssociatedBufferObjectIndex = pContainerInfo->m_VertBufferBindingIndex;
|
||||
}
|
||||
|
||||
void CGraphics_Threaded::IndicesNumRequiredNotify(unsigned int RequiredIndicesCount)
|
||||
|
|
|
@ -301,8 +301,8 @@ public:
|
|||
int m_WriteBufferIndex;
|
||||
int m_ReadBufferIndex;
|
||||
|
||||
size_t m_pReadOffset;
|
||||
size_t m_pWriteOffset;
|
||||
size_t m_ReadOffset;
|
||||
size_t m_WriteOffset;
|
||||
size_t m_CopySize;
|
||||
};
|
||||
|
||||
|
@ -716,7 +716,7 @@ public:
|
|||
|
||||
virtual ~IGraphicsBackend() {}
|
||||
|
||||
virtual int Init(const char *pName, int *Screen, int *pWidth, int *pHeight, int *pRefreshRate, int *pFsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight, int *pCurrentWidth, int *pCurrentHeight, class IStorage *pStorage) = 0;
|
||||
virtual int Init(const char *pName, int *pScreen, int *pWidth, int *pHeight, int *pRefreshRate, int *pFsaaSamples, int Flags, int *pDesktopWidth, int *pDesktopHeight, int *pCurrentWidth, int *pCurrentHeight, class IStorage *pStorage) = 0;
|
||||
virtual int Shutdown() = 0;
|
||||
|
||||
virtual uint64_t TextureMemoryUsage() const = 0;
|
||||
|
@ -839,7 +839,7 @@ class CGraphics_Threaded : public IEngineGraphics
|
|||
|
||||
int m_FreeIndex;
|
||||
};
|
||||
std::vector<SVertexArrayInfo> m_VertexArrayInfo;
|
||||
std::vector<SVertexArrayInfo> m_vVertexArrayInfo;
|
||||
int m_FirstFreeVertexArrayInfo;
|
||||
|
||||
std::vector<int> m_vBufferObjectIndices;
|
||||
|
@ -1008,10 +1008,7 @@ public:
|
|||
void SetColor(TName *pVertex, int ColorIndex)
|
||||
{
|
||||
TName *pVert = pVertex;
|
||||
pVert->m_Color.r = m_aColor[ColorIndex].r;
|
||||
pVert->m_Color.g = m_aColor[ColorIndex].g;
|
||||
pVert->m_Color.b = m_aColor[ColorIndex].b;
|
||||
pVert->m_Color.a = m_aColor[ColorIndex].a;
|
||||
pVert->m_Color = m_aColor[ColorIndex];
|
||||
}
|
||||
|
||||
void SetColorVertex(const CColorVertex *pArray, int Num) override;
|
||||
|
@ -1230,7 +1227,7 @@ public:
|
|||
void FlushVertices(bool KeepVertices = false) override;
|
||||
void FlushVerticesTex3D() override;
|
||||
|
||||
void RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *IndicedVertexDrawNum, size_t NumIndicesOffset) override;
|
||||
void RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *pIndicedVertexDrawNum, size_t NumIndicesOffset) override;
|
||||
void RenderBorderTiles(int BufferContainerIndex, const ColorRGBA &Color, char *pIndexBufferOffset, const vec2 &Offset, const vec2 &Dir, int JumpIndex, unsigned int DrawNum) override;
|
||||
void RenderBorderTileLines(int BufferContainerIndex, const ColorRGBA &Color, char *pIndexBufferOffset, const vec2 &Offset, const vec2 &Dir, unsigned int IndexDrawNum, unsigned int RedrawNum) override;
|
||||
void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo *pQuadInfo, int QuadNum, int QuadOffset) override;
|
||||
|
|
|
@ -39,8 +39,8 @@ class SortWrap
|
|||
CServerBrowser *m_pThis;
|
||||
|
||||
public:
|
||||
SortWrap(CServerBrowser *t, SortFunc f) :
|
||||
m_pfnSort(f), m_pThis(t) {}
|
||||
SortWrap(CServerBrowser *pServer, SortFunc Func) :
|
||||
m_pfnSort(Func), m_pThis(pServer) {}
|
||||
bool operator()(int a, int b) { return (g_Config.m_BrSortOrder ? (m_pThis->*m_pfnSort)(b, a) : (m_pThis->*m_pfnSort)(a, b)); }
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ CServerBrowser::CServerBrowser()
|
|||
|
||||
m_NumFavoriteServers = 0;
|
||||
|
||||
mem_zero(m_aServerlistIp, sizeof(m_aServerlistIp));
|
||||
mem_zero(m_apServerlistIp, sizeof(m_apServerlistIp));
|
||||
|
||||
m_pFirstReqServer = 0; // request list
|
||||
m_pLastReqServer = 0;
|
||||
|
@ -199,59 +199,59 @@ int CServerBrowser::GetExtraToken(int Token)
|
|||
|
||||
bool CServerBrowser::SortCompareName(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
// make sure empty entries are listed last
|
||||
return (a->m_GotInfo && b->m_GotInfo) || (!a->m_GotInfo && !b->m_GotInfo) ? str_comp(a->m_Info.m_aName, b->m_Info.m_aName) < 0 :
|
||||
a->m_GotInfo != 0;
|
||||
return (pIndex1->m_GotInfo && pIndex2->m_GotInfo) || (!pIndex1->m_GotInfo && !pIndex2->m_GotInfo) ? str_comp(pIndex1->m_Info.m_aName, pIndex2->m_Info.m_aName) < 0 :
|
||||
pIndex1->m_GotInfo != 0;
|
||||
}
|
||||
|
||||
bool CServerBrowser::SortCompareMap(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
return str_comp(a->m_Info.m_aMap, b->m_Info.m_aMap) < 0;
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
return str_comp(pIndex1->m_Info.m_aMap, pIndex2->m_Info.m_aMap) < 0;
|
||||
}
|
||||
|
||||
bool CServerBrowser::SortComparePing(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
return a->m_Info.m_Latency < b->m_Info.m_Latency;
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
return pIndex1->m_Info.m_Latency < pIndex2->m_Info.m_Latency;
|
||||
}
|
||||
|
||||
bool CServerBrowser::SortCompareGametype(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
return str_comp(a->m_Info.m_aGameType, b->m_Info.m_aGameType) < 0;
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
return str_comp(pIndex1->m_Info.m_aGameType, pIndex2->m_Info.m_aGameType) < 0;
|
||||
}
|
||||
|
||||
bool CServerBrowser::SortCompareNumPlayers(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
return a->m_Info.m_NumFilteredPlayers > b->m_Info.m_NumFilteredPlayers;
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
return pIndex1->m_Info.m_NumFilteredPlayers > pIndex2->m_Info.m_NumFilteredPlayers;
|
||||
}
|
||||
|
||||
bool CServerBrowser::SortCompareNumClients(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
return a->m_Info.m_NumClients > b->m_Info.m_NumClients;
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
return pIndex1->m_Info.m_NumClients > pIndex2->m_Info.m_NumClients;
|
||||
}
|
||||
|
||||
bool CServerBrowser::SortCompareNumPlayersAndPing(int Index1, int Index2) const
|
||||
{
|
||||
CServerEntry *a = m_ppServerlist[Index1];
|
||||
CServerEntry *b = m_ppServerlist[Index2];
|
||||
CServerEntry *pIndex1 = m_ppServerlist[Index1];
|
||||
CServerEntry *pIndex2 = m_ppServerlist[Index2];
|
||||
|
||||
if(a->m_Info.m_NumFilteredPlayers == b->m_Info.m_NumFilteredPlayers)
|
||||
return a->m_Info.m_Latency > b->m_Info.m_Latency;
|
||||
else if(a->m_Info.m_NumFilteredPlayers == 0 || b->m_Info.m_NumFilteredPlayers == 0 || a->m_Info.m_Latency / 100 == b->m_Info.m_Latency / 100)
|
||||
return a->m_Info.m_NumFilteredPlayers < b->m_Info.m_NumFilteredPlayers;
|
||||
if(pIndex1->m_Info.m_NumFilteredPlayers == pIndex2->m_Info.m_NumFilteredPlayers)
|
||||
return pIndex1->m_Info.m_Latency > pIndex2->m_Info.m_Latency;
|
||||
else if(pIndex1->m_Info.m_NumFilteredPlayers == 0 || pIndex2->m_Info.m_NumFilteredPlayers == 0 || pIndex1->m_Info.m_Latency / 100 == pIndex2->m_Info.m_Latency / 100)
|
||||
return pIndex1->m_Info.m_NumFilteredPlayers < pIndex2->m_Info.m_NumFilteredPlayers;
|
||||
else
|
||||
return a->m_Info.m_Latency > b->m_Info.m_Latency;
|
||||
return pIndex1->m_Info.m_Latency > pIndex2->m_Info.m_Latency;
|
||||
}
|
||||
|
||||
void CServerBrowser::Filter()
|
||||
|
@ -465,7 +465,7 @@ void CServerBrowser::RemoveRequest(CServerEntry *pEntry)
|
|||
|
||||
CServerBrowser::CServerEntry *CServerBrowser::Find(const NETADDR &Addr)
|
||||
{
|
||||
CServerEntry *pEntry = m_aServerlistIp[Addr.ip[0]];
|
||||
CServerEntry *pEntry = m_apServerlistIp[Addr.ip[0]];
|
||||
|
||||
for(; pEntry; pEntry = pEntry->m_pNextIp)
|
||||
{
|
||||
|
@ -531,7 +531,7 @@ void CServerBrowser::SetInfo(CServerEntry *pEntry, const CServerInfo &Info)
|
|||
void CServerBrowser::SetLatency(NETADDR Addr, int Latency)
|
||||
{
|
||||
Addr.port = 0;
|
||||
for(CServerEntry *pEntry = m_aServerlistIp[Addr.ip[0]]; pEntry; pEntry = pEntry->m_pNextIp)
|
||||
for(CServerEntry *pEntry = m_apServerlistIp[Addr.ip[0]]; pEntry; pEntry = pEntry->m_pNextIp)
|
||||
{
|
||||
NETADDR Other = pEntry->m_Addr;
|
||||
Other.port = 0;
|
||||
|
@ -583,8 +583,8 @@ CServerBrowser::CServerEntry *CServerBrowser::Add(const NETADDR &Addr)
|
|||
}
|
||||
|
||||
// add to the hash list
|
||||
pEntry->m_pNextIp = m_aServerlistIp[Hash];
|
||||
m_aServerlistIp[Hash] = pEntry;
|
||||
pEntry->m_pNextIp = m_apServerlistIp[Hash];
|
||||
m_apServerlistIp[Hash] = pEntry;
|
||||
|
||||
if(m_NumServers == m_NumServerCapacity)
|
||||
{
|
||||
|
@ -768,7 +768,7 @@ void CServerBrowser::Refresh(int Type)
|
|||
|
||||
if(Type == IServerBrowser::TYPE_LAN)
|
||||
{
|
||||
unsigned char Buffer[sizeof(SERVERBROWSE_GETINFO) + 1];
|
||||
unsigned char aBuffer[sizeof(SERVERBROWSE_GETINFO) + 1];
|
||||
CNetChunk Packet;
|
||||
int i;
|
||||
|
||||
|
@ -777,13 +777,13 @@ void CServerBrowser::Refresh(int Type)
|
|||
mem_zero(&Packet, sizeof(Packet));
|
||||
Packet.m_Address.type = m_pNetClient->NetType() | NETTYPE_LINK_BROADCAST;
|
||||
Packet.m_Flags = NETSENDFLAG_CONNLESS | NETSENDFLAG_EXTENDED;
|
||||
Packet.m_DataSize = sizeof(Buffer);
|
||||
Packet.m_pData = Buffer;
|
||||
Packet.m_DataSize = sizeof(aBuffer);
|
||||
Packet.m_pData = aBuffer;
|
||||
mem_zero(&Packet.m_aExtraData, sizeof(Packet.m_aExtraData));
|
||||
|
||||
int Token = GenerateToken(Packet.m_Address);
|
||||
mem_copy(Buffer, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO));
|
||||
Buffer[sizeof(SERVERBROWSE_GETINFO)] = GetBasicToken(Token);
|
||||
mem_copy(aBuffer, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO));
|
||||
aBuffer[sizeof(SERVERBROWSE_GETINFO)] = GetBasicToken(Token);
|
||||
|
||||
Packet.m_aExtraData[0] = GetExtraToken(Token) >> 8;
|
||||
Packet.m_aExtraData[1] = GetExtraToken(Token) & 0xff;
|
||||
|
@ -816,7 +816,7 @@ void CServerBrowser::Refresh(int Type)
|
|||
|
||||
void CServerBrowser::RequestImpl(const NETADDR &Addr, CServerEntry *pEntry, int *pBasicToken, int *pToken, bool RandomToken) const
|
||||
{
|
||||
unsigned char Buffer[sizeof(SERVERBROWSE_GETINFO) + 1];
|
||||
unsigned char aBuffer[sizeof(SERVERBROWSE_GETINFO) + 1];
|
||||
CNetChunk Packet;
|
||||
|
||||
if(g_Config.m_Debug)
|
||||
|
@ -847,14 +847,14 @@ void CServerBrowser::RequestImpl(const NETADDR &Addr, CServerEntry *pEntry, int
|
|||
*pBasicToken = GetBasicToken(Token);
|
||||
}
|
||||
|
||||
mem_copy(Buffer, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO));
|
||||
Buffer[sizeof(SERVERBROWSE_GETINFO)] = GetBasicToken(Token);
|
||||
mem_copy(aBuffer, SERVERBROWSE_GETINFO, sizeof(SERVERBROWSE_GETINFO));
|
||||
aBuffer[sizeof(SERVERBROWSE_GETINFO)] = GetBasicToken(Token);
|
||||
|
||||
Packet.m_ClientID = -1;
|
||||
Packet.m_Address = Addr;
|
||||
Packet.m_Flags = NETSENDFLAG_CONNLESS | NETSENDFLAG_EXTENDED;
|
||||
Packet.m_DataSize = sizeof(Buffer);
|
||||
Packet.m_pData = Buffer;
|
||||
Packet.m_DataSize = sizeof(aBuffer);
|
||||
Packet.m_pData = aBuffer;
|
||||
mem_zero(&Packet.m_aExtraData, sizeof(Packet.m_aExtraData));
|
||||
Packet.m_aExtraData[0] = GetExtraToken(Token) >> 8;
|
||||
Packet.m_aExtraData[1] = GetExtraToken(Token) & 0xff;
|
||||
|
@ -867,7 +867,7 @@ void CServerBrowser::RequestImpl(const NETADDR &Addr, CServerEntry *pEntry, int
|
|||
|
||||
void CServerBrowser::RequestImpl64(const NETADDR &Addr, CServerEntry *pEntry) const
|
||||
{
|
||||
unsigned char Buffer[sizeof(SERVERBROWSE_GETINFO_64_LEGACY) + 1];
|
||||
unsigned char aBuffer[sizeof(SERVERBROWSE_GETINFO_64_LEGACY) + 1];
|
||||
CNetChunk Packet;
|
||||
|
||||
if(g_Config.m_Debug)
|
||||
|
@ -879,14 +879,14 @@ void CServerBrowser::RequestImpl64(const NETADDR &Addr, CServerEntry *pEntry) co
|
|||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_DEBUG, "client_srvbrowse", aBuf);
|
||||
}
|
||||
|
||||
mem_copy(Buffer, SERVERBROWSE_GETINFO_64_LEGACY, sizeof(SERVERBROWSE_GETINFO_64_LEGACY));
|
||||
Buffer[sizeof(SERVERBROWSE_GETINFO_64_LEGACY)] = GetBasicToken(GenerateToken(Addr));
|
||||
mem_copy(aBuffer, SERVERBROWSE_GETINFO_64_LEGACY, sizeof(SERVERBROWSE_GETINFO_64_LEGACY));
|
||||
aBuffer[sizeof(SERVERBROWSE_GETINFO_64_LEGACY)] = GetBasicToken(GenerateToken(Addr));
|
||||
|
||||
Packet.m_ClientID = -1;
|
||||
Packet.m_Address = Addr;
|
||||
Packet.m_Flags = NETSENDFLAG_CONNLESS;
|
||||
Packet.m_DataSize = sizeof(Buffer);
|
||||
Packet.m_pData = Buffer;
|
||||
Packet.m_DataSize = sizeof(aBuffer);
|
||||
Packet.m_pData = aBuffer;
|
||||
|
||||
m_pNetClient->Send(&Packet);
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ void CServerBrowser::CleanUp()
|
|||
m_ServerlistHeap.Reset();
|
||||
m_NumServers = 0;
|
||||
m_NumSortedServers = 0;
|
||||
mem_zero(m_aServerlistIp, sizeof(m_aServerlistIp));
|
||||
mem_zero(m_apServerlistIp, sizeof(m_apServerlistIp));
|
||||
m_pFirstReqServer = 0;
|
||||
m_pLastReqServer = 0;
|
||||
m_NumRequests = 0;
|
||||
|
@ -1619,7 +1619,7 @@ void CServerBrowser::DDNetFilterRem(char *pFilter, const char *pName)
|
|||
pFilter[0] = '\0';
|
||||
|
||||
char aToken[128];
|
||||
for(const char *tok = aBuf; (tok = str_next_token(tok, ",", aToken, sizeof(aToken)));)
|
||||
for(const char *pTok = aBuf; (pTok = str_next_token(pTok, ",", aToken, sizeof(aToken)));)
|
||||
{
|
||||
if(str_comp_nocase(pName, aToken) != 0)
|
||||
{
|
||||
|
@ -1699,7 +1699,7 @@ bool CServerInfo::ParseLocation(int *pResult, const char *pString)
|
|||
return true;
|
||||
}
|
||||
// ISO continent code. Allow antarctica, but treat it as unknown.
|
||||
static const char LOCATIONS[][6] = {
|
||||
static const char s_apLocations[][6] = {
|
||||
"an", // LOC_UNKNOWN
|
||||
"af", // LOC_AFRICA
|
||||
"as", // LOC_ASIA
|
||||
|
@ -1709,9 +1709,9 @@ bool CServerInfo::ParseLocation(int *pResult, const char *pString)
|
|||
"sa", // LOC_SOUTH_AMERICA
|
||||
"as:cn", // LOC_CHINA
|
||||
};
|
||||
for(int i = std::size(LOCATIONS) - 1; i >= 0; i--)
|
||||
for(int i = std::size(s_apLocations) - 1; i >= 0; i--)
|
||||
{
|
||||
if(str_startswith(pString, LOCATIONS[i]))
|
||||
if(str_startswith(pString, s_apLocations[i]))
|
||||
{
|
||||
*pResult = i;
|
||||
return false;
|
||||
|
|
|
@ -172,7 +172,7 @@ private:
|
|||
|
||||
json_value *m_pDDNetInfo;
|
||||
|
||||
CServerEntry *m_aServerlistIp[256]; // ip hash list
|
||||
CServerEntry *m_apServerlistIp[256]; // ip hash list
|
||||
|
||||
CServerEntry *m_pFirstReqServer; // request list
|
||||
CServerEntry *m_pLastReqServer;
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
void OnGameRichPresenceJoinRequested(GameRichPresenceJoinRequested_t *pEvent)
|
||||
{
|
||||
ParseConnectString(pEvent->m_rgchConnect);
|
||||
ParseConnectString(pEvent->m_aRGCHConnect);
|
||||
}
|
||||
|
||||
const char *GetPlayerName() override
|
||||
|
|
|
@ -62,7 +62,7 @@ struct STextCharQuadVertex
|
|||
|
||||
struct STextCharQuad
|
||||
{
|
||||
STextCharQuadVertex m_Vertices[4];
|
||||
STextCharQuadVertex m_aVertices[4];
|
||||
};
|
||||
|
||||
struct STextureSkyline
|
||||
|
@ -89,8 +89,8 @@ public:
|
|||
~CFont()
|
||||
{
|
||||
free(m_pBuf);
|
||||
delete[] m_TextureData[0];
|
||||
delete[] m_TextureData[1];
|
||||
delete[] m_apTextureData[0];
|
||||
delete[] m_apTextureData[1];
|
||||
for(auto &FtFallbackFont : m_vFtFallbackFonts)
|
||||
{
|
||||
free(FtFallbackFont.m_pBuf);
|
||||
|
@ -131,12 +131,12 @@ public:
|
|||
|
||||
IGraphics::CTextureHandle m_aTextures[2];
|
||||
// keep the full texture, because opengl doesn't provide texture copying
|
||||
uint8_t *m_TextureData[2];
|
||||
uint8_t *m_apTextureData[2];
|
||||
|
||||
// width and height are the same
|
||||
int m_CurTextureDimensions[2];
|
||||
int m_aCurTextureDimensions[2];
|
||||
|
||||
STextureSkyline m_TextureSkyline[2];
|
||||
STextureSkyline m_aTextureSkyline[2];
|
||||
};
|
||||
|
||||
struct STextString
|
||||
|
@ -339,29 +339,29 @@ class CTextRender : public IEngineTextRender
|
|||
unsigned char *pTmpTexBuffer = new unsigned char[NewDimensions * NewDimensions];
|
||||
mem_zero(pTmpTexBuffer, (size_t)NewDimensions * NewDimensions * sizeof(unsigned char));
|
||||
|
||||
for(int y = 0; y < pFont->m_CurTextureDimensions[TextureIndex]; ++y)
|
||||
for(int y = 0; y < pFont->m_aCurTextureDimensions[TextureIndex]; ++y)
|
||||
{
|
||||
for(int x = 0; x < pFont->m_CurTextureDimensions[TextureIndex]; ++x)
|
||||
for(int x = 0; x < pFont->m_aCurTextureDimensions[TextureIndex]; ++x)
|
||||
{
|
||||
pTmpTexBuffer[x + y * NewDimensions] = pFont->m_TextureData[TextureIndex][x + y * pFont->m_CurTextureDimensions[TextureIndex]];
|
||||
pTmpTexBuffer[x + y * NewDimensions] = pFont->m_apTextureData[TextureIndex][x + y * pFont->m_aCurTextureDimensions[TextureIndex]];
|
||||
}
|
||||
}
|
||||
|
||||
delete[] pFont->m_TextureData[TextureIndex];
|
||||
pFont->m_TextureData[TextureIndex] = pTmpTexBuffer;
|
||||
pFont->m_CurTextureDimensions[TextureIndex] = NewDimensions;
|
||||
pFont->m_TextureSkyline[TextureIndex].m_vCurHeightOfPixelColumn.resize(NewDimensions, 0);
|
||||
delete[] pFont->m_apTextureData[TextureIndex];
|
||||
pFont->m_apTextureData[TextureIndex] = pTmpTexBuffer;
|
||||
pFont->m_aCurTextureDimensions[TextureIndex] = NewDimensions;
|
||||
pFont->m_aTextureSkyline[TextureIndex].m_vCurHeightOfPixelColumn.resize(NewDimensions, 0);
|
||||
}
|
||||
|
||||
void IncreaseFontTexture(CFont *pFont)
|
||||
{
|
||||
int NewDimensions = pFont->m_CurTextureDimensions[0] * 2;
|
||||
int NewDimensions = pFont->m_aCurTextureDimensions[0] * 2;
|
||||
UnloadTextures(pFont->m_aTextures);
|
||||
|
||||
IncreaseFontTextureImpl(pFont, 0, NewDimensions);
|
||||
IncreaseFontTextureImpl(pFont, 1, NewDimensions);
|
||||
|
||||
InitTextures(NewDimensions, NewDimensions, pFont->m_aTextures, pFont->m_TextureData);
|
||||
InitTextures(NewDimensions, NewDimensions, pFont->m_aTextures, pFont->m_apTextureData);
|
||||
}
|
||||
|
||||
int AdjustOutlineThicknessToFontSize(int OutlineThickness, int FontSize)
|
||||
|
@ -379,7 +379,7 @@ class CTextRender : public IEngineTextRender
|
|||
{
|
||||
for(int x = 0; x < Width; ++x)
|
||||
{
|
||||
pFont->m_TextureData[TextureIndex][x + PosX + ((y + PosY) * pFont->m_CurTextureDimensions[TextureIndex])] = pData[x + y * Width];
|
||||
pFont->m_apTextureData[TextureIndex][x + PosX + ((y + PosY) * pFont->m_aCurTextureDimensions[TextureIndex])] = pData[x + y * Width];
|
||||
}
|
||||
}
|
||||
Graphics()->UpdateTextTexture(pFont->m_aTextures[TextureIndex], PosX, PosY, Width, Height, pData);
|
||||
|
@ -391,18 +391,18 @@ class CTextRender : public IEngineTextRender
|
|||
|
||||
bool GetCharacterSpace(CFont *pFont, int TextureIndex, int Width, int Height, int &PosX, int &PosY)
|
||||
{
|
||||
if(pFont->m_CurTextureDimensions[TextureIndex] < Width)
|
||||
if(pFont->m_aCurTextureDimensions[TextureIndex] < Width)
|
||||
return false;
|
||||
if(pFont->m_CurTextureDimensions[TextureIndex] < Height)
|
||||
if(pFont->m_aCurTextureDimensions[TextureIndex] < Height)
|
||||
return false;
|
||||
|
||||
// skyline bottom left algorithm
|
||||
std::vector<int> &vSkylineHeights = pFont->m_TextureSkyline[TextureIndex].m_vCurHeightOfPixelColumn;
|
||||
std::vector<int> &vSkylineHeights = pFont->m_aTextureSkyline[TextureIndex].m_vCurHeightOfPixelColumn;
|
||||
|
||||
// search a fitting area with less pixel loss
|
||||
int SmallestPixelLossAreaX = 0;
|
||||
int SmallestPixelLossAreaY = pFont->m_CurTextureDimensions[TextureIndex] + 1;
|
||||
int SmallestPixelLossCurPixelLoss = pFont->m_CurTextureDimensions[TextureIndex] * pFont->m_CurTextureDimensions[TextureIndex];
|
||||
int SmallestPixelLossAreaY = pFont->m_aCurTextureDimensions[TextureIndex] + 1;
|
||||
int SmallestPixelLossCurPixelLoss = pFont->m_aCurTextureDimensions[TextureIndex] * pFont->m_aCurTextureDimensions[TextureIndex];
|
||||
|
||||
bool FoundAnyArea = false;
|
||||
for(size_t i = 0; i < vSkylineHeights.size(); i++)
|
||||
|
@ -431,7 +431,7 @@ class CTextRender : public IEngineTextRender
|
|||
}
|
||||
|
||||
// if the area is too high, continue
|
||||
if(CurHeight + Height > pFont->m_CurTextureDimensions[TextureIndex])
|
||||
if(CurHeight + Height > pFont->m_aCurTextureDimensions[TextureIndex])
|
||||
continue;
|
||||
// if the found area fits our needs, check if we can use it
|
||||
if(AreaWidth == Width)
|
||||
|
@ -719,17 +719,17 @@ public:
|
|||
dbg_msg("textrender", "loaded font from '%s'", pFilename);
|
||||
|
||||
pFont->m_pBuf = (void *)pBuf;
|
||||
pFont->m_CurTextureDimensions[0] = 1024;
|
||||
pFont->m_TextureData[0] = new unsigned char[pFont->m_CurTextureDimensions[0] * pFont->m_CurTextureDimensions[0]];
|
||||
mem_zero(pFont->m_TextureData[0], (size_t)pFont->m_CurTextureDimensions[0] * pFont->m_CurTextureDimensions[0] * sizeof(unsigned char));
|
||||
pFont->m_CurTextureDimensions[1] = 1024;
|
||||
pFont->m_TextureData[1] = new unsigned char[pFont->m_CurTextureDimensions[1] * pFont->m_CurTextureDimensions[1]];
|
||||
mem_zero(pFont->m_TextureData[1], (size_t)pFont->m_CurTextureDimensions[1] * pFont->m_CurTextureDimensions[1] * sizeof(unsigned char));
|
||||
pFont->m_aCurTextureDimensions[0] = 1024;
|
||||
pFont->m_apTextureData[0] = new unsigned char[pFont->m_aCurTextureDimensions[0] * pFont->m_aCurTextureDimensions[0]];
|
||||
mem_zero(pFont->m_apTextureData[0], (size_t)pFont->m_aCurTextureDimensions[0] * pFont->m_aCurTextureDimensions[0] * sizeof(unsigned char));
|
||||
pFont->m_aCurTextureDimensions[1] = 1024;
|
||||
pFont->m_apTextureData[1] = new unsigned char[pFont->m_aCurTextureDimensions[1] * pFont->m_aCurTextureDimensions[1]];
|
||||
mem_zero(pFont->m_apTextureData[1], (size_t)pFont->m_aCurTextureDimensions[1] * pFont->m_aCurTextureDimensions[1] * sizeof(unsigned char));
|
||||
|
||||
InitTextures(pFont->m_CurTextureDimensions[0], pFont->m_CurTextureDimensions[0], pFont->m_aTextures, pFont->m_TextureData);
|
||||
InitTextures(pFont->m_aCurTextureDimensions[0], pFont->m_aCurTextureDimensions[0], pFont->m_aTextures, pFont->m_apTextureData);
|
||||
|
||||
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->m_aTextureSkyline[0].m_vCurHeightOfPixelColumn.resize(pFont->m_aCurTextureDimensions[0], 0);
|
||||
pFont->m_aTextureSkyline[1].m_vCurHeightOfPixelColumn.resize(pFont->m_aCurTextureDimensions[1], 0);
|
||||
|
||||
pFont->InitFontSizes();
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ public:
|
|||
|
||||
bool IsRendered = (pCursor->m_Flags & TEXTFLAG_RENDER) != 0;
|
||||
|
||||
IGraphics::CQuadItem CursorQuads[2];
|
||||
IGraphics::CQuadItem aCursorQuads[2];
|
||||
bool HasCursor = false;
|
||||
|
||||
float CursorInnerWidth = (((ScreenX1 - ScreenX0) / Graphics()->ScreenWidth())) * 2;
|
||||
|
@ -1305,41 +1305,41 @@ public:
|
|||
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;
|
||||
TextCharQuad.m_Vertices[0].m_U = pChr->m_aUVs[0];
|
||||
TextCharQuad.m_Vertices[0].m_V = pChr->m_aUVs[3];
|
||||
TextCharQuad.m_Vertices[0].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_Vertices[0].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_Vertices[0].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_Vertices[0].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
TextCharQuad.m_aVertices[0].m_X = CharX;
|
||||
TextCharQuad.m_aVertices[0].m_Y = CharY;
|
||||
TextCharQuad.m_aVertices[0].m_U = pChr->m_aUVs[0];
|
||||
TextCharQuad.m_aVertices[0].m_V = pChr->m_aUVs[3];
|
||||
TextCharQuad.m_aVertices[0].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_aVertices[0].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_aVertices[0].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_aVertices[0].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
|
||||
TextCharQuad.m_Vertices[1].m_X = CharX + CharWidth;
|
||||
TextCharQuad.m_Vertices[1].m_Y = CharY;
|
||||
TextCharQuad.m_Vertices[1].m_U = pChr->m_aUVs[2];
|
||||
TextCharQuad.m_Vertices[1].m_V = pChr->m_aUVs[3];
|
||||
TextCharQuad.m_Vertices[1].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_Vertices[1].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_Vertices[1].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_Vertices[1].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
TextCharQuad.m_aVertices[1].m_X = CharX + CharWidth;
|
||||
TextCharQuad.m_aVertices[1].m_Y = CharY;
|
||||
TextCharQuad.m_aVertices[1].m_U = pChr->m_aUVs[2];
|
||||
TextCharQuad.m_aVertices[1].m_V = pChr->m_aUVs[3];
|
||||
TextCharQuad.m_aVertices[1].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_aVertices[1].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_aVertices[1].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_aVertices[1].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
|
||||
TextCharQuad.m_Vertices[2].m_X = CharX + CharWidth;
|
||||
TextCharQuad.m_Vertices[2].m_Y = CharY - CharHeight;
|
||||
TextCharQuad.m_Vertices[2].m_U = pChr->m_aUVs[2];
|
||||
TextCharQuad.m_Vertices[2].m_V = pChr->m_aUVs[1];
|
||||
TextCharQuad.m_Vertices[2].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_Vertices[2].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_Vertices[2].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_Vertices[2].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
TextCharQuad.m_aVertices[2].m_X = CharX + CharWidth;
|
||||
TextCharQuad.m_aVertices[2].m_Y = CharY - CharHeight;
|
||||
TextCharQuad.m_aVertices[2].m_U = pChr->m_aUVs[2];
|
||||
TextCharQuad.m_aVertices[2].m_V = pChr->m_aUVs[1];
|
||||
TextCharQuad.m_aVertices[2].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_aVertices[2].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_aVertices[2].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_aVertices[2].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
|
||||
TextCharQuad.m_Vertices[3].m_X = CharX;
|
||||
TextCharQuad.m_Vertices[3].m_Y = CharY - CharHeight;
|
||||
TextCharQuad.m_Vertices[3].m_U = pChr->m_aUVs[0];
|
||||
TextCharQuad.m_Vertices[3].m_V = pChr->m_aUVs[1];
|
||||
TextCharQuad.m_Vertices[3].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_Vertices[3].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_Vertices[3].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_Vertices[3].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
TextCharQuad.m_aVertices[3].m_X = CharX;
|
||||
TextCharQuad.m_aVertices[3].m_Y = CharY - CharHeight;
|
||||
TextCharQuad.m_aVertices[3].m_U = pChr->m_aUVs[0];
|
||||
TextCharQuad.m_aVertices[3].m_V = pChr->m_aUVs[1];
|
||||
TextCharQuad.m_aVertices[3].m_Color.r = (unsigned char)(m_Color.r * 255.f);
|
||||
TextCharQuad.m_aVertices[3].m_Color.g = (unsigned char)(m_Color.g * 255.f);
|
||||
TextCharQuad.m_aVertices[3].m_Color.b = (unsigned char)(m_Color.b * 255.f);
|
||||
TextCharQuad.m_aVertices[3].m_Color.a = (unsigned char)(m_Color.a * 255.f);
|
||||
}
|
||||
|
||||
// calculate the full width from the last selection point to the end of this selection draw on screen
|
||||
|
@ -1389,8 +1389,8 @@ public:
|
|||
if((int)CharacterCounter == pCursor->m_CursorCharacter)
|
||||
{
|
||||
HasCursor = true;
|
||||
CursorQuads[0] = IGraphics::CQuadItem(SelX - CursorOuterInnerDiff, DrawY, CursorOuterWidth, Size);
|
||||
CursorQuads[1] = IGraphics::CQuadItem(SelX, DrawY + CursorOuterInnerDiff, CursorInnerWidth, Size - CursorOuterInnerDiff * 2);
|
||||
aCursorQuads[0] = IGraphics::CQuadItem(SelX - CursorOuterInnerDiff, DrawY, CursorOuterWidth, Size);
|
||||
aCursorQuads[1] = IGraphics::CQuadItem(SelX, DrawY + CursorOuterInnerDiff, CursorInnerWidth, Size - CursorOuterInnerDiff * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1483,8 +1483,8 @@ public:
|
|||
if((int)CharacterCounter == pCursor->m_CursorCharacter)
|
||||
{
|
||||
HasCursor = true;
|
||||
CursorQuads[0] = IGraphics::CQuadItem((LastSelX + LastSelWidth) - CursorOuterInnerDiff, DrawY, CursorOuterWidth, Size);
|
||||
CursorQuads[1] = IGraphics::CQuadItem((LastSelX + LastSelWidth), DrawY + CursorOuterInnerDiff, CursorInnerWidth, Size - CursorOuterInnerDiff * 2);
|
||||
aCursorQuads[0] = IGraphics::CQuadItem((LastSelX + LastSelWidth) - CursorOuterInnerDiff, DrawY, CursorOuterWidth, Size);
|
||||
aCursorQuads[1] = IGraphics::CQuadItem((LastSelX + LastSelWidth), DrawY + CursorOuterInnerDiff, CursorInnerWidth, Size - CursorOuterInnerDiff * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1495,7 +1495,7 @@ public:
|
|||
if(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex == -1)
|
||||
TextContainer.m_StringInfo.m_SelectionQuadContainerIndex = Graphics()->CreateQuadContainer(false);
|
||||
if(HasCursor)
|
||||
Graphics()->QuadContainerAddQuads(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, CursorQuads, 2);
|
||||
Graphics()->QuadContainerAddQuads(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, aCursorQuads, 2);
|
||||
if(HasSelection)
|
||||
Graphics()->QuadContainerAddQuads(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, &vSelectionQuads[0], (int)vSelectionQuads.size());
|
||||
Graphics()->QuadContainerUpload(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex);
|
||||
|
@ -1591,12 +1591,12 @@ public:
|
|||
{
|
||||
Graphics()->TextureClear();
|
||||
// render buffered text
|
||||
Graphics()->RenderText(TextContainer.m_StringInfo.m_QuadBufferContainerIndex, TextContainer.m_StringInfo.m_QuadNum, pFont->m_CurTextureDimensions[0], pFont->m_aTextures[0].Id(), pFont->m_aTextures[1].Id(), TextColor, TextOutlineColor);
|
||||
Graphics()->RenderText(TextContainer.m_StringInfo.m_QuadBufferContainerIndex, TextContainer.m_StringInfo.m_QuadNum, pFont->m_aCurTextureDimensions[0], pFont->m_aTextures[0].Id(), pFont->m_aTextures[1].Id(), TextColor, TextOutlineColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
// render tiles
|
||||
float UVScale = 1.0f / pFont->m_CurTextureDimensions[0];
|
||||
float UVScale = 1.0f / pFont->m_aCurTextureDimensions[0];
|
||||
|
||||
Graphics()->FlushVertices();
|
||||
Graphics()->TextureSet(pFont->m_aTextures[1]);
|
||||
|
@ -1607,10 +1607,10 @@ public:
|
|||
{
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_vCharacterQuads[i];
|
||||
|
||||
Graphics()->SetColor(TextCharQuad.m_Vertices[0].m_Color.r / 255.f * TextOutlineColor.r, TextCharQuad.m_Vertices[0].m_Color.g / 255.f * TextOutlineColor.g, TextCharQuad.m_Vertices[0].m_Color.b / 255.f * TextOutlineColor.b, TextCharQuad.m_Vertices[0].m_Color.a / 255.f * TextOutlineColor.a);
|
||||
Graphics()->SetColor(TextCharQuad.m_aVertices[0].m_Color.r / 255.f * TextOutlineColor.r, TextCharQuad.m_aVertices[0].m_Color.g / 255.f * TextOutlineColor.g, TextCharQuad.m_aVertices[0].m_Color.b / 255.f * TextOutlineColor.b, TextCharQuad.m_aVertices[0].m_Color.a / 255.f * TextOutlineColor.a);
|
||||
|
||||
Graphics()->QuadsSetSubset(TextCharQuad.m_Vertices[0].m_U * UVScale, TextCharQuad.m_Vertices[0].m_V * UVScale, TextCharQuad.m_Vertices[2].m_U * UVScale, TextCharQuad.m_Vertices[2].m_V * UVScale);
|
||||
IGraphics::CQuadItem QuadItem(TextCharQuad.m_Vertices[0].m_X, TextCharQuad.m_Vertices[0].m_Y, TextCharQuad.m_Vertices[1].m_X - TextCharQuad.m_Vertices[0].m_X, TextCharQuad.m_Vertices[2].m_Y - TextCharQuad.m_Vertices[0].m_Y);
|
||||
Graphics()->QuadsSetSubset(TextCharQuad.m_aVertices[0].m_U * UVScale, TextCharQuad.m_aVertices[0].m_V * UVScale, TextCharQuad.m_aVertices[2].m_U * UVScale, TextCharQuad.m_aVertices[2].m_V * UVScale);
|
||||
IGraphics::CQuadItem QuadItem(TextCharQuad.m_aVertices[0].m_X, TextCharQuad.m_aVertices[0].m_Y, TextCharQuad.m_aVertices[1].m_X - TextCharQuad.m_aVertices[0].m_X, TextCharQuad.m_aVertices[2].m_Y - TextCharQuad.m_aVertices[0].m_Y);
|
||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||
}
|
||||
|
||||
|
@ -1623,10 +1623,10 @@ public:
|
|||
for(size_t i = 0; i < TextContainer.m_StringInfo.m_QuadNum; ++i)
|
||||
{
|
||||
STextCharQuad &TextCharQuad = TextContainer.m_StringInfo.m_vCharacterQuads[i];
|
||||
unsigned char CR = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.r) * TextColor.r);
|
||||
unsigned char CG = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.g) * TextColor.g);
|
||||
unsigned char CB = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.b) * TextColor.b);
|
||||
unsigned char CA = (unsigned char)((float)(TextCharQuad.m_Vertices[0].m_Color.a) * TextColor.a);
|
||||
unsigned char CR = (unsigned char)((float)(TextCharQuad.m_aVertices[0].m_Color.r) * TextColor.r);
|
||||
unsigned char CG = (unsigned char)((float)(TextCharQuad.m_aVertices[0].m_Color.g) * TextColor.g);
|
||||
unsigned char CB = (unsigned char)((float)(TextCharQuad.m_aVertices[0].m_Color.b) * TextColor.b);
|
||||
unsigned char CA = (unsigned char)((float)(TextCharQuad.m_aVertices[0].m_Color.a) * TextColor.a);
|
||||
Graphics()->ChangeColorOfQuadVertices((int)i, CR, CG, CB, CA);
|
||||
}
|
||||
|
||||
|
@ -1953,11 +1953,11 @@ public:
|
|||
// reset the skylines
|
||||
for(int j = 0; j < 2; ++j)
|
||||
{
|
||||
for(int &k : pFont->m_TextureSkyline[j].m_vCurHeightOfPixelColumn)
|
||||
for(int &k : pFont->m_aTextureSkyline[j].m_vCurHeightOfPixelColumn)
|
||||
k = 0;
|
||||
|
||||
mem_zero(pFont->m_TextureData[j], (size_t)pFont->m_CurTextureDimensions[j] * pFont->m_CurTextureDimensions[j] * sizeof(unsigned char));
|
||||
Graphics()->UpdateTextTexture(pFont->m_aTextures[j], 0, 0, pFont->m_CurTextureDimensions[j], pFont->m_CurTextureDimensions[j], pFont->m_TextureData[j]);
|
||||
mem_zero(pFont->m_apTextureData[j], (size_t)pFont->m_aCurTextureDimensions[j] * pFont->m_aCurTextureDimensions[j] * sizeof(unsigned char));
|
||||
Graphics()->UpdateTextTexture(pFont->m_aTextures[j], 0, 0, pFont->m_aCurTextureDimensions[j], pFont->m_aCurTextureDimensions[j], pFont->m_apTextureData[j]);
|
||||
}
|
||||
|
||||
pFont->InitFontSizes();
|
||||
|
|
|
@ -62,19 +62,19 @@ int CUpdaterFetchTask::OnCompletion(int State)
|
|||
{
|
||||
State = CHttpRequest::OnCompletion(State);
|
||||
|
||||
const char *b = 0;
|
||||
for(const char *a = Dest(); *a; a++)
|
||||
if(*a == '/')
|
||||
b = a + 1;
|
||||
b = b ? b : Dest();
|
||||
if(!str_comp(b, "update.json"))
|
||||
const char *pFileName = 0;
|
||||
for(const char *pPath = Dest(); *pPath; pPath++)
|
||||
if(*pPath == '/')
|
||||
pFileName = pPath + 1;
|
||||
pFileName = pFileName ? pFileName : Dest();
|
||||
if(!str_comp(pFileName, "update.json"))
|
||||
{
|
||||
if(State == HTTP_DONE)
|
||||
m_pUpdater->SetCurrentState(IUpdater::GOT_MANIFEST);
|
||||
else if(State == HTTP_ERROR)
|
||||
m_pUpdater->SetCurrentState(IUpdater::FAIL);
|
||||
}
|
||||
else if(!str_comp(b, m_pUpdater->m_aLastFile))
|
||||
else if(!str_comp(pFileName, m_pUpdater->m_aLastFile))
|
||||
{
|
||||
if(State == HTTP_DONE)
|
||||
m_pUpdater->SetCurrentState(IUpdater::MOVE_FILES);
|
||||
|
|
|
@ -45,7 +45,7 @@ CVideo::CVideo(CGraphics_Threaded *pGraphics, ISound *pSound, IStorage *pStorage
|
|||
|
||||
m_Width = Width;
|
||||
m_Height = Height;
|
||||
str_copy(m_Name, pName, sizeof(m_Name));
|
||||
str_copy(m_aName, pName, sizeof(m_aName));
|
||||
|
||||
m_FPS = g_Config.m_ClVideoRecorderFPS;
|
||||
|
||||
|
@ -80,8 +80,8 @@ void CVideo::Start()
|
|||
char aDate[20];
|
||||
str_timestamp(aDate, sizeof(aDate));
|
||||
char aBuf[256];
|
||||
if(str_length(m_Name) != 0)
|
||||
str_format(aBuf, sizeof(aBuf), "videos/%s", m_Name);
|
||||
if(str_length(m_aName) != 0)
|
||||
str_format(aBuf, sizeof(aBuf), "videos/%s", m_aName);
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "videos/%s.mp4", aDate);
|
||||
|
||||
|
@ -569,9 +569,9 @@ void CVideo::RunVideoThread(size_t ParentThreadIndex, size_t ThreadIndex)
|
|||
|
||||
void CVideo::FillVideoFrame(size_t ThreadIndex)
|
||||
{
|
||||
const int InLinesize[1] = {4 * m_VideoStream.pEnc->width};
|
||||
const int InLineSize = 4 * m_VideoStream.pEnc->width;
|
||||
auto *pRGBAData = m_vPixelHelper[ThreadIndex].data();
|
||||
sws_scale(m_VideoStream.m_vpSwsCtxs[ThreadIndex], (const uint8_t *const *)&pRGBAData, InLinesize, 0,
|
||||
sws_scale(m_VideoStream.m_vpSwsCtxs[ThreadIndex], (const uint8_t *const *)&pRGBAData, &InLineSize, 0,
|
||||
m_VideoStream.pEnc->height, m_VideoStream.m_vpFrames[ThreadIndex]->data, m_VideoStream.m_vpFrames[ThreadIndex]->linesize);
|
||||
}
|
||||
|
||||
|
@ -609,23 +609,23 @@ AVFrame *CVideo::AllocPicture(enum AVPixelFormat PixFmt, int Width, int Height)
|
|||
|
||||
AVFrame *CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t ChannelLayout, int SampleRate, int NbSamples)
|
||||
{
|
||||
AVFrame *Frame = av_frame_alloc();
|
||||
AVFrame *pFrame = av_frame_alloc();
|
||||
int Ret;
|
||||
|
||||
if(!Frame)
|
||||
if(!pFrame)
|
||||
{
|
||||
dbg_msg("video_recorder", "Error allocating an audio frame");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Frame->format = SampleFmt;
|
||||
Frame->channel_layout = ChannelLayout;
|
||||
Frame->sample_rate = SampleRate;
|
||||
Frame->nb_samples = NbSamples;
|
||||
pFrame->format = SampleFmt;
|
||||
pFrame->channel_layout = ChannelLayout;
|
||||
pFrame->sample_rate = SampleRate;
|
||||
pFrame->nb_samples = NbSamples;
|
||||
|
||||
if(NbSamples)
|
||||
{
|
||||
Ret = av_frame_get_buffer(Frame, 0);
|
||||
Ret = av_frame_get_buffer(pFrame, 0);
|
||||
if(Ret < 0)
|
||||
{
|
||||
dbg_msg("video_recorder", "Error allocating an audio buffer");
|
||||
|
@ -633,20 +633,20 @@ AVFrame *CVideo::AllocAudioFrame(enum AVSampleFormat SampleFmt, uint64_t Channel
|
|||
}
|
||||
}
|
||||
|
||||
return Frame;
|
||||
return pFrame;
|
||||
}
|
||||
|
||||
bool CVideo::OpenVideo()
|
||||
{
|
||||
int Ret;
|
||||
AVCodecContext *c = m_VideoStream.pEnc;
|
||||
AVDictionary *opt = 0;
|
||||
AVCodecContext *pContext = m_VideoStream.pEnc;
|
||||
AVDictionary *pOptions = 0;
|
||||
|
||||
av_dict_copy(&opt, m_pOptDict, 0);
|
||||
av_dict_copy(&pOptions, m_pOptDict, 0);
|
||||
|
||||
/* open the codec */
|
||||
Ret = avcodec_open2(c, m_pVideoCodec, &opt);
|
||||
av_dict_free(&opt);
|
||||
Ret = avcodec_open2(pContext, m_pVideoCodec, &pOptions);
|
||||
av_dict_free(&pOptions);
|
||||
if(Ret < 0)
|
||||
{
|
||||
char aBuf[AV_ERROR_MAX_STRING_SIZE];
|
||||
|
@ -662,7 +662,7 @@ bool CVideo::OpenVideo()
|
|||
for(size_t i = 0; i < m_VideoThreads; ++i)
|
||||
{
|
||||
m_VideoStream.m_vpFrames.emplace_back(nullptr);
|
||||
m_VideoStream.m_vpFrames[i] = AllocPicture(c->pix_fmt, c->width, c->height);
|
||||
m_VideoStream.m_vpFrames[i] = AllocPicture(pContext->pix_fmt, pContext->width, pContext->height);
|
||||
if(!m_VideoStream.m_vpFrames[i])
|
||||
{
|
||||
dbg_msg("video_recorder", "Could not allocate video frame");
|
||||
|
@ -676,13 +676,13 @@ bool CVideo::OpenVideo()
|
|||
m_VideoStream.m_vpTmpFrames.clear();
|
||||
m_VideoStream.m_vpTmpFrames.reserve(m_VideoThreads);
|
||||
|
||||
if(c->pix_fmt != AV_PIX_FMT_YUV420P)
|
||||
if(pContext->pix_fmt != AV_PIX_FMT_YUV420P)
|
||||
{
|
||||
/* allocate and init a re-usable frame */
|
||||
for(size_t i = 0; i < m_VideoThreads; ++i)
|
||||
{
|
||||
m_VideoStream.m_vpTmpFrames.emplace_back(nullptr);
|
||||
m_VideoStream.m_vpTmpFrames[i] = AllocPicture(AV_PIX_FMT_YUV420P, c->width, c->height);
|
||||
m_VideoStream.m_vpTmpFrames[i] = AllocPicture(AV_PIX_FMT_YUV420P, pContext->width, pContext->height);
|
||||
if(!m_VideoStream.m_vpTmpFrames[i])
|
||||
{
|
||||
dbg_msg("video_recorder", "Could not allocate temporary video frame");
|
||||
|
@ -692,7 +692,7 @@ bool CVideo::OpenVideo()
|
|||
}
|
||||
|
||||
/* copy the stream parameters to the muxer */
|
||||
Ret = avcodec_parameters_from_context(m_VideoStream.pSt->codecpar, c);
|
||||
Ret = avcodec_parameters_from_context(m_VideoStream.pSt->codecpar, pContext);
|
||||
if(Ret < 0)
|
||||
{
|
||||
dbg_msg("video_recorder", "Could not copy the stream parameters");
|
||||
|
@ -704,18 +704,18 @@ bool CVideo::OpenVideo()
|
|||
|
||||
bool CVideo::OpenAudio()
|
||||
{
|
||||
AVCodecContext *c;
|
||||
AVCodecContext *pContext;
|
||||
int NbSamples;
|
||||
int Ret;
|
||||
AVDictionary *opt = NULL;
|
||||
AVDictionary *pOptions = NULL;
|
||||
|
||||
c = m_AudioStream.pEnc;
|
||||
pContext = m_AudioStream.pEnc;
|
||||
|
||||
/* open it */
|
||||
//m_dbgfile = fopen("/tmp/pcm_dbg", "wb");
|
||||
av_dict_copy(&opt, m_pOptDict, 0);
|
||||
Ret = avcodec_open2(c, m_pAudioCodec, &opt);
|
||||
av_dict_free(&opt);
|
||||
av_dict_copy(&pOptions, m_pOptDict, 0);
|
||||
Ret = avcodec_open2(pContext, m_pAudioCodec, &pOptions);
|
||||
av_dict_free(&pOptions);
|
||||
if(Ret < 0)
|
||||
{
|
||||
char aBuf[AV_ERROR_MAX_STRING_SIZE];
|
||||
|
@ -724,10 +724,10 @@ bool CVideo::OpenAudio()
|
|||
return false;
|
||||
}
|
||||
|
||||
if(c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
|
||||
if(pContext->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
|
||||
NbSamples = 10000;
|
||||
else
|
||||
NbSamples = c->frame_size;
|
||||
NbSamples = pContext->frame_size;
|
||||
|
||||
m_AudioStream.m_vpFrames.clear();
|
||||
m_AudioStream.m_vpFrames.reserve(m_AudioThreads);
|
||||
|
@ -739,7 +739,7 @@ bool CVideo::OpenAudio()
|
|||
for(size_t i = 0; i < m_AudioThreads; ++i)
|
||||
{
|
||||
m_AudioStream.m_vpFrames.emplace_back(nullptr);
|
||||
m_AudioStream.m_vpFrames[i] = AllocAudioFrame(c->sample_fmt, c->channel_layout, c->sample_rate, NbSamples);
|
||||
m_AudioStream.m_vpFrames[i] = AllocAudioFrame(pContext->sample_fmt, pContext->channel_layout, pContext->sample_rate, NbSamples);
|
||||
if(!m_AudioStream.m_vpFrames[i])
|
||||
{
|
||||
dbg_msg("video_recorder", "Could not allocate audio frame");
|
||||
|
@ -756,7 +756,7 @@ bool CVideo::OpenAudio()
|
|||
}
|
||||
|
||||
/* copy the stream parameters to the muxer */
|
||||
Ret = avcodec_parameters_from_context(m_AudioStream.pSt->codecpar, c);
|
||||
Ret = avcodec_parameters_from_context(m_AudioStream.pSt->codecpar, pContext);
|
||||
if(Ret < 0)
|
||||
{
|
||||
dbg_msg("video_recorder", "Could not copy the stream parameters");
|
||||
|
@ -779,9 +779,9 @@ bool CVideo::OpenAudio()
|
|||
av_opt_set_int(m_AudioStream.m_vpSwrCtxs[i], "in_channel_count", 2, 0);
|
||||
av_opt_set_int(m_AudioStream.m_vpSwrCtxs[i], "in_sample_rate", g_Config.m_SndRate, 0);
|
||||
av_opt_set_sample_fmt(m_AudioStream.m_vpSwrCtxs[i], "in_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
||||
av_opt_set_int(m_AudioStream.m_vpSwrCtxs[i], "out_channel_count", c->channels, 0);
|
||||
av_opt_set_int(m_AudioStream.m_vpSwrCtxs[i], "out_sample_rate", c->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(m_AudioStream.m_vpSwrCtxs[i], "out_sample_fmt", c->sample_fmt, 0);
|
||||
av_opt_set_int(m_AudioStream.m_vpSwrCtxs[i], "out_channel_count", pContext->channels, 0);
|
||||
av_opt_set_int(m_AudioStream.m_vpSwrCtxs[i], "out_sample_rate", pContext->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(m_AudioStream.m_vpSwrCtxs[i], "out_sample_fmt", pContext->sample_fmt, 0);
|
||||
|
||||
/* initialize the resampling context */
|
||||
if(swr_init(m_AudioStream.m_vpSwrCtxs[i]) < 0)
|
||||
|
@ -798,7 +798,7 @@ bool CVideo::OpenAudio()
|
|||
/* Add an output stream. */
|
||||
bool CVideo::AddStream(OutputStream *pStream, AVFormatContext *pOC, const AVCodec **ppCodec, enum AVCodecID CodecId)
|
||||
{
|
||||
AVCodecContext *c;
|
||||
AVCodecContext *pContext;
|
||||
|
||||
/* find the encoder */
|
||||
*ppCodec = avcodec_find_encoder(CodecId);
|
||||
|
@ -816,13 +816,13 @@ bool CVideo::AddStream(OutputStream *pStream, AVFormatContext *pOC, const AVCode
|
|||
return false;
|
||||
}
|
||||
pStream->pSt->id = pOC->nb_streams - 1;
|
||||
c = avcodec_alloc_context3(*ppCodec);
|
||||
if(!c)
|
||||
pContext = avcodec_alloc_context3(*ppCodec);
|
||||
if(!pContext)
|
||||
{
|
||||
dbg_msg("video_recorder", "Could not alloc an encoding context");
|
||||
return false;
|
||||
}
|
||||
pStream->pEnc = c;
|
||||
pStream->pEnc = pContext;
|
||||
|
||||
#if defined(CONF_ARCH_IA32) || defined(CONF_ARCH_ARM)
|
||||
// use only 1 ffmpeg thread on 32-bit to save memory
|
||||
|
@ -832,62 +832,62 @@ bool CVideo::AddStream(OutputStream *pStream, AVFormatContext *pOC, const AVCode
|
|||
switch((*ppCodec)->type)
|
||||
{
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
c->sample_fmt = (*ppCodec)->sample_fmts ? (*ppCodec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||
c->bit_rate = g_Config.m_SndRate * 2 * 16;
|
||||
c->sample_rate = g_Config.m_SndRate;
|
||||
pContext->sample_fmt = (*ppCodec)->sample_fmts ? (*ppCodec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||
pContext->bit_rate = g_Config.m_SndRate * 2 * 16;
|
||||
pContext->sample_rate = g_Config.m_SndRate;
|
||||
if((*ppCodec)->supported_samplerates)
|
||||
{
|
||||
c->sample_rate = (*ppCodec)->supported_samplerates[0];
|
||||
pContext->sample_rate = (*ppCodec)->supported_samplerates[0];
|
||||
for(int i = 0; (*ppCodec)->supported_samplerates[i]; i++)
|
||||
{
|
||||
if((*ppCodec)->supported_samplerates[i] == g_Config.m_SndRate)
|
||||
{
|
||||
c->sample_rate = g_Config.m_SndRate;
|
||||
pContext->sample_rate = g_Config.m_SndRate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
c->channels = 2;
|
||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
pContext->channels = 2;
|
||||
pContext->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
pStream->pSt->time_base.num = 1;
|
||||
pStream->pSt->time_base.den = c->sample_rate;
|
||||
pStream->pSt->time_base.den = pContext->sample_rate;
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
c->codec_id = CodecId;
|
||||
pContext->codec_id = CodecId;
|
||||
|
||||
c->bit_rate = 400000;
|
||||
pContext->bit_rate = 400000;
|
||||
/* Resolution must be a multiple of two. */
|
||||
c->width = m_Width;
|
||||
c->height = m_Height % 2 == 0 ? m_Height : m_Height - 1;
|
||||
pContext->width = m_Width;
|
||||
pContext->height = m_Height % 2 == 0 ? m_Height : m_Height - 1;
|
||||
/* timebase: This is the fundamental unit of time (in seconds) in terms
|
||||
* of which frame timestamps are represented. For fixed-fps content,
|
||||
* timebase should be 1/framerate and timestamp increments should be
|
||||
* identical to 1. */
|
||||
pStream->pSt->time_base.num = 1;
|
||||
pStream->pSt->time_base.den = m_FPS;
|
||||
c->time_base = pStream->pSt->time_base;
|
||||
pContext->time_base = pStream->pSt->time_base;
|
||||
|
||||
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
||||
c->pix_fmt = STREAM_PIX_FMT;
|
||||
if(c->codec_id == AV_CODEC_ID_MPEG2VIDEO)
|
||||
pContext->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
||||
pContext->pix_fmt = STREAM_PIX_FMT;
|
||||
if(pContext->codec_id == AV_CODEC_ID_MPEG2VIDEO)
|
||||
{
|
||||
/* just for testing, we also add B-frames */
|
||||
c->max_b_frames = 2;
|
||||
pContext->max_b_frames = 2;
|
||||
}
|
||||
if(c->codec_id == AV_CODEC_ID_MPEG1VIDEO)
|
||||
if(pContext->codec_id == AV_CODEC_ID_MPEG1VIDEO)
|
||||
{
|
||||
/* Needed to avoid using macroblocks in which some coeffs overflow.
|
||||
* This does not happen with normal video, it just happens here as
|
||||
* the motion of the chroma plane does not match the luma plane. */
|
||||
c->mb_decision = 2;
|
||||
pContext->mb_decision = 2;
|
||||
}
|
||||
if(CodecId == AV_CODEC_ID_H264)
|
||||
{
|
||||
const char *presets[10] = {"ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"};
|
||||
av_opt_set(c->priv_data, "preset", presets[g_Config.m_ClVideoX264Preset], 0);
|
||||
av_opt_set_int(c->priv_data, "crf", g_Config.m_ClVideoX264Crf, 0);
|
||||
static const char *s_apPresets[10] = {"ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"};
|
||||
av_opt_set(pContext->priv_data, "preset", s_apPresets[g_Config.m_ClVideoX264Preset], 0);
|
||||
av_opt_set_int(pContext->priv_data, "crf", g_Config.m_ClVideoX264Crf, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -897,7 +897,7 @@ bool CVideo::AddStream(OutputStream *pStream, AVFormatContext *pOC, const AVCode
|
|||
|
||||
/* Some formats want stream headers to be separate. */
|
||||
if(pOC->oformat->flags & AVFMT_GLOBALHEADER)
|
||||
c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
pContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ private:
|
|||
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
char m_Name[256];
|
||||
char m_aName[256];
|
||||
//FILE *m_dbgfile;
|
||||
uint64_t m_VSeq = 0;
|
||||
uint64_t m_ASeq = 0;
|
||||
|
|
|
@ -100,8 +100,8 @@ public:
|
|||
virtual void StoreCommands(bool Store) = 0;
|
||||
|
||||
virtual bool LineIsValid(const char *pStr) = 0;
|
||||
virtual void ExecuteLine(const char *Sptr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||
virtual void ExecuteLineFlag(const char *Sptr, int FlasgMask, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||
virtual void ExecuteLine(const char *pStr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||
virtual void ExecuteLineFlag(const char *pStr, int FlasgMask, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||
virtual void ExecuteLineStroked(int Stroke, const char *pStr, int ClientID = -1, bool InterpretSemicolons = true) = 0;
|
||||
virtual void ExecuteFile(const char *pFilename, int ClientID = -1, bool LogFailure = false, int StorageType = IStorage::TYPE_ALL) = 0;
|
||||
|
||||
|
|
|
@ -149,52 +149,52 @@ static void SampleBicubic(const uint8_t *pSourceImage, float u, float v, uint32_
|
|||
int yInt = (int)Y;
|
||||
float yFract = Y - floorf(Y);
|
||||
|
||||
uint8_t PX00[4];
|
||||
uint8_t PX10[4];
|
||||
uint8_t PX20[4];
|
||||
uint8_t PX30[4];
|
||||
uint8_t aPX00[4];
|
||||
uint8_t aPX10[4];
|
||||
uint8_t aPX20[4];
|
||||
uint8_t aPX30[4];
|
||||
|
||||
uint8_t PX01[4];
|
||||
uint8_t PX11[4];
|
||||
uint8_t PX21[4];
|
||||
uint8_t PX31[4];
|
||||
uint8_t aPX01[4];
|
||||
uint8_t aPX11[4];
|
||||
uint8_t aPX21[4];
|
||||
uint8_t aPX31[4];
|
||||
|
||||
uint8_t PX02[4];
|
||||
uint8_t PX12[4];
|
||||
uint8_t PX22[4];
|
||||
uint8_t PX32[4];
|
||||
uint8_t aPX02[4];
|
||||
uint8_t aPX12[4];
|
||||
uint8_t aPX22[4];
|
||||
uint8_t aPX32[4];
|
||||
|
||||
uint8_t PX03[4];
|
||||
uint8_t PX13[4];
|
||||
uint8_t PX23[4];
|
||||
uint8_t PX33[4];
|
||||
uint8_t aPX03[4];
|
||||
uint8_t aPX13[4];
|
||||
uint8_t aPX23[4];
|
||||
uint8_t aPX33[4];
|
||||
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt - 1, W, H, BPP, PX00);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt - 1, W, H, BPP, PX10);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt - 1, W, H, BPP, PX20);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt - 1, W, H, BPP, PX30);
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt - 1, W, H, BPP, aPX00);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt - 1, W, H, BPP, aPX10);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt - 1, W, H, BPP, aPX20);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt - 1, W, H, BPP, aPX30);
|
||||
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt + 0, W, H, BPP, PX01);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt + 0, W, H, BPP, PX11);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt + 0, W, H, BPP, PX21);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt + 0, W, H, BPP, PX31);
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt + 0, W, H, BPP, aPX01);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt + 0, W, H, BPP, aPX11);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt + 0, W, H, BPP, aPX21);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt + 0, W, H, BPP, aPX31);
|
||||
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt + 1, W, H, BPP, PX02);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt + 1, W, H, BPP, PX12);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt + 1, W, H, BPP, PX22);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt + 1, W, H, BPP, PX32);
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt + 1, W, H, BPP, aPX02);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt + 1, W, H, BPP, aPX12);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt + 1, W, H, BPP, aPX22);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt + 1, W, H, BPP, aPX32);
|
||||
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt + 2, W, H, BPP, PX03);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt + 2, W, H, BPP, PX13);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt + 2, W, H, BPP, PX23);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt + 2, W, H, BPP, PX33);
|
||||
GetPixelClamped(pSourceImage, xInt - 1, yInt + 2, W, H, BPP, aPX03);
|
||||
GetPixelClamped(pSourceImage, xInt + 0, yInt + 2, W, H, BPP, aPX13);
|
||||
GetPixelClamped(pSourceImage, xInt + 1, yInt + 2, W, H, BPP, aPX23);
|
||||
GetPixelClamped(pSourceImage, xInt + 2, yInt + 2, W, H, BPP, aPX33);
|
||||
|
||||
for(size_t i = 0; i < BPP; i++)
|
||||
{
|
||||
float Clmn0 = CubicHermite(PX00[i], PX10[i], PX20[i], PX30[i], xFract);
|
||||
float Clmn1 = CubicHermite(PX01[i], PX11[i], PX21[i], PX31[i], xFract);
|
||||
float Clmn2 = CubicHermite(PX02[i], PX12[i], PX22[i], PX32[i], xFract);
|
||||
float Clmn3 = CubicHermite(PX03[i], PX13[i], PX23[i], PX33[i], xFract);
|
||||
float Clmn0 = CubicHermite(aPX00[i], aPX10[i], aPX20[i], aPX30[i], xFract);
|
||||
float Clmn1 = CubicHermite(aPX01[i], aPX11[i], aPX21[i], aPX31[i], xFract);
|
||||
float Clmn2 = CubicHermite(aPX02[i], aPX12[i], aPX22[i], aPX32[i], xFract);
|
||||
float Clmn3 = CubicHermite(aPX03[i], aPX13[i], aPX23[i], aPX33[i], xFract);
|
||||
|
||||
float Valuef = CubicHermite(Clmn0, Clmn1, Clmn2, Clmn3, yFract);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ struct STWGraphicGPU
|
|||
|
||||
struct STWGraphicGPUItem
|
||||
{
|
||||
char m_Name[256];
|
||||
char m_aName[256];
|
||||
ETWGraphicsGPUType m_GPUType;
|
||||
};
|
||||
std::vector<STWGraphicGPUItem> m_vGPUs;
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
virtual void FlushVerticesTex3D() = 0;
|
||||
|
||||
// specific render functions
|
||||
virtual void RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *IndicedVertexDrawNum, size_t NumIndicesOffset) = 0;
|
||||
virtual void RenderTileLayer(int BufferContainerIndex, const ColorRGBA &Color, char **pOffsets, unsigned int *pIndicedVertexDrawNum, size_t NumIndicesOffset) = 0;
|
||||
virtual void RenderBorderTiles(int BufferContainerIndex, const ColorRGBA &Color, char *pIndexBufferOffset, const vec2 &Offset, const vec2 &Dir, int JumpIndex, unsigned int DrawNum) = 0;
|
||||
virtual void RenderBorderTileLines(int BufferContainerIndex, const ColorRGBA &Color, char *pIndexBufferOffset, const vec2 &Offset, const vec2 &Dir, unsigned int IndexDrawNum, unsigned int RedrawNum) = 0;
|
||||
virtual void RenderQuadLayer(int BufferContainerIndex, SQuadRenderInfo *pQuadInfo, int QuadNum, int QuadOffset) = 0;
|
||||
|
|
|
@ -34,9 +34,9 @@ private:
|
|||
class IKernel
|
||||
{
|
||||
// hide the implementation
|
||||
virtual bool RegisterInterfaceImpl(const char *InterfaceName, IInterface *pInterface, bool Destroy) = 0;
|
||||
virtual bool ReregisterInterfaceImpl(const char *InterfaceName, IInterface *pInterface) = 0;
|
||||
virtual IInterface *RequestInterfaceImpl(const char *InterfaceName) = 0;
|
||||
virtual bool RegisterInterfaceImpl(const char *pInterfaceName, IInterface *pInterface, bool Destroy) = 0;
|
||||
virtual bool ReregisterInterfaceImpl(const char *pInterfaceName, IInterface *pInterface) = 0;
|
||||
virtual IInterface *RequestInterfaceImpl(const char *pInterfaceName) = 0;
|
||||
|
||||
public:
|
||||
static IKernel *Create();
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual int GetDataSize(int Index) = 0;
|
||||
virtual void *GetDataSwapped(int Index) = 0;
|
||||
virtual void UnloadData(int Index) = 0;
|
||||
virtual void *GetItem(int Index, int *Type, int *pID) = 0;
|
||||
virtual void *GetItem(int Index, int *pType, int *pID) = 0;
|
||||
virtual int GetItemSize(int Index) = 0;
|
||||
virtual void GetType(int Type, int *pStart, int *pNum) = 0;
|
||||
virtual void *FindItem(int Type, int ID) = 0;
|
||||
|
|
|
@ -112,14 +112,13 @@ public:
|
|||
return Translate(pMsg->m_ClientID, ClientID) && SendPackMsgOne(pMsg, Flags, ClientID);
|
||||
}
|
||||
|
||||
char msgbuf[1000];
|
||||
|
||||
int SendPackMsgTranslate(CNetMsg_Sv_Chat *pMsg, int Flags, int ClientID)
|
||||
{
|
||||
char aBuf[1000];
|
||||
if(pMsg->m_ClientID >= 0 && !Translate(pMsg->m_ClientID, ClientID))
|
||||
{
|
||||
str_format(msgbuf, sizeof(msgbuf), "%s: %s", ClientName(pMsg->m_ClientID), pMsg->m_pMessage);
|
||||
pMsg->m_pMessage = msgbuf;
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %s", ClientName(pMsg->m_ClientID), pMsg->m_pMessage);
|
||||
pMsg->m_pMessage = aBuf;
|
||||
pMsg->m_ClientID = VANILLA_MAX_CLIENTS - 1;
|
||||
}
|
||||
|
||||
|
@ -243,7 +242,7 @@ public:
|
|||
virtual bool DnsblWhite(int ClientID) = 0;
|
||||
virtual bool DnsblPending(int ClientID) = 0;
|
||||
virtual bool DnsblBlack(int ClientID) = 0;
|
||||
virtual const char *GetAnnouncementLine(char const *FileName) = 0;
|
||||
virtual const char *GetAnnouncementLine(char const *pFileName) = 0;
|
||||
virtual bool ClientPrevIngame(int ClientID) = 0;
|
||||
virtual const char *GetNetErrorString(int ClientID) = 0;
|
||||
virtual void ResetNetErrorString(int ClientID) = 0;
|
||||
|
|
|
@ -152,11 +152,11 @@ void CAuthManager::AddDefaultKey(int Level, const char *pPw)
|
|||
if(Level < AUTHED_HELPER || Level > AUTHED_ADMIN)
|
||||
return;
|
||||
|
||||
static const char IDENTS[3][sizeof(HELPER_IDENT)] = {ADMIN_IDENT, MOD_IDENT, HELPER_IDENT};
|
||||
static const char s_aaIdents[3][sizeof(HELPER_IDENT)] = {ADMIN_IDENT, MOD_IDENT, HELPER_IDENT};
|
||||
int Index = AUTHED_ADMIN - Level;
|
||||
if(m_aDefault[Index] >= 0)
|
||||
return; // already exists
|
||||
m_aDefault[Index] = AddKey(IDENTS[Index], pPw, Level);
|
||||
m_aDefault[Index] = AddKey(s_aaIdents[Index], pPw, Level);
|
||||
}
|
||||
|
||||
bool CAuthManager::IsGenerated() const
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
}
|
||||
virtual ~IDbConnection() {}
|
||||
IDbConnection &operator=(const IDbConnection &) = delete;
|
||||
virtual void Print(IConsole *pConsole, const char *Mode) = 0;
|
||||
virtual void Print(IConsole *pConsole, const char *pMode) = 0;
|
||||
|
||||
// copies the credentials, not the active connection
|
||||
virtual IDbConnection *Copy() = 0;
|
||||
|
|
|
@ -72,10 +72,10 @@ CDbConnectionPool::~CDbConnectionPool() = default;
|
|||
|
||||
void CDbConnectionPool::Print(IConsole *pConsole, Mode DatabaseMode)
|
||||
{
|
||||
const char *ModeDesc[] = {"Read", "Write", "WriteBackup"};
|
||||
static const char *s_apModeDesc[] = {"Read", "Write", "WriteBackup"};
|
||||
for(unsigned int i = 0; i < m_vvpDbConnections[DatabaseMode].size(); i++)
|
||||
{
|
||||
m_vvpDbConnections[DatabaseMode][i]->Print(pConsole, ModeDesc[DatabaseMode]);
|
||||
m_vvpDbConnections[DatabaseMode][i]->Print(pConsole, s_apModeDesc[DatabaseMode]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
int Port,
|
||||
bool Setup);
|
||||
~CMysqlConnection();
|
||||
void Print(IConsole *pConsole, const char *Mode) override;
|
||||
void Print(IConsole *pConsole, const char *pMode) override;
|
||||
|
||||
CMysqlConnection *Copy() override;
|
||||
|
||||
|
@ -206,12 +206,12 @@ bool CMysqlConnection::PrepareAndExecuteStatement(const char *pStmt)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CMysqlConnection::Print(IConsole *pConsole, const char *Mode)
|
||||
void CMysqlConnection::Print(IConsole *pConsole, const char *pMode)
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf),
|
||||
"MySQL-%s: DB: '%s' Prefix: '%s' User: '%s' IP: <{'%s'}> Port: %d",
|
||||
Mode, m_aDatabase, GetPrefix(), m_aUser, m_aIp, m_Port);
|
||||
pMode, m_aDatabase, GetPrefix(), m_aUser, m_aIp, m_Port);
|
||||
pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class CSqliteConnection : public IDbConnection
|
|||
public:
|
||||
CSqliteConnection(const char *pFilename, bool Setup);
|
||||
virtual ~CSqliteConnection();
|
||||
void Print(IConsole *pConsole, const char *Mode) override;
|
||||
void Print(IConsole *pConsole, const char *pMode) override;
|
||||
|
||||
CSqliteConnection *Copy() override;
|
||||
|
||||
|
@ -91,12 +91,12 @@ CSqliteConnection::~CSqliteConnection()
|
|||
m_pDb = nullptr;
|
||||
}
|
||||
|
||||
void CSqliteConnection::Print(IConsole *pConsole, const char *Mode)
|
||||
void CSqliteConnection::Print(IConsole *pConsole, const char *pMode)
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf),
|
||||
"SQLite-%s: DB: '%s'",
|
||||
Mode, m_aFilename);
|
||||
pMode, m_aFilename);
|
||||
pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -495,9 +495,9 @@ CRegister::CRegister(CConfig *pConfig, IConsole *pConsole, IEngine *pEngine, int
|
|||
m_aVerifyPacketPrefix[HEADER_LEN + UUID_MAXSTRSIZE - 1] = ':';
|
||||
|
||||
// The DDNet code uses the `unsigned` security token in memory byte order.
|
||||
unsigned char TokenBytes[4];
|
||||
mem_copy(TokenBytes, &SixupSecurityToken, sizeof(TokenBytes));
|
||||
str_format(m_aConnlessTokenHex, sizeof(m_aConnlessTokenHex), "%08x", bytes_be_to_uint(TokenBytes));
|
||||
unsigned char aTokenBytes[4];
|
||||
mem_copy(aTokenBytes, &SixupSecurityToken, sizeof(aTokenBytes));
|
||||
str_format(m_aConnlessTokenHex, sizeof(m_aConnlessTokenHex), "%08x", bytes_be_to_uint(aTokenBytes));
|
||||
|
||||
m_pConsole->Chain("sv_register", ConchainOnConfigChange, this);
|
||||
m_pConsole->Chain("sv_sixup", ConchainOnConfigChange, this);
|
||||
|
|
|
@ -16,24 +16,24 @@ void CUPnP::Open(NETADDR Address)
|
|||
{
|
||||
m_Enabled = false;
|
||||
m_Addr = Address;
|
||||
m_UPnPUrls = (struct UPNPUrls *)malloc(sizeof(struct UPNPUrls));
|
||||
m_UPnPData = (struct IGDdatas *)malloc(sizeof(struct IGDdatas));
|
||||
m_pUPnPUrls = (struct UPNPUrls *)malloc(sizeof(struct UPNPUrls));
|
||||
m_pUPnPData = (struct IGDdatas *)malloc(sizeof(struct IGDdatas));
|
||||
|
||||
char aLanAddr[64];
|
||||
char aPort[6];
|
||||
int Error;
|
||||
|
||||
m_UPnPDevice = upnpDiscover(2000, NULL, NULL, 0, 0, 2, &Error);
|
||||
m_pUPnPDevice = upnpDiscover(2000, NULL, NULL, 0, 0, 2, &Error);
|
||||
|
||||
int Status = UPNP_GetValidIGD(m_UPnPDevice, m_UPnPUrls, m_UPnPData, aLanAddr, sizeof(aLanAddr));
|
||||
int Status = UPNP_GetValidIGD(m_pUPnPDevice, m_pUPnPUrls, m_pUPnPData, aLanAddr, sizeof(aLanAddr));
|
||||
dbg_msg("upnp", "status=%d, lan_addr=%s", Status, aLanAddr);
|
||||
|
||||
if(Status == 1)
|
||||
{
|
||||
m_Enabled = true;
|
||||
dbg_msg("upnp", "found valid IGD: %s", m_UPnPUrls->controlURL);
|
||||
dbg_msg("upnp", "found valid IGD: %s", m_pUPnPUrls->controlURL);
|
||||
str_format(aPort, sizeof(aPort), "%d", m_Addr.port);
|
||||
Error = UPNP_AddPortMapping(m_UPnPUrls->controlURL, m_UPnPData->first.servicetype,
|
||||
Error = UPNP_AddPortMapping(m_pUPnPUrls->controlURL, m_pUPnPData->first.servicetype,
|
||||
aPort, aPort, aLanAddr,
|
||||
"DDNet Server " GAME_RELEASE_VERSION,
|
||||
"UDP", NULL, "0");
|
||||
|
@ -56,19 +56,19 @@ void CUPnP::Shutdown()
|
|||
{
|
||||
char aPort[6];
|
||||
str_format(aPort, sizeof(aPort), "%d", m_Addr.port);
|
||||
int Error = UPNP_DeletePortMapping(m_UPnPUrls->controlURL, m_UPnPData->first.servicetype, aPort, "UDP", NULL);
|
||||
int Error = UPNP_DeletePortMapping(m_pUPnPUrls->controlURL, m_pUPnPData->first.servicetype, aPort, "UDP", NULL);
|
||||
|
||||
if(Error != 0)
|
||||
{
|
||||
dbg_msg("upnp", "failed to delete port mapping on shutdown: %s", strupnperror(Error));
|
||||
}
|
||||
FreeUPNPUrls(m_UPnPUrls);
|
||||
freeUPNPDevlist(m_UPnPDevice);
|
||||
FreeUPNPUrls(m_pUPnPUrls);
|
||||
freeUPNPDevlist(m_pUPnPDevice);
|
||||
}
|
||||
free(m_UPnPUrls);
|
||||
free(m_UPnPData);
|
||||
m_UPnPUrls = NULL;
|
||||
m_UPnPData = NULL;
|
||||
free(m_pUPnPUrls);
|
||||
free(m_pUPnPData);
|
||||
m_pUPnPUrls = NULL;
|
||||
m_pUPnPData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
class CUPnP
|
||||
{
|
||||
NETADDR m_Addr;
|
||||
struct UPNPUrls *m_UPnPUrls;
|
||||
struct IGDdatas *m_UPnPData;
|
||||
struct UPNPDev *m_UPnPDevice;
|
||||
struct UPNPUrls *m_pUPnPUrls;
|
||||
struct IGDdatas *m_pUPnPData;
|
||||
struct UPNPDev *m_pUPnPDevice;
|
||||
bool m_Enabled;
|
||||
|
||||
public:
|
||||
|
|
|
@ -1021,8 +1021,8 @@ void CConsole::Init()
|
|||
|
||||
#define MACRO_CONFIG_STR(Name, ScriptName, Len, Def, Flags, Desc) \
|
||||
{ \
|
||||
static char OldValue[Len] = Def; \
|
||||
static CStrVariableData Data = {this, g_Config.m_##Name, Len, OldValue}; \
|
||||
static char s_aOldValue[Len] = Def; \
|
||||
static CStrVariableData Data = {this, g_Config.m_##Name, Len, s_aOldValue}; \
|
||||
Register(#ScriptName, "?r", Flags, StrVariableCommand, &Data, Desc " (default: " #Def ", max length: " #Len ")"); \
|
||||
}
|
||||
|
||||
|
|
|
@ -403,17 +403,17 @@ void *CDataFileReader::GetItem(int Index, int *pType, int *pID)
|
|||
return 0;
|
||||
}
|
||||
|
||||
CDatafileItem *i = (CDatafileItem *)(m_pDataFile->m_Info.m_pItemStart + m_pDataFile->m_Info.m_pItemOffsets[Index]);
|
||||
CDatafileItem *pItem = (CDatafileItem *)(m_pDataFile->m_Info.m_pItemStart + m_pDataFile->m_Info.m_pItemOffsets[Index]);
|
||||
if(pType)
|
||||
{
|
||||
// remove sign extension
|
||||
*pType = GetExternalItemType((i->m_TypeAndID >> 16) & 0xffff);
|
||||
*pType = GetExternalItemType((pItem->m_TypeAndID >> 16) & 0xffff);
|
||||
}
|
||||
if(pID)
|
||||
{
|
||||
*pID = i->m_TypeAndID & 0xffff;
|
||||
*pID = pItem->m_TypeAndID & 0xffff;
|
||||
}
|
||||
return (void *)(i + 1);
|
||||
return (void *)(pItem + 1);
|
||||
}
|
||||
|
||||
void CDataFileReader::GetType(int Type, int *pStart, int *pNum)
|
||||
|
|
|
@ -23,13 +23,13 @@ const CUuid SHA256_EXTENSION =
|
|||
{{0x6b, 0xe6, 0xda, 0x4a, 0xce, 0xbd, 0x38, 0x0c,
|
||||
0x9b, 0x5b, 0x12, 0x89, 0xc8, 0x42, 0xd7, 0x80}};
|
||||
|
||||
static const unsigned char s_aHeaderMarker[7] = {'T', 'W', 'D', 'E', 'M', 'O', 0};
|
||||
static const unsigned char s_CurVersion = 6;
|
||||
static const unsigned char s_OldVersion = 3;
|
||||
static const unsigned char s_Sha256Version = 6;
|
||||
static const unsigned char s_VersionTickCompression = 5; // demo files with this version or higher will use `CHUNKTICKFLAG_TICK_COMPRESSED`
|
||||
static const int s_LengthOffset = 152;
|
||||
static const int s_NumMarkersOffset = 176;
|
||||
static const unsigned char gs_aHeaderMarker[7] = {'T', 'W', 'D', 'E', 'M', 'O', 0};
|
||||
static const unsigned char gs_CurVersion = 6;
|
||||
static const unsigned char gs_OldVersion = 3;
|
||||
static const unsigned char gs_Sha256Version = 6;
|
||||
static const unsigned char gs_VersionTickCompression = 5; // demo files with this version or higher will use `CHUNKTICKFLAG_TICK_COMPRESSED`
|
||||
static const int gs_LengthOffset = 152;
|
||||
static const int gs_NumMarkersOffset = 176;
|
||||
|
||||
static const ColorRGBA gs_DemoPrintColor{0.75f, 0.7f, 0.7f, 1.0f};
|
||||
|
||||
|
@ -129,8 +129,8 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
|
|||
|
||||
// write header
|
||||
mem_zero(&Header, sizeof(Header));
|
||||
mem_copy(Header.m_aMarker, s_aHeaderMarker, sizeof(Header.m_aMarker));
|
||||
Header.m_Version = s_CurVersion;
|
||||
mem_copy(Header.m_aMarker, gs_aHeaderMarker, sizeof(Header.m_aMarker));
|
||||
Header.m_Version = gs_CurVersion;
|
||||
str_copy(Header.m_aNetversion, pNetVersion, sizeof(Header.m_aNetversion));
|
||||
str_copy(Header.m_aMapName, pMap, sizeof(Header.m_aMapName));
|
||||
uint_to_bytes_be(Header.m_aMapSize, MapSize);
|
||||
|
@ -343,13 +343,13 @@ int CDemoRecorder::Stop()
|
|||
return -1;
|
||||
|
||||
// add the demo length to the header
|
||||
io_seek(m_File, s_LengthOffset, IOSEEK_START);
|
||||
io_seek(m_File, gs_LengthOffset, IOSEEK_START);
|
||||
unsigned char aLength[4];
|
||||
int_to_bytes_be(aLength, Length());
|
||||
io_write(m_File, aLength, sizeof(aLength));
|
||||
|
||||
// add the timeline markers to the header
|
||||
io_seek(m_File, s_NumMarkersOffset, IOSEEK_START);
|
||||
io_seek(m_File, gs_NumMarkersOffset, IOSEEK_START);
|
||||
unsigned char aNumMarkers[4];
|
||||
int_to_bytes_be(aNumMarkers, m_NumTimelineMarkers);
|
||||
io_write(m_File, aNumMarkers, sizeof(aNumMarkers));
|
||||
|
@ -433,7 +433,7 @@ int CDemoPlayer::ReadChunkHeader(int *pType, int *pSize, int *pTick)
|
|||
int Tickdelta_legacy = Chunk & (CHUNKMASK_TICK_LEGACY); // compatibility
|
||||
*pType = Chunk & (CHUNKTYPEFLAG_TICKMARKER | CHUNKTICKFLAG_KEYFRAME);
|
||||
|
||||
if(m_Info.m_Header.m_Version < s_VersionTickCompression && Tickdelta_legacy != 0)
|
||||
if(m_Info.m_Header.m_Version < gs_VersionTickCompression && Tickdelta_legacy != 0)
|
||||
{
|
||||
*pTick += Tickdelta_legacy;
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
|
|||
|
||||
// read the header
|
||||
io_read(m_File, &m_Info.m_Header, sizeof(m_Info.m_Header));
|
||||
if(mem_comp(m_Info.m_Header.m_aMarker, s_aHeaderMarker, sizeof(s_aHeaderMarker)) != 0)
|
||||
if(mem_comp(m_Info.m_Header.m_aMarker, gs_aHeaderMarker, sizeof(gs_aHeaderMarker)) != 0)
|
||||
{
|
||||
if(m_pConsole)
|
||||
{
|
||||
|
@ -734,7 +734,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
|
|||
return -1;
|
||||
}
|
||||
|
||||
if(m_Info.m_Header.m_Version < s_OldVersion)
|
||||
if(m_Info.m_Header.m_Version < gs_OldVersion)
|
||||
{
|
||||
if(m_pConsole)
|
||||
{
|
||||
|
@ -746,11 +746,11 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
|
|||
m_File = 0;
|
||||
return -1;
|
||||
}
|
||||
else if(m_Info.m_Header.m_Version > s_OldVersion)
|
||||
else if(m_Info.m_Header.m_Version > gs_OldVersion)
|
||||
io_read(m_File, &m_Info.m_TimelineMarkers, sizeof(m_Info.m_TimelineMarkers));
|
||||
|
||||
SHA256_DIGEST Sha256 = SHA256_ZEROED;
|
||||
if(m_Info.m_Header.m_Version >= s_Sha256Version)
|
||||
if(m_Info.m_Header.m_Version >= gs_Sha256Version)
|
||||
{
|
||||
CUuid ExtensionUuid = {};
|
||||
io_read(m_File, &ExtensionUuid.m_aData, sizeof(ExtensionUuid.m_aData));
|
||||
|
@ -792,7 +792,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
|
|||
m_MapInfo.m_Size = MapSize;
|
||||
str_copy(m_MapInfo.m_aName, m_Info.m_Header.m_aMapName, sizeof(m_MapInfo.m_aName));
|
||||
|
||||
if(m_Info.m_Header.m_Version > s_OldVersion)
|
||||
if(m_Info.m_Header.m_Version > gs_OldVersion)
|
||||
{
|
||||
// get timeline markers
|
||||
int Num = bytes_be_to_int(m_Info.m_TimelineMarkers.m_aNumTimelineMarkers);
|
||||
|
@ -837,7 +837,7 @@ bool CDemoPlayer::ExtractMap(class IStorage *pStorage)
|
|||
|
||||
// handle sha256
|
||||
SHA256_DIGEST Sha256 = SHA256_ZEROED;
|
||||
if(m_Info.m_Header.m_Version >= s_Sha256Version)
|
||||
if(m_Info.m_Header.m_Version >= gs_Sha256Version)
|
||||
Sha256 = m_MapInfo.m_Sha256;
|
||||
else
|
||||
{
|
||||
|
@ -1081,7 +1081,7 @@ bool CDemoPlayer::GetDemoInfo(class IStorage *pStorage, const char *pFilename, i
|
|||
pMapInfo->m_Crc = bytes_be_to_int(pDemoHeader->m_aMapCrc);
|
||||
|
||||
SHA256_DIGEST Sha256 = SHA256_ZEROED;
|
||||
if(pDemoHeader->m_Version >= s_Sha256Version)
|
||||
if(pDemoHeader->m_Version >= gs_Sha256Version)
|
||||
{
|
||||
CUuid ExtensionUuid = {};
|
||||
io_read(File, &ExtensionUuid.m_aData, sizeof(ExtensionUuid.m_aData));
|
||||
|
@ -1102,7 +1102,7 @@ bool CDemoPlayer::GetDemoInfo(class IStorage *pStorage, const char *pFilename, i
|
|||
pMapInfo->m_Size = bytes_be_to_int(pDemoHeader->m_aMapSize);
|
||||
|
||||
io_close(File);
|
||||
return !(mem_comp(pDemoHeader->m_aMarker, s_aHeaderMarker, sizeof(s_aHeaderMarker)) || pDemoHeader->m_Version < s_OldVersion);
|
||||
return !(mem_comp(pDemoHeader->m_aMarker, gs_aHeaderMarker, sizeof(gs_aHeaderMarker)) || pDemoHeader->m_Version < gs_OldVersion);
|
||||
}
|
||||
|
||||
int CDemoPlayer::GetDemoType() const
|
||||
|
@ -1141,7 +1141,7 @@ void CDemoEditor::Slice(const char *pDemo, const char *pDst, int StartTick, int
|
|||
const CDemoPlayer::CPlaybackInfo *pInfo = m_pDemoPlayer->Info();
|
||||
|
||||
SHA256_DIGEST Sha256 = pMapInfo->m_Sha256;
|
||||
if(pInfo->m_Header.m_Version < s_Sha256Version)
|
||||
if(pInfo->m_Header.m_Version < gs_Sha256Version)
|
||||
{
|
||||
if(m_pDemoPlayer->ExtractMap(m_pStorage))
|
||||
Sha256 = pMapInfo->m_Sha256;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <curl/curl.h>
|
||||
|
||||
// TODO: Non-global pls?
|
||||
static CURLSH *gs_Share;
|
||||
static CURLSH *gs_pShare;
|
||||
static LOCK gs_aLocks[CURL_LOCK_DATA_LAST + 1];
|
||||
static bool gs_Initialized = false;
|
||||
|
||||
|
@ -77,8 +77,8 @@ bool HttpInit(IStorage *pStorage)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
gs_Share = curl_share_init();
|
||||
if(!gs_Share)
|
||||
gs_pShare = curl_share_init();
|
||||
if(!gs_pShare)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -92,11 +92,11 @@ bool HttpInit(IStorage *pStorage)
|
|||
{
|
||||
Lock = lock_create();
|
||||
}
|
||||
curl_share_setopt(gs_Share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
|
||||
curl_share_setopt(gs_Share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
||||
curl_share_setopt(gs_Share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
curl_share_setopt(gs_Share, CURLSHOPT_LOCKFUNC, CurlLock);
|
||||
curl_share_setopt(gs_Share, CURLSHOPT_UNLOCKFUNC, CurlUnlock);
|
||||
curl_share_setopt(gs_pShare, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
|
||||
curl_share_setopt(gs_pShare, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
||||
curl_share_setopt(gs_pShare, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||
curl_share_setopt(gs_pShare, CURLSHOPT_LOCKFUNC, CurlLock);
|
||||
curl_share_setopt(gs_pShare, CURLSHOPT_UNLOCKFUNC, CurlUnlock);
|
||||
|
||||
#if !defined(CONF_FAMILY_WINDOWS)
|
||||
// As a multithreaded application we have to tell curl to not install signal
|
||||
|
@ -199,7 +199,7 @@ int CHttpRequest::RunImpl(CURL *pUser)
|
|||
curl_easy_setopt(pHandle, CURLOPT_LOW_SPEED_LIMIT, m_Timeout.LowSpeedLimit);
|
||||
curl_easy_setopt(pHandle, CURLOPT_LOW_SPEED_TIME, m_Timeout.LowSpeedTime);
|
||||
|
||||
curl_easy_setopt(pHandle, CURLOPT_SHARE, gs_Share);
|
||||
curl_easy_setopt(pHandle, CURLOPT_SHARE, gs_pShare);
|
||||
curl_easy_setopt(pHandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
|
||||
curl_easy_setopt(pHandle, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
curl_easy_setopt(pHandle, CURLOPT_MAXREDIRS, 4L);
|
||||
|
|
|
@ -504,9 +504,9 @@ void CNetBan::ConBans(IConsole::IResult *pResult, void *pUser)
|
|||
CNetBan *pThis = static_cast<CNetBan *>(pUser);
|
||||
|
||||
int Page = pResult->NumArguments() > 0 ? pResult->GetInteger(0) : 0;
|
||||
static const int EntriesPerPage = 20;
|
||||
const int Start = Page * EntriesPerPage;
|
||||
const int End = (Page + 1) * EntriesPerPage;
|
||||
static const int s_EntriesPerPage = 20;
|
||||
const int Start = Page * s_EntriesPerPage;
|
||||
const int End = (Page + 1) * s_EntriesPerPage;
|
||||
|
||||
int Count = 0;
|
||||
char aBuf[256], aMsg[256];
|
||||
|
|
|
@ -85,6 +85,7 @@ enum
|
|||
SERVERINFO_MAX_CLIENTS = 128,
|
||||
MAX_CLIENTS = 64,
|
||||
VANILLA_MAX_CLIENTS = 16,
|
||||
MAX_CHECKPOINTS = 25,
|
||||
|
||||
MAX_INPUT_SIZE = 128,
|
||||
MAX_SNAPSHOT_PACKSIZE = 900,
|
||||
|
|
|
@ -251,9 +251,9 @@ int websocket_send(int socket, const unsigned char *data, size_t size,
|
|||
return -1;
|
||||
}
|
||||
context_data *ctx_data = (context_data *)lws_context_user(context);
|
||||
char buf[100];
|
||||
snprintf(buf, sizeof(buf), "%s:%d", addr_str, port);
|
||||
std::string addr_str_with_port = std::string(buf);
|
||||
char aBuf[100];
|
||||
snprintf(aBuf, sizeof(aBuf), "%s:%d", addr_str, port);
|
||||
std::string addr_str_with_port = std::string(aBuf);
|
||||
struct per_session_data *pss = ctx_data->port_map[addr_str_with_port];
|
||||
if(pss == NULL)
|
||||
{
|
||||
|
|
|
@ -78,10 +78,10 @@ void CBinds::Bind(int KeyID, const char *pStr, bool FreeOnly, int ModifierCombin
|
|||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "binds", aBuf, gs_BindPrintColor);
|
||||
}
|
||||
|
||||
int CBinds::GetModifierMask(IInput *i)
|
||||
int CBinds::GetModifierMask(IInput *pInput)
|
||||
{
|
||||
int Mask = 0;
|
||||
static const auto ModifierKeys = {
|
||||
static const auto s_aModifierKeys = {
|
||||
KEY_LSHIFT,
|
||||
KEY_RSHIFT,
|
||||
KEY_LCTRL,
|
||||
|
@ -91,9 +91,9 @@ int CBinds::GetModifierMask(IInput *i)
|
|||
KEY_LGUI,
|
||||
KEY_RGUI,
|
||||
};
|
||||
for(const auto Key : ModifierKeys)
|
||||
for(const auto Key : s_aModifierKeys)
|
||||
{
|
||||
if(i->KeyIsPressed(Key))
|
||||
if(pInput->KeyIsPressed(Key))
|
||||
{
|
||||
Mask |= GetModifierMaskOfKey(Key);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
const char *Get(int KeyID, int ModifierCombination);
|
||||
void GetKey(const char *pBindStr, char *aBuf, unsigned BufSize);
|
||||
int GetBindSlot(const char *pBindString, int *pModifierCombination);
|
||||
static int GetModifierMask(IInput *i);
|
||||
static int GetModifierMask(IInput *pInput);
|
||||
static int GetModifierMaskOfKey(int Key);
|
||||
static const char *GetModifierName(int Modifier);
|
||||
static const char *GetKeyBindModifiersName(int ModifierCombination);
|
||||
|
|
|
@ -103,28 +103,28 @@ void CCamera::OnRender()
|
|||
{
|
||||
if(m_CamType != CAMTYPE_SPEC)
|
||||
{
|
||||
m_LastPos[g_Config.m_ClDummy] = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
|
||||
m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_PrevCenter;
|
||||
m_aLastPos[g_Config.m_ClDummy] = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy];
|
||||
m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy] = m_PrevCenter;
|
||||
m_pClient->m_Controls.ClampMousePos();
|
||||
m_CamType = CAMTYPE_SPEC;
|
||||
}
|
||||
m_Center = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
|
||||
m_Center = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_CamType != CAMTYPE_PLAYER)
|
||||
{
|
||||
if((m_LastPos[g_Config.m_ClDummy].x < g_Config.m_ClMouseMinDistance) || (m_LastPos[g_Config.m_ClDummy].x < g_Config.m_ClDyncamMinDistance))
|
||||
m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].x = m_LastPos[g_Config.m_ClDummy].x + g_Config.m_ClMouseMinDistance + g_Config.m_ClDyncamMinDistance;
|
||||
if((m_aLastPos[g_Config.m_ClDummy].x < g_Config.m_ClMouseMinDistance) || (m_aLastPos[g_Config.m_ClDummy].x < g_Config.m_ClDyncamMinDistance))
|
||||
m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy].x = m_aLastPos[g_Config.m_ClDummy].x + g_Config.m_ClMouseMinDistance + g_Config.m_ClDyncamMinDistance;
|
||||
else
|
||||
m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_LastPos[g_Config.m_ClDummy];
|
||||
m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy] = m_aLastPos[g_Config.m_ClDummy];
|
||||
m_pClient->m_Controls.ClampMousePos();
|
||||
m_CamType = CAMTYPE_PLAYER;
|
||||
}
|
||||
|
||||
float DeltaTime = Client()->RenderFrameTime();
|
||||
static vec2 s_LastMousePos(0, 0);
|
||||
static vec2 s_CurrentCameraOffset[2] = {vec2(0, 0), vec2(0, 0)};
|
||||
static vec2 s_aCurrentCameraOffset[NUM_DUMMIES] = {vec2(0, 0), vec2(0, 0)};
|
||||
static float s_SpeedBias = 0.5f;
|
||||
|
||||
if(g_Config.m_ClDyncamSmoothness > 0)
|
||||
|
@ -135,7 +135,7 @@ void CCamera::OnRender()
|
|||
s_SpeedBias += CameraSpeed * DeltaTime;
|
||||
if(g_Config.m_ClDyncam)
|
||||
{
|
||||
s_SpeedBias -= length(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] - s_LastMousePos) * log10f(CameraStabilizingFactor) * 0.02f;
|
||||
s_SpeedBias -= length(m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy] - s_LastMousePos) * log10f(CameraStabilizingFactor) * 0.02f;
|
||||
s_SpeedBias = clamp(s_SpeedBias, 0.5f, CameraSpeed);
|
||||
}
|
||||
else
|
||||
|
@ -145,7 +145,7 @@ void CCamera::OnRender()
|
|||
}
|
||||
|
||||
vec2 TargetCameraOffset(0, 0);
|
||||
s_LastMousePos = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy];
|
||||
s_LastMousePos = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy];
|
||||
float l = length(s_LastMousePos);
|
||||
if(l > 0.0001f) // make sure that this isn't 0
|
||||
{
|
||||
|
@ -153,23 +153,23 @@ void CCamera::OnRender()
|
|||
float FollowFactor = (g_Config.m_ClDyncam ? g_Config.m_ClDyncamFollowFactor : g_Config.m_ClMouseFollowfactor) / 100.0f;
|
||||
float OffsetAmount = maximum(l - DeadZone, 0.0f) * FollowFactor;
|
||||
|
||||
TargetCameraOffset = normalize(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy]) * OffsetAmount;
|
||||
TargetCameraOffset = normalize(m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy]) * OffsetAmount;
|
||||
}
|
||||
|
||||
if(g_Config.m_ClDyncamSmoothness > 0)
|
||||
s_CurrentCameraOffset[g_Config.m_ClDummy] += (TargetCameraOffset - s_CurrentCameraOffset[g_Config.m_ClDummy]) * minimum(DeltaTime * s_SpeedBias, 1.0f);
|
||||
s_aCurrentCameraOffset[g_Config.m_ClDummy] += (TargetCameraOffset - s_aCurrentCameraOffset[g_Config.m_ClDummy]) * minimum(DeltaTime * s_SpeedBias, 1.0f);
|
||||
else
|
||||
s_CurrentCameraOffset[g_Config.m_ClDummy] = TargetCameraOffset;
|
||||
s_aCurrentCameraOffset[g_Config.m_ClDummy] = TargetCameraOffset;
|
||||
|
||||
if(m_pClient->m_Snap.m_SpecInfo.m_Active)
|
||||
m_Center = m_pClient->m_Snap.m_SpecInfo.m_Position + s_CurrentCameraOffset[g_Config.m_ClDummy];
|
||||
m_Center = m_pClient->m_Snap.m_SpecInfo.m_Position + s_aCurrentCameraOffset[g_Config.m_ClDummy];
|
||||
else
|
||||
m_Center = m_pClient->m_LocalCharacterPos + s_CurrentCameraOffset[g_Config.m_ClDummy];
|
||||
m_Center = m_pClient->m_LocalCharacterPos + s_aCurrentCameraOffset[g_Config.m_ClDummy];
|
||||
}
|
||||
|
||||
if(m_ForceFreeviewPos != vec2(-1, -1) && m_CamType == CAMTYPE_SPEC)
|
||||
{
|
||||
m_Center = m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy] = m_ForceFreeviewPos;
|
||||
m_Center = m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy] = m_ForceFreeviewPos;
|
||||
m_ForceFreeviewPos = vec2(-1, -1);
|
||||
}
|
||||
m_PrevCenter = m_Center;
|
||||
|
|
|
@ -22,7 +22,7 @@ class CCamera : public CComponent
|
|||
};
|
||||
|
||||
int m_CamType;
|
||||
vec2 m_LastPos[NUM_DUMMIES];
|
||||
vec2 m_aLastPos[NUM_DUMMIES];
|
||||
vec2 m_PrevCenter;
|
||||
|
||||
CCubicBezier m_ZoomSmoothing;
|
||||
|
|
|
@ -55,8 +55,8 @@ void CChat::RebuildChat()
|
|||
Graphics()->DeleteQuadContainer(Line.m_QuadContainerIndex);
|
||||
Line.m_QuadContainerIndex = -1;
|
||||
// recalculate sizes
|
||||
Line.m_YOffset[0] = -1.f;
|
||||
Line.m_YOffset[1] = -1.f;
|
||||
Line.m_aYOffset[0] = -1.f;
|
||||
Line.m_aYOffset[1] = -1.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,27 +177,27 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
|
||||
if(Input()->ModifierIsPressed() && Input()->KeyPress(KEY_V))
|
||||
{
|
||||
const char *Text = Input()->GetClipboardText();
|
||||
if(Text)
|
||||
const char *pText = Input()->GetClipboardText();
|
||||
if(pText)
|
||||
{
|
||||
// if the text has more than one line, we send all lines except the last one
|
||||
// the last one is set as in the text field
|
||||
char aLine[256];
|
||||
int i, Begin = 0;
|
||||
for(i = 0; i < str_length(Text); i++)
|
||||
for(i = 0; i < str_length(pText); i++)
|
||||
{
|
||||
if(Text[i] == '\n')
|
||||
if(pText[i] == '\n')
|
||||
{
|
||||
int max = minimum(i - Begin + 1, (int)sizeof(aLine));
|
||||
str_copy(aLine, Text + Begin, max);
|
||||
str_copy(aLine, pText + Begin, max);
|
||||
Begin = i + 1;
|
||||
SayChat(aLine);
|
||||
while(Text[i] == '\n')
|
||||
while(pText[i] == '\n')
|
||||
i++;
|
||||
}
|
||||
}
|
||||
int max = minimum(i - Begin + 1, (int)sizeof(aLine));
|
||||
str_copy(aLine, Text + Begin, max);
|
||||
str_copy(aLine, pText + Begin, max);
|
||||
m_Input.Append(aLine);
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
// Create the completion list of player names through which the player can iterate
|
||||
const char *PlayerName, *FoundInput;
|
||||
m_PlayerCompletionListLength = 0;
|
||||
for(auto &PlayerInfo : m_pClient->m_Snap.m_paInfoByName)
|
||||
for(auto &PlayerInfo : m_pClient->m_Snap.m_apInfoByName)
|
||||
{
|
||||
if(PlayerInfo)
|
||||
{
|
||||
|
@ -421,7 +421,7 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
if(m_PlayerCompletionListLength > 0)
|
||||
{
|
||||
// We do this in a loop, if a player left the game during the repeated pressing of Tab, they are skipped
|
||||
CGameClient::CClientData *CompletionClientData;
|
||||
CGameClient::CClientData *pCompletionClientData;
|
||||
for(int i = 0; i < m_PlayerCompletionListLength; ++i)
|
||||
{
|
||||
if(m_ReverseTAB && m_CompletionUsed)
|
||||
|
@ -439,13 +439,13 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
m_CompletionChosen %= m_PlayerCompletionListLength;
|
||||
m_CompletionUsed = true;
|
||||
|
||||
CompletionClientData = &m_pClient->m_aClients[m_aPlayerCompletionList[m_CompletionChosen].ClientID];
|
||||
if(!CompletionClientData->m_Active)
|
||||
pCompletionClientData = &m_pClient->m_aClients[m_aPlayerCompletionList[m_CompletionChosen].ClientID];
|
||||
if(!pCompletionClientData->m_Active)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
pCompletionString = CompletionClientData->m_aName;
|
||||
pCompletionString = pCompletionClientData->m_aName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -750,8 +750,8 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
Graphics()->DeleteQuadContainer(pCurrentLine->m_QuadContainerIndex);
|
||||
pCurrentLine->m_QuadContainerIndex = -1;
|
||||
pCurrentLine->m_Time = time();
|
||||
pCurrentLine->m_YOffset[0] = -1.f;
|
||||
pCurrentLine->m_YOffset[1] = -1.f;
|
||||
pCurrentLine->m_aYOffset[0] = -1.f;
|
||||
pCurrentLine->m_aYOffset[1] = -1.f;
|
||||
|
||||
FChatMsgCheckAndPrint(pCurrentLine);
|
||||
return;
|
||||
|
@ -762,8 +762,8 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
pCurrentLine = &m_aLines[m_CurrentLine];
|
||||
pCurrentLine->m_TimesRepeated = 0;
|
||||
pCurrentLine->m_Time = time();
|
||||
pCurrentLine->m_YOffset[0] = -1.0f;
|
||||
pCurrentLine->m_YOffset[1] = -1.0f;
|
||||
pCurrentLine->m_aYOffset[0] = -1.0f;
|
||||
pCurrentLine->m_aYOffset[1] = -1.0f;
|
||||
pCurrentLine->m_ClientID = ClientID;
|
||||
pCurrentLine->m_TeamNumber = Team;
|
||||
pCurrentLine->m_Team = Team == 1;
|
||||
|
@ -781,20 +781,20 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
// check for highlighted name
|
||||
if(Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
if(ClientID >= 0 && ClientID != m_pClient->m_LocalIDs[0])
|
||||
if(ClientID >= 0 && ClientID != m_pClient->m_aLocalIDs[0])
|
||||
{
|
||||
// main character
|
||||
if(LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_LocalIDs[0]].m_aName))
|
||||
if(LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_aLocalIDs[0]].m_aName))
|
||||
Highlighted = true;
|
||||
// dummy
|
||||
if(m_pClient->Client()->DummyConnected() && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_LocalIDs[1]].m_aName))
|
||||
if(m_pClient->Client()->DummyConnected() && LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_aLocalIDs[1]].m_aName))
|
||||
Highlighted = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// on demo playback use local id from snap directly,
|
||||
// since m_LocalIDs isn't valid there
|
||||
// since m_aLocalIDs isn't valid there
|
||||
if(LineShouldHighlight(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName))
|
||||
Highlighted = true;
|
||||
}
|
||||
|
@ -1021,7 +1021,7 @@ void CChat::OnPrepareLines()
|
|||
}
|
||||
|
||||
// get the y offset (calculate it if we haven't done that yet)
|
||||
if(m_aLines[r].m_YOffset[OffsetType] < 0.0f)
|
||||
if(m_aLines[r].m_aYOffset[OffsetType] < 0.0f)
|
||||
{
|
||||
TextRender()->SetCursor(&Cursor, TextBegin, 0.0f, FontSize, 0);
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
|
@ -1055,10 +1055,10 @@ void CChat::OnPrepareLines()
|
|||
|
||||
TextRender()->TextEx(&AppendCursor, m_aLines[r].m_aText, -1);
|
||||
|
||||
m_aLines[r].m_YOffset[OffsetType] = AppendCursor.m_Y + AppendCursor.m_FontSize + RealMsgPaddingY;
|
||||
m_aLines[r].m_aYOffset[OffsetType] = AppendCursor.m_Y + AppendCursor.m_FontSize + RealMsgPaddingY;
|
||||
}
|
||||
|
||||
y -= m_aLines[r].m_YOffset[OffsetType];
|
||||
y -= m_aLines[r].m_aYOffset[OffsetType];
|
||||
|
||||
// cut off if msgs waste too much space
|
||||
if(y < HeightLimit)
|
||||
|
@ -1172,7 +1172,7 @@ void CChat::OnPrepareLines()
|
|||
|
||||
if(!g_Config.m_ClChatOld && (m_aLines[r].m_aText[0] != '\0' || m_aLines[r].m_aName[0] != '\0'))
|
||||
{
|
||||
float Height = m_aLines[r].m_YOffset[OffsetType];
|
||||
float Height = m_aLines[r].m_aYOffset[OffsetType];
|
||||
Graphics()->SetColor(1, 1, 1, 1);
|
||||
m_aLines[r].m_QuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Begin, y, (AppendCursor.m_LongestLineWidth - TextBegin) + RealMsgPaddingX * 1.5f, Height, MESSAGE_ROUNDING, CUI::CORNER_ALL);
|
||||
}
|
||||
|
@ -1304,7 +1304,7 @@ void CChat::OnRender()
|
|||
if(Now > m_aLines[r].m_Time + 16 * time_freq() && !m_PrevShowChat)
|
||||
break;
|
||||
|
||||
y -= m_aLines[r].m_YOffset[OffsetType];
|
||||
y -= m_aLines[r].m_aYOffset[OffsetType];
|
||||
|
||||
// cut off if msgs waste too much space
|
||||
if(y < HeightLimit)
|
||||
|
|
|
@ -29,7 +29,7 @@ class CChat : public CComponent
|
|||
struct CLine
|
||||
{
|
||||
int64_t m_Time;
|
||||
float m_YOffset[2];
|
||||
float m_aYOffset[2];
|
||||
int m_ClientID;
|
||||
int m_TeamNumber;
|
||||
bool m_Team;
|
||||
|
|
|
@ -230,14 +230,14 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
|||
}
|
||||
if(m_pGameConsole->Input()->ModifierIsPressed() && m_pGameConsole->Input()->KeyPress(KEY_V))
|
||||
{
|
||||
const char *Text = m_pGameConsole->Input()->GetClipboardText();
|
||||
if(Text)
|
||||
const char *pText = m_pGameConsole->Input()->GetClipboardText();
|
||||
if(pText)
|
||||
{
|
||||
char aLine[256];
|
||||
int i, Begin = 0;
|
||||
for(i = 0; i < str_length(Text); i++)
|
||||
for(i = 0; i < str_length(pText); i++)
|
||||
{
|
||||
if(Text[i] == '\n')
|
||||
if(pText[i] == '\n')
|
||||
{
|
||||
if(i == Begin)
|
||||
{
|
||||
|
@ -245,13 +245,13 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
|||
continue;
|
||||
}
|
||||
int max = minimum(i - Begin + 1, (int)sizeof(aLine));
|
||||
str_copy(aLine, Text + Begin, max);
|
||||
str_copy(aLine, pText + Begin, max);
|
||||
Begin = i + 1;
|
||||
ExecuteLine(aLine);
|
||||
}
|
||||
}
|
||||
int max = minimum(i - Begin + 1, (int)sizeof(aLine));
|
||||
str_copy(aLine, Text + Begin, max);
|
||||
str_copy(aLine, pText + Begin, max);
|
||||
m_Input.Append(aLine);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
CControls::CControls()
|
||||
{
|
||||
mem_zero(&m_LastData, sizeof(m_LastData));
|
||||
mem_zero(&m_aLastData, sizeof(m_aLastData));
|
||||
m_LastDummy = 0;
|
||||
m_OtherFire = 0;
|
||||
}
|
||||
|
@ -27,24 +27,24 @@ void CControls::OnReset()
|
|||
ResetInput(0);
|
||||
ResetInput(1);
|
||||
|
||||
for(int &AmmoCount : m_AmmoCount)
|
||||
for(int &AmmoCount : m_aAmmoCount)
|
||||
AmmoCount = 0;
|
||||
m_OldMouseX = m_OldMouseY = 0.0f;
|
||||
}
|
||||
|
||||
void CControls::ResetInput(int Dummy)
|
||||
{
|
||||
m_LastData[Dummy].m_Direction = 0;
|
||||
//m_LastData[Dummy].m_Hook = 0;
|
||||
m_aLastData[Dummy].m_Direction = 0;
|
||||
//m_aLastData[Dummy].m_Hook = 0;
|
||||
// simulate releasing the fire button
|
||||
if((m_LastData[Dummy].m_Fire & 1) != 0)
|
||||
m_LastData[Dummy].m_Fire++;
|
||||
m_LastData[Dummy].m_Fire &= INPUT_STATE_MASK;
|
||||
m_LastData[Dummy].m_Jump = 0;
|
||||
m_InputData[Dummy] = m_LastData[Dummy];
|
||||
if((m_aLastData[Dummy].m_Fire & 1) != 0)
|
||||
m_aLastData[Dummy].m_Fire++;
|
||||
m_aLastData[Dummy].m_Fire &= INPUT_STATE_MASK;
|
||||
m_aLastData[Dummy].m_Jump = 0;
|
||||
m_aInputData[Dummy] = m_aLastData[Dummy];
|
||||
|
||||
m_InputDirectionLeft[Dummy] = 0;
|
||||
m_InputDirectionRight[Dummy] = 0;
|
||||
m_aInputDirectionLeft[Dummy] = 0;
|
||||
m_aInputDirectionRight[Dummy] = 0;
|
||||
}
|
||||
|
||||
void CControls::OnRelease()
|
||||
|
@ -54,7 +54,7 @@ void CControls::OnRelease()
|
|||
|
||||
void CControls::OnPlayerDeath()
|
||||
{
|
||||
for(int &AmmoCount : m_AmmoCount)
|
||||
for(int &AmmoCount : m_aAmmoCount)
|
||||
AmmoCount = 0;
|
||||
}
|
||||
|
||||
|
@ -120,64 +120,64 @@ static void ConKeyInputNextPrevWeapon(IConsole::IResult *pResult, void *pUserDat
|
|||
{
|
||||
CInputSet *pSet = (CInputSet *)pUserData;
|
||||
ConKeyInputCounter(pResult, pSet);
|
||||
pSet->m_pControls->m_InputData[g_Config.m_ClDummy].m_WantedWeapon = 0;
|
||||
pSet->m_pControls->m_aInputData[g_Config.m_ClDummy].m_WantedWeapon = 0;
|
||||
}
|
||||
|
||||
void CControls::OnConsoleInit()
|
||||
{
|
||||
// game commands
|
||||
{
|
||||
static CInputState s_State = {this, &m_InputDirectionLeft[0], &m_InputDirectionLeft[1]};
|
||||
static CInputState s_State = {this, &m_aInputDirectionLeft[0], &m_aInputDirectionLeft[1]};
|
||||
Console()->Register("+left", "", CFGFLAG_CLIENT, ConKeyInputState, (void *)&s_State, "Move left");
|
||||
}
|
||||
{
|
||||
static CInputState s_State = {this, &m_InputDirectionRight[0], &m_InputDirectionRight[1]};
|
||||
static CInputState s_State = {this, &m_aInputDirectionRight[0], &m_aInputDirectionRight[1]};
|
||||
Console()->Register("+right", "", CFGFLAG_CLIENT, ConKeyInputState, (void *)&s_State, "Move right");
|
||||
}
|
||||
{
|
||||
static CInputState s_State = {this, &m_InputData[0].m_Jump, &m_InputData[1].m_Jump};
|
||||
static CInputState s_State = {this, &m_aInputData[0].m_Jump, &m_aInputData[1].m_Jump};
|
||||
Console()->Register("+jump", "", CFGFLAG_CLIENT, ConKeyInputState, (void *)&s_State, "Jump");
|
||||
}
|
||||
{
|
||||
static CInputState s_State = {this, &m_InputData[0].m_Hook, &m_InputData[1].m_Hook};
|
||||
static CInputState s_State = {this, &m_aInputData[0].m_Hook, &m_aInputData[1].m_Hook};
|
||||
Console()->Register("+hook", "", CFGFLAG_CLIENT, ConKeyInputState, (void *)&s_State, "Hook");
|
||||
}
|
||||
{
|
||||
static CInputState s_State = {this, &m_InputData[0].m_Fire, &m_InputData[1].m_Fire};
|
||||
static CInputState s_State = {this, &m_aInputData[0].m_Fire, &m_aInputData[1].m_Fire};
|
||||
Console()->Register("+fire", "", CFGFLAG_CLIENT, ConKeyInputCounter, (void *)&s_State, "Fire");
|
||||
}
|
||||
{
|
||||
static CInputState s_State = {this, &m_ShowHookColl[0], &m_ShowHookColl[1]};
|
||||
static CInputState s_State = {this, &m_aShowHookColl[0], &m_aShowHookColl[1]};
|
||||
Console()->Register("+showhookcoll", "", CFGFLAG_CLIENT, ConKeyInputState, (void *)&s_State, "Show Hook Collision");
|
||||
}
|
||||
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_WantedWeapon, &m_InputData[1].m_WantedWeapon, 1};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_WantedWeapon, &m_aInputData[1].m_WantedWeapon, 1};
|
||||
Console()->Register("+weapon1", "", CFGFLAG_CLIENT, ConKeyInputSet, (void *)&s_Set, "Switch to hammer");
|
||||
}
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_WantedWeapon, &m_InputData[1].m_WantedWeapon, 2};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_WantedWeapon, &m_aInputData[1].m_WantedWeapon, 2};
|
||||
Console()->Register("+weapon2", "", CFGFLAG_CLIENT, ConKeyInputSet, (void *)&s_Set, "Switch to gun");
|
||||
}
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_WantedWeapon, &m_InputData[1].m_WantedWeapon, 3};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_WantedWeapon, &m_aInputData[1].m_WantedWeapon, 3};
|
||||
Console()->Register("+weapon3", "", CFGFLAG_CLIENT, ConKeyInputSet, (void *)&s_Set, "Switch to shotgun");
|
||||
}
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_WantedWeapon, &m_InputData[1].m_WantedWeapon, 4};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_WantedWeapon, &m_aInputData[1].m_WantedWeapon, 4};
|
||||
Console()->Register("+weapon4", "", CFGFLAG_CLIENT, ConKeyInputSet, (void *)&s_Set, "Switch to grenade");
|
||||
}
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_WantedWeapon, &m_InputData[1].m_WantedWeapon, 5};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_WantedWeapon, &m_aInputData[1].m_WantedWeapon, 5};
|
||||
Console()->Register("+weapon5", "", CFGFLAG_CLIENT, ConKeyInputSet, (void *)&s_Set, "Switch to laser");
|
||||
}
|
||||
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_NextWeapon, &m_InputData[1].m_NextWeapon, 0};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_NextWeapon, &m_aInputData[1].m_NextWeapon, 0};
|
||||
Console()->Register("+nextweapon", "", CFGFLAG_CLIENT, ConKeyInputNextPrevWeapon, (void *)&s_Set, "Switch to next weapon");
|
||||
}
|
||||
{
|
||||
static CInputSet s_Set = {this, &m_InputData[0].m_PrevWeapon, &m_InputData[1].m_PrevWeapon, 0};
|
||||
static CInputSet s_Set = {this, &m_aInputData[0].m_PrevWeapon, &m_aInputData[1].m_PrevWeapon, 0};
|
||||
Console()->Register("+prevweapon", "", CFGFLAG_CLIENT, ConKeyInputNextPrevWeapon, (void *)&s_Set, "Switch to previous weapon");
|
||||
}
|
||||
}
|
||||
|
@ -188,9 +188,9 @@ void CControls::OnMessage(int Msg, void *pRawMsg)
|
|||
{
|
||||
CNetMsg_Sv_WeaponPickup *pMsg = (CNetMsg_Sv_WeaponPickup *)pRawMsg;
|
||||
if(g_Config.m_ClAutoswitchWeapons)
|
||||
m_InputData[g_Config.m_ClDummy].m_WantedWeapon = pMsg->m_Weapon + 1;
|
||||
m_aInputData[g_Config.m_ClDummy].m_WantedWeapon = pMsg->m_Weapon + 1;
|
||||
// We don't really know ammo count, until we'll switch to that weapon, but any non-zero count will suffice here
|
||||
m_AmmoCount[pMsg->m_Weapon % NUM_WEAPONS] = 10;
|
||||
m_aAmmoCount[pMsg->m_Weapon % NUM_WEAPONS] = 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,35 +201,35 @@ int CControls::SnapInput(int *pData)
|
|||
|
||||
// update player state
|
||||
if(m_pClient->m_Chat.IsActive())
|
||||
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_CHATTING;
|
||||
m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_CHATTING;
|
||||
else if(m_pClient->m_Menus.IsActive())
|
||||
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_IN_MENU;
|
||||
m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_IN_MENU;
|
||||
else
|
||||
m_InputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING;
|
||||
m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING;
|
||||
|
||||
if(m_pClient->m_Scoreboard.Active())
|
||||
m_InputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SCOREBOARD;
|
||||
m_aInputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SCOREBOARD;
|
||||
|
||||
if(m_pClient->m_Controls.m_ShowHookColl[g_Config.m_ClDummy])
|
||||
m_InputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_AIM;
|
||||
if(m_pClient->m_Controls.m_aShowHookColl[g_Config.m_ClDummy])
|
||||
m_aInputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_AIM;
|
||||
|
||||
if(m_LastData[g_Config.m_ClDummy].m_PlayerFlags != m_InputData[g_Config.m_ClDummy].m_PlayerFlags)
|
||||
if(m_aLastData[g_Config.m_ClDummy].m_PlayerFlags != m_aInputData[g_Config.m_ClDummy].m_PlayerFlags)
|
||||
Send = true;
|
||||
|
||||
m_LastData[g_Config.m_ClDummy].m_PlayerFlags = m_InputData[g_Config.m_ClDummy].m_PlayerFlags;
|
||||
m_aLastData[g_Config.m_ClDummy].m_PlayerFlags = m_aInputData[g_Config.m_ClDummy].m_PlayerFlags;
|
||||
|
||||
// we freeze the input if chat or menu is activated
|
||||
if(!(m_InputData[g_Config.m_ClDummy].m_PlayerFlags & PLAYERFLAG_PLAYING))
|
||||
if(!(m_aInputData[g_Config.m_ClDummy].m_PlayerFlags & PLAYERFLAG_PLAYING))
|
||||
{
|
||||
if(!GameClient()->m_GameInfo.m_BugDDRaceInput)
|
||||
ResetInput(g_Config.m_ClDummy);
|
||||
|
||||
mem_copy(pData, &m_InputData[g_Config.m_ClDummy], sizeof(m_InputData[0]));
|
||||
mem_copy(pData, &m_aInputData[g_Config.m_ClDummy], sizeof(m_aInputData[0]));
|
||||
|
||||
// set the target anyway though so that we can keep seeing our surroundings,
|
||||
// even if chat or menu are activated
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetX = (int)m_MousePos[g_Config.m_ClDummy].x;
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetY = (int)m_MousePos[g_Config.m_ClDummy].y;
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetX = (int)m_aMousePos[g_Config.m_ClDummy].x;
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetY = (int)m_aMousePos[g_Config.m_ClDummy].y;
|
||||
|
||||
// send once a second just to be sure
|
||||
if(time_get() > LastSendTime + time_freq())
|
||||
|
@ -237,38 +237,38 @@ int CControls::SnapInput(int *pData)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetX = (int)m_MousePos[g_Config.m_ClDummy].x;
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetY = (int)m_MousePos[g_Config.m_ClDummy].y;
|
||||
if(!m_InputData[g_Config.m_ClDummy].m_TargetX && !m_InputData[g_Config.m_ClDummy].m_TargetY)
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetX = (int)m_aMousePos[g_Config.m_ClDummy].x;
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetY = (int)m_aMousePos[g_Config.m_ClDummy].y;
|
||||
if(!m_aInputData[g_Config.m_ClDummy].m_TargetX && !m_aInputData[g_Config.m_ClDummy].m_TargetY)
|
||||
{
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetX = 1;
|
||||
m_MousePos[g_Config.m_ClDummy].x = 1;
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetX = 1;
|
||||
m_aMousePos[g_Config.m_ClDummy].x = 1;
|
||||
}
|
||||
|
||||
// set direction
|
||||
m_InputData[g_Config.m_ClDummy].m_Direction = 0;
|
||||
if(m_InputDirectionLeft[g_Config.m_ClDummy] && !m_InputDirectionRight[g_Config.m_ClDummy])
|
||||
m_InputData[g_Config.m_ClDummy].m_Direction = -1;
|
||||
if(!m_InputDirectionLeft[g_Config.m_ClDummy] && m_InputDirectionRight[g_Config.m_ClDummy])
|
||||
m_InputData[g_Config.m_ClDummy].m_Direction = 1;
|
||||
m_aInputData[g_Config.m_ClDummy].m_Direction = 0;
|
||||
if(m_aInputDirectionLeft[g_Config.m_ClDummy] && !m_aInputDirectionRight[g_Config.m_ClDummy])
|
||||
m_aInputData[g_Config.m_ClDummy].m_Direction = -1;
|
||||
if(!m_aInputDirectionLeft[g_Config.m_ClDummy] && m_aInputDirectionRight[g_Config.m_ClDummy])
|
||||
m_aInputData[g_Config.m_ClDummy].m_Direction = 1;
|
||||
|
||||
// dummy copy moves
|
||||
if(g_Config.m_ClDummyCopyMoves)
|
||||
{
|
||||
CNetObj_PlayerInput *pDummyInput = &m_pClient->m_DummyInput;
|
||||
pDummyInput->m_Direction = m_InputData[g_Config.m_ClDummy].m_Direction;
|
||||
pDummyInput->m_Hook = m_InputData[g_Config.m_ClDummy].m_Hook;
|
||||
pDummyInput->m_Jump = m_InputData[g_Config.m_ClDummy].m_Jump;
|
||||
pDummyInput->m_PlayerFlags = m_InputData[g_Config.m_ClDummy].m_PlayerFlags;
|
||||
pDummyInput->m_TargetX = m_InputData[g_Config.m_ClDummy].m_TargetX;
|
||||
pDummyInput->m_TargetY = m_InputData[g_Config.m_ClDummy].m_TargetY;
|
||||
pDummyInput->m_WantedWeapon = m_InputData[g_Config.m_ClDummy].m_WantedWeapon;
|
||||
pDummyInput->m_Direction = m_aInputData[g_Config.m_ClDummy].m_Direction;
|
||||
pDummyInput->m_Hook = m_aInputData[g_Config.m_ClDummy].m_Hook;
|
||||
pDummyInput->m_Jump = m_aInputData[g_Config.m_ClDummy].m_Jump;
|
||||
pDummyInput->m_PlayerFlags = m_aInputData[g_Config.m_ClDummy].m_PlayerFlags;
|
||||
pDummyInput->m_TargetX = m_aInputData[g_Config.m_ClDummy].m_TargetX;
|
||||
pDummyInput->m_TargetY = m_aInputData[g_Config.m_ClDummy].m_TargetY;
|
||||
pDummyInput->m_WantedWeapon = m_aInputData[g_Config.m_ClDummy].m_WantedWeapon;
|
||||
|
||||
pDummyInput->m_Fire += m_InputData[g_Config.m_ClDummy].m_Fire - m_LastData[g_Config.m_ClDummy].m_Fire;
|
||||
pDummyInput->m_NextWeapon += m_InputData[g_Config.m_ClDummy].m_NextWeapon - m_LastData[g_Config.m_ClDummy].m_NextWeapon;
|
||||
pDummyInput->m_PrevWeapon += m_InputData[g_Config.m_ClDummy].m_PrevWeapon - m_LastData[g_Config.m_ClDummy].m_PrevWeapon;
|
||||
pDummyInput->m_Fire += m_aInputData[g_Config.m_ClDummy].m_Fire - m_aLastData[g_Config.m_ClDummy].m_Fire;
|
||||
pDummyInput->m_NextWeapon += m_aInputData[g_Config.m_ClDummy].m_NextWeapon - m_aLastData[g_Config.m_ClDummy].m_NextWeapon;
|
||||
pDummyInput->m_PrevWeapon += m_aInputData[g_Config.m_ClDummy].m_PrevWeapon - m_aLastData[g_Config.m_ClDummy].m_PrevWeapon;
|
||||
|
||||
m_InputData[!g_Config.m_ClDummy] = *pDummyInput;
|
||||
m_aInputData[!g_Config.m_ClDummy] = *pDummyInput;
|
||||
}
|
||||
|
||||
if(g_Config.m_ClDummyControl)
|
||||
|
@ -284,51 +284,51 @@ int CControls::SnapInput(int *pData)
|
|||
if(g_Config.m_DbgStress)
|
||||
{
|
||||
float t = Client()->LocalTime();
|
||||
mem_zero(&m_InputData[g_Config.m_ClDummy], sizeof(m_InputData[0]));
|
||||
mem_zero(&m_aInputData[g_Config.m_ClDummy], sizeof(m_aInputData[0]));
|
||||
|
||||
m_InputData[g_Config.m_ClDummy].m_Direction = ((int)t / 2) & 1;
|
||||
m_InputData[g_Config.m_ClDummy].m_Jump = ((int)t);
|
||||
m_InputData[g_Config.m_ClDummy].m_Fire = ((int)(t * 10));
|
||||
m_InputData[g_Config.m_ClDummy].m_Hook = ((int)(t * 2)) & 1;
|
||||
m_InputData[g_Config.m_ClDummy].m_WantedWeapon = ((int)t) % NUM_WEAPONS;
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetX = (int)(sinf(t * 3) * 100.0f);
|
||||
m_InputData[g_Config.m_ClDummy].m_TargetY = (int)(cosf(t * 3) * 100.0f);
|
||||
m_aInputData[g_Config.m_ClDummy].m_Direction = ((int)t / 2) & 1;
|
||||
m_aInputData[g_Config.m_ClDummy].m_Jump = ((int)t);
|
||||
m_aInputData[g_Config.m_ClDummy].m_Fire = ((int)(t * 10));
|
||||
m_aInputData[g_Config.m_ClDummy].m_Hook = ((int)(t * 2)) & 1;
|
||||
m_aInputData[g_Config.m_ClDummy].m_WantedWeapon = ((int)t) % NUM_WEAPONS;
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetX = (int)(sinf(t * 3) * 100.0f);
|
||||
m_aInputData[g_Config.m_ClDummy].m_TargetY = (int)(cosf(t * 3) * 100.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
// check if we need to send input
|
||||
if(m_InputData[g_Config.m_ClDummy].m_Direction != m_LastData[g_Config.m_ClDummy].m_Direction)
|
||||
if(m_aInputData[g_Config.m_ClDummy].m_Direction != m_aLastData[g_Config.m_ClDummy].m_Direction)
|
||||
Send = true;
|
||||
else if(m_InputData[g_Config.m_ClDummy].m_Jump != m_LastData[g_Config.m_ClDummy].m_Jump)
|
||||
else if(m_aInputData[g_Config.m_ClDummy].m_Jump != m_aLastData[g_Config.m_ClDummy].m_Jump)
|
||||
Send = true;
|
||||
else if(m_InputData[g_Config.m_ClDummy].m_Fire != m_LastData[g_Config.m_ClDummy].m_Fire)
|
||||
else if(m_aInputData[g_Config.m_ClDummy].m_Fire != m_aLastData[g_Config.m_ClDummy].m_Fire)
|
||||
Send = true;
|
||||
else if(m_InputData[g_Config.m_ClDummy].m_Hook != m_LastData[g_Config.m_ClDummy].m_Hook)
|
||||
else if(m_aInputData[g_Config.m_ClDummy].m_Hook != m_aLastData[g_Config.m_ClDummy].m_Hook)
|
||||
Send = true;
|
||||
else if(m_InputData[g_Config.m_ClDummy].m_WantedWeapon != m_LastData[g_Config.m_ClDummy].m_WantedWeapon)
|
||||
else if(m_aInputData[g_Config.m_ClDummy].m_WantedWeapon != m_aLastData[g_Config.m_ClDummy].m_WantedWeapon)
|
||||
Send = true;
|
||||
else if(m_InputData[g_Config.m_ClDummy].m_NextWeapon != m_LastData[g_Config.m_ClDummy].m_NextWeapon)
|
||||
else if(m_aInputData[g_Config.m_ClDummy].m_NextWeapon != m_aLastData[g_Config.m_ClDummy].m_NextWeapon)
|
||||
Send = true;
|
||||
else if(m_InputData[g_Config.m_ClDummy].m_PrevWeapon != m_LastData[g_Config.m_ClDummy].m_PrevWeapon)
|
||||
else if(m_aInputData[g_Config.m_ClDummy].m_PrevWeapon != m_aLastData[g_Config.m_ClDummy].m_PrevWeapon)
|
||||
Send = true;
|
||||
|
||||
// send at at least 10hz
|
||||
if(time_get() > LastSendTime + time_freq() / 25)
|
||||
Send = true;
|
||||
|
||||
if(m_pClient->m_Snap.m_pLocalCharacter && m_pClient->m_Snap.m_pLocalCharacter->m_Weapon == WEAPON_NINJA && (m_InputData[g_Config.m_ClDummy].m_Direction || m_InputData[g_Config.m_ClDummy].m_Jump || m_InputData[g_Config.m_ClDummy].m_Hook))
|
||||
if(m_pClient->m_Snap.m_pLocalCharacter && m_pClient->m_Snap.m_pLocalCharacter->m_Weapon == WEAPON_NINJA && (m_aInputData[g_Config.m_ClDummy].m_Direction || m_aInputData[g_Config.m_ClDummy].m_Jump || m_aInputData[g_Config.m_ClDummy].m_Hook))
|
||||
Send = true;
|
||||
}
|
||||
|
||||
// copy and return size
|
||||
m_LastData[g_Config.m_ClDummy] = m_InputData[g_Config.m_ClDummy];
|
||||
m_aLastData[g_Config.m_ClDummy] = m_aInputData[g_Config.m_ClDummy];
|
||||
|
||||
if(!Send)
|
||||
return 0;
|
||||
|
||||
LastSendTime = time_get();
|
||||
mem_copy(pData, &m_InputData[g_Config.m_ClDummy], sizeof(m_InputData[0]));
|
||||
return sizeof(m_InputData[0]);
|
||||
mem_copy(pData, &m_aInputData[g_Config.m_ClDummy], sizeof(m_aInputData[0]));
|
||||
return sizeof(m_aInputData[0]);
|
||||
}
|
||||
|
||||
void CControls::OnRender()
|
||||
|
@ -336,9 +336,9 @@ void CControls::OnRender()
|
|||
if(g_Config.m_ClAutoswitchWeaponsOutOfAmmo && !GameClient()->m_GameInfo.m_UnlimitedAmmo && m_pClient->m_Snap.m_pLocalCharacter)
|
||||
{
|
||||
// Keep track of ammo count, we know weapon ammo only when we switch to that weapon, this is tracked on server and protocol does not track that
|
||||
m_AmmoCount[m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS] = m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount;
|
||||
m_aAmmoCount[m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS] = m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount;
|
||||
// Autoswitch weapon if we're out of ammo
|
||||
if(m_InputData[g_Config.m_ClDummy].m_Fire % 2 != 0 &&
|
||||
if(m_aInputData[g_Config.m_ClDummy].m_Fire % 2 != 0 &&
|
||||
m_pClient->m_Snap.m_pLocalCharacter->m_AmmoCount == 0 &&
|
||||
m_pClient->m_Snap.m_pLocalCharacter->m_Weapon != WEAPON_HAMMER &&
|
||||
m_pClient->m_Snap.m_pLocalCharacter->m_Weapon != WEAPON_NINJA)
|
||||
|
@ -348,21 +348,21 @@ void CControls::OnRender()
|
|||
{
|
||||
if(w == m_pClient->m_Snap.m_pLocalCharacter->m_Weapon)
|
||||
continue;
|
||||
if(m_AmmoCount[w] > 0)
|
||||
if(m_aAmmoCount[w] > 0)
|
||||
break;
|
||||
}
|
||||
if(w != m_pClient->m_Snap.m_pLocalCharacter->m_Weapon)
|
||||
m_InputData[g_Config.m_ClDummy].m_WantedWeapon = w + 1;
|
||||
m_aInputData[g_Config.m_ClDummy].m_WantedWeapon = w + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// update target pos
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj && !m_pClient->m_Snap.m_SpecInfo.m_Active)
|
||||
m_TargetPos[g_Config.m_ClDummy] = m_pClient->m_LocalCharacterPos + m_MousePos[g_Config.m_ClDummy];
|
||||
m_aTargetPos[g_Config.m_ClDummy] = m_pClient->m_LocalCharacterPos + m_aMousePos[g_Config.m_ClDummy];
|
||||
else if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_UsePosition)
|
||||
m_TargetPos[g_Config.m_ClDummy] = m_pClient->m_Snap.m_SpecInfo.m_Position + m_MousePos[g_Config.m_ClDummy];
|
||||
m_aTargetPos[g_Config.m_ClDummy] = m_pClient->m_Snap.m_SpecInfo.m_Position + m_aMousePos[g_Config.m_ClDummy];
|
||||
else
|
||||
m_TargetPos[g_Config.m_ClDummy] = m_MousePos[g_Config.m_ClDummy];
|
||||
m_aTargetPos[g_Config.m_ClDummy] = m_aMousePos[g_Config.m_ClDummy];
|
||||
}
|
||||
|
||||
bool CControls::OnCursorMove(float x, float y, IInput::ECursorType CursorType)
|
||||
|
@ -374,7 +374,7 @@ bool CControls::OnCursorMove(float x, float y, IInput::ECursorType CursorType)
|
|||
{
|
||||
float AbsX = 0.0f, AbsY = 0.0f;
|
||||
if(Input()->GetActiveJoystick()->Absolute(&AbsX, &AbsY))
|
||||
m_MousePos[g_Config.m_ClDummy] = vec2(AbsX, AbsY) * GetMaxMouseDistance();
|
||||
m_aMousePos[g_Config.m_ClDummy] = vec2(AbsX, AbsY) * GetMaxMouseDistance();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ bool CControls::OnCursorMove(float x, float y, IInput::ECursorType CursorType)
|
|||
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID < 0)
|
||||
Factor *= m_pClient->m_Camera.m_Zoom;
|
||||
|
||||
m_MousePos[g_Config.m_ClDummy] += vec2(x, y) * Factor;
|
||||
m_aMousePos[g_Config.m_ClDummy] += vec2(x, y) * Factor;
|
||||
ClampMousePos();
|
||||
return true;
|
||||
}
|
||||
|
@ -412,8 +412,8 @@ void CControls::ClampMousePos()
|
|||
{
|
||||
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID < 0)
|
||||
{
|
||||
m_MousePos[g_Config.m_ClDummy].x = clamp(m_MousePos[g_Config.m_ClDummy].x, 0.0f, Collision()->GetWidth() * 32.0f);
|
||||
m_MousePos[g_Config.m_ClDummy].y = clamp(m_MousePos[g_Config.m_ClDummy].y, 0.0f, Collision()->GetHeight() * 32.0f);
|
||||
m_aMousePos[g_Config.m_ClDummy].x = clamp(m_aMousePos[g_Config.m_ClDummy].x, 0.0f, Collision()->GetWidth() * 32.0f);
|
||||
m_aMousePos[g_Config.m_ClDummy].y = clamp(m_aMousePos[g_Config.m_ClDummy].y, 0.0f, Collision()->GetHeight() * 32.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -421,18 +421,18 @@ void CControls::ClampMousePos()
|
|||
float MinDistance = g_Config.m_ClDyncam ? g_Config.m_ClDyncamMinDistance : g_Config.m_ClMouseMinDistance;
|
||||
float MouseMin = MinDistance;
|
||||
|
||||
float MDistance = length(m_MousePos[g_Config.m_ClDummy]);
|
||||
float MDistance = length(m_aMousePos[g_Config.m_ClDummy]);
|
||||
if(MDistance < 0.001f)
|
||||
{
|
||||
m_MousePos[g_Config.m_ClDummy].x = 0.001f;
|
||||
m_MousePos[g_Config.m_ClDummy].y = 0;
|
||||
m_aMousePos[g_Config.m_ClDummy].x = 0.001f;
|
||||
m_aMousePos[g_Config.m_ClDummy].y = 0;
|
||||
MDistance = 0.001f;
|
||||
}
|
||||
if(MDistance < MouseMin)
|
||||
m_MousePos[g_Config.m_ClDummy] = normalize_pre_length(m_MousePos[g_Config.m_ClDummy], MDistance) * MouseMin;
|
||||
MDistance = length(m_MousePos[g_Config.m_ClDummy]);
|
||||
m_aMousePos[g_Config.m_ClDummy] = normalize_pre_length(m_aMousePos[g_Config.m_ClDummy], MDistance) * MouseMin;
|
||||
MDistance = length(m_aMousePos[g_Config.m_ClDummy]);
|
||||
if(MDistance > MouseMax)
|
||||
m_MousePos[g_Config.m_ClDummy] = normalize_pre_length(m_MousePos[g_Config.m_ClDummy], MDistance) * MouseMax;
|
||||
m_aMousePos[g_Config.m_ClDummy] = normalize_pre_length(m_aMousePos[g_Config.m_ClDummy], MDistance) * MouseMax;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,18 @@ class CControls : public CComponent
|
|||
float GetMaxMouseDistance() const;
|
||||
|
||||
public:
|
||||
vec2 m_MousePos[NUM_DUMMIES];
|
||||
vec2 m_TargetPos[NUM_DUMMIES];
|
||||
vec2 m_aMousePos[NUM_DUMMIES];
|
||||
vec2 m_aTargetPos[NUM_DUMMIES];
|
||||
float m_OldMouseX;
|
||||
float m_OldMouseY;
|
||||
|
||||
int m_AmmoCount[NUM_WEAPONS];
|
||||
int m_aAmmoCount[NUM_WEAPONS];
|
||||
|
||||
CNetObj_PlayerInput m_InputData[NUM_DUMMIES];
|
||||
CNetObj_PlayerInput m_LastData[NUM_DUMMIES];
|
||||
int m_InputDirectionLeft[NUM_DUMMIES];
|
||||
int m_InputDirectionRight[NUM_DUMMIES];
|
||||
int m_ShowHookColl[NUM_DUMMIES];
|
||||
CNetObj_PlayerInput m_aInputData[NUM_DUMMIES];
|
||||
CNetObj_PlayerInput m_aLastData[NUM_DUMMIES];
|
||||
int m_aInputDirectionLeft[NUM_DUMMIES];
|
||||
int m_aInputDirectionRight[NUM_DUMMIES];
|
||||
int m_aShowHookColl[NUM_DUMMIES];
|
||||
int m_LastDummy;
|
||||
int m_OtherFire;
|
||||
|
||||
|
|
|
@ -96,12 +96,12 @@ void CCountryFlags::LoadCountryflagsIndexfile()
|
|||
|
||||
// init LUT
|
||||
if(DefaultIndex != 0)
|
||||
for(size_t &CodeIndexLUT : m_CodeIndexLUT)
|
||||
for(size_t &CodeIndexLUT : m_aCodeIndexLUT)
|
||||
CodeIndexLUT = DefaultIndex;
|
||||
else
|
||||
mem_zero(m_CodeIndexLUT, sizeof(m_CodeIndexLUT));
|
||||
mem_zero(m_aCodeIndexLUT, sizeof(m_aCodeIndexLUT));
|
||||
for(size_t i = 0; i < m_vCountryFlags.size(); ++i)
|
||||
m_CodeIndexLUT[maximum(0, (m_vCountryFlags[i].m_CountryCode - CODE_LB) % CODE_RANGE)] = i;
|
||||
m_aCodeIndexLUT[maximum(0, (m_vCountryFlags[i].m_CountryCode - CODE_LB) % CODE_RANGE)] = i;
|
||||
}
|
||||
|
||||
void CCountryFlags::OnInit()
|
||||
|
@ -132,7 +132,7 @@ size_t CCountryFlags::Num() const
|
|||
|
||||
const CCountryFlags::CCountryFlag *CCountryFlags::GetByCountryCode(int CountryCode) const
|
||||
{
|
||||
return GetByIndex(m_CodeIndexLUT[maximum(0, (CountryCode - CODE_LB) % CODE_RANGE)]);
|
||||
return GetByIndex(m_aCodeIndexLUT[maximum(0, (CountryCode - CODE_LB) % CODE_RANGE)]);
|
||||
}
|
||||
|
||||
const CCountryFlags::CCountryFlag *CCountryFlags::GetByIndex(size_t Index) const
|
||||
|
|
|
@ -34,7 +34,7 @@ private:
|
|||
CODE_RANGE = CODE_UB - CODE_LB + 1,
|
||||
};
|
||||
std::vector<CCountryFlag> m_vCountryFlags;
|
||||
size_t m_CodeIndexLUT[CODE_RANGE];
|
||||
size_t m_aCodeIndexLUT[CODE_RANGE];
|
||||
|
||||
int m_FlagsQuadContainerIndex;
|
||||
|
||||
|
|
|
@ -27,21 +27,21 @@ CDamageInd::CItem *CDamageInd::CreateI()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CDamageInd::DestroyI(CDamageInd::CItem *i)
|
||||
void CDamageInd::DestroyI(CDamageInd::CItem *pItem)
|
||||
{
|
||||
m_NumItems--;
|
||||
*i = m_aItems[m_NumItems];
|
||||
*pItem = m_aItems[m_NumItems];
|
||||
}
|
||||
|
||||
void CDamageInd::Create(vec2 Pos, vec2 Dir)
|
||||
{
|
||||
CItem *i = CreateI();
|
||||
if(i)
|
||||
CItem *pItem = CreateI();
|
||||
if(pItem)
|
||||
{
|
||||
i->m_Pos = Pos;
|
||||
i->m_StartTime = LocalTime();
|
||||
i->m_Dir = Dir * -1;
|
||||
i->m_StartAngle = (random_float() - 1.0f) * 2.0f * pi;
|
||||
pItem->m_Pos = Pos;
|
||||
pItem->m_StartTime = LocalTime();
|
||||
pItem->m_Dir = Dir * -1;
|
||||
pItem->m_StartAngle = (random_float() - 1.0f) * 2.0f * pi;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class CDamageInd : public CComponent
|
|||
int m_NumItems;
|
||||
|
||||
CItem *CreateI();
|
||||
void DestroyI(CItem *i);
|
||||
void DestroyI(CItem *pItem);
|
||||
|
||||
int m_DmgIndQuadContainerIndex;
|
||||
|
||||
|
|
|
@ -24,16 +24,16 @@ void CDebugHud::RenderNetCorrections()
|
|||
float Velspeed = length(vec2(m_pClient->m_Snap.m_pLocalCharacter->m_VelX / 256.0f, m_pClient->m_Snap.m_pLocalCharacter->m_VelY / 256.0f)) * TicksPerSecond;
|
||||
float VelspeedX = m_pClient->m_Snap.m_pLocalCharacter->m_VelX / 256.0f * TicksPerSecond;
|
||||
float VelspeedY = m_pClient->m_Snap.m_pLocalCharacter->m_VelY / 256.0f * TicksPerSecond;
|
||||
float Ramp = VelocityRamp(Velspeed, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
float Ramp = VelocityRamp(Velspeed, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
|
||||
const char *apStrings[] = {"velspeed:", "velspeed.x*ramp:", "velspeed.y:", "ramp:", "checkpoint:", "Pos", " x:", " y:", "angle:", "netobj corrections", " num:", " on:"};
|
||||
const int Num = std::size(apStrings);
|
||||
static const char *s_apStrings[] = {"velspeed:", "velspeed.x*ramp:", "velspeed.y:", "ramp:", "checkpoint:", "Pos", " x:", " y:", "angle:", "netobj corrections", " num:", " on:"};
|
||||
const int Num = std::size(s_apStrings);
|
||||
const float LineHeight = 6.0f;
|
||||
const float Fontsize = 5.0f;
|
||||
|
||||
float x = Width - 100.0f, y = 50.0f;
|
||||
for(int i = 0; i < Num; ++i)
|
||||
TextRender()->Text(0, x, y + i * LineHeight, Fontsize, apStrings[i], -1.0f);
|
||||
TextRender()->Text(0, x, y + i * LineHeight, Fontsize, s_apStrings[i], -1.0f);
|
||||
|
||||
x = Width - 10.0f;
|
||||
char aBuf[128];
|
||||
|
@ -97,7 +97,7 @@ void CDebugHud::RenderTuning()
|
|||
{
|
||||
char aBuf[128];
|
||||
float Current, Standard;
|
||||
m_pClient->m_Tuning[g_Config.m_ClDummy].Get(i, &Current);
|
||||
m_pClient->m_aTuning[g_Config.m_ClDummy].Get(i, &Current);
|
||||
StandardTuning.Get(i, &Standard);
|
||||
|
||||
if(Standard == Current)
|
||||
|
@ -132,14 +132,14 @@ void CDebugHud::RenderTuning()
|
|||
float GraphX = GraphW;
|
||||
float GraphY = Graphics()->ScreenHeight() - GraphH - sp;
|
||||
|
||||
CTuningParams *ClinetTuning = &m_pClient->m_Tuning[g_Config.m_ClDummy];
|
||||
CTuningParams *pClientTuning = &m_pClient->m_aTuning[g_Config.m_ClDummy];
|
||||
const int StepSizeRampGraph = 270;
|
||||
const int StepSizeZoomedInGraph = 14;
|
||||
if(m_OldVelrampStart != ClinetTuning->m_VelrampStart || m_OldVelrampRange != ClinetTuning->m_VelrampRange || m_OldVelrampCurvature != ClinetTuning->m_VelrampCurvature)
|
||||
if(m_OldVelrampStart != pClientTuning->m_VelrampStart || m_OldVelrampRange != pClientTuning->m_VelrampRange || m_OldVelrampCurvature != pClientTuning->m_VelrampCurvature)
|
||||
{
|
||||
m_OldVelrampStart = ClinetTuning->m_VelrampStart;
|
||||
m_OldVelrampRange = ClinetTuning->m_VelrampRange;
|
||||
m_OldVelrampCurvature = ClinetTuning->m_VelrampCurvature;
|
||||
m_OldVelrampStart = pClientTuning->m_VelrampStart;
|
||||
m_OldVelrampRange = pClientTuning->m_VelrampRange;
|
||||
m_OldVelrampCurvature = pClientTuning->m_VelrampCurvature;
|
||||
|
||||
m_RampGraph.Init(0.0f, 0.0f);
|
||||
m_SpeedTurningPoint = 0;
|
||||
|
@ -149,7 +149,7 @@ void CDebugHud::RenderTuning()
|
|||
{
|
||||
// This is a calculation of the speed values per second on the X axis, from 270 to 34560 in steps of 270
|
||||
float Speed = (i + 1) * StepSizeRampGraph;
|
||||
float Ramp = VelocityRamp(Speed, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
float Ramp = VelocityRamp(Speed, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
float RampedSpeed = Speed * Ramp;
|
||||
if(RampedSpeed >= pv)
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ void CDebugHud::RenderTuning()
|
|||
{
|
||||
// This is a calculation of the speed values per second on the X axis, from (MiddleOfZoomedInGraph - 64 * StepSize) to (MiddleOfZoomedInGraph + 64 * StepSize)
|
||||
float Speed = MiddleOfZoomedInGraph - 64 * StepSizeZoomedInGraph + i * StepSizeZoomedInGraph;
|
||||
float Ramp = VelocityRamp(Speed, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
float Ramp = VelocityRamp(Speed, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
float RampedSpeed = Speed * Ramp;
|
||||
if(RampedSpeed >= pv)
|
||||
{
|
||||
|
|
|
@ -141,7 +141,7 @@ void CEmoticon::OnRender()
|
|||
DrawCircle(Screen.w / 2, Screen.h / 2, 100.0f, 64);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
CTeeRenderInfo *pTeeInfo = &m_pClient->m_aClients[m_pClient->m_LocalIDs[g_Config.m_ClDummy]].m_RenderInfo;
|
||||
CTeeRenderInfo *pTeeInfo = &m_pClient->m_aClients[m_pClient->m_aLocalIDs[g_Config.m_ClDummy]].m_RenderInfo;
|
||||
|
||||
for(int i = 0; i < NUM_EMOTES; i++)
|
||||
{
|
||||
|
|
|
@ -347,7 +347,7 @@ void CGhost::OnRender()
|
|||
|
||||
Player.m_AttackTick += Client()->GameTick(g_Config.m_ClDummy) - GhostTick;
|
||||
|
||||
CTeeRenderInfo *RenderInfo = &Ghost.m_RenderInfo;
|
||||
CTeeRenderInfo *pRenderInfo = &Ghost.m_RenderInfo;
|
||||
CTeeRenderInfo GhostNinjaRenderInfo;
|
||||
if(Player.m_Weapon == WEAPON_NINJA && g_Config.m_ClShowNinja)
|
||||
{
|
||||
|
@ -371,13 +371,13 @@ void CGhost::OnRender()
|
|||
GhostNinjaRenderInfo.m_ColorBody = ColorRGBA(1, 1, 1);
|
||||
GhostNinjaRenderInfo.m_ColorFeet = ColorRGBA(1, 1, 1);
|
||||
}
|
||||
RenderInfo = &GhostNinjaRenderInfo;
|
||||
pRenderInfo = &GhostNinjaRenderInfo;
|
||||
}
|
||||
}
|
||||
|
||||
m_pClient->m_Players.RenderHook(&Prev, &Player, RenderInfo, -2, IntraTick);
|
||||
m_pClient->m_Players.RenderHook(&Prev, &Player, pRenderInfo, -2, IntraTick);
|
||||
m_pClient->m_Players.RenderHookCollLine(&Prev, &Player, -2, IntraTick);
|
||||
m_pClient->m_Players.RenderPlayer(&Prev, &Player, RenderInfo, -2, IntraTick);
|
||||
m_pClient->m_Players.RenderPlayer(&Prev, &Player, pRenderInfo, -2, IntraTick);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,9 @@ void CHud::OnReset()
|
|||
m_TimeCpLastReceivedTick = 0;
|
||||
m_ShowFinishTime = false;
|
||||
m_ServerRecord = -1.0f;
|
||||
m_PlayerRecord[0] = -1.0f;
|
||||
m_PlayerRecord[1] = -1.0f;
|
||||
m_aPlayerRecord[0] = -1.0f;
|
||||
m_aPlayerRecord[1] = -1.0f;
|
||||
|
||||
ResetHudContainers();
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,7 @@ void CHud::OnInit()
|
|||
{
|
||||
float ScaleX, ScaleY;
|
||||
RenderTools()->GetSpriteScale(g_pData->m_Weapons.m_aId[i].m_pSpriteCursor, ScaleX, ScaleY);
|
||||
m_CursorOffset[i] = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
m_aCursorOffset[i] = RenderTools()->QuadContainerAddSprite(m_HudQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
}
|
||||
|
||||
// the flags
|
||||
|
@ -176,16 +177,16 @@ void CHud::RenderScoreHud()
|
|||
str_format(aScoreTeam[TEAM_RED], sizeof(aScoreTeam), "%d", m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreRed);
|
||||
str_format(aScoreTeam[TEAM_BLUE], sizeof(aScoreTeam), "%d", m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreBlue);
|
||||
|
||||
bool RecreateTeamScore[2] = {str_comp(aScoreTeam[0], m_aScoreInfo[0].m_aScoreText) != 0, str_comp(aScoreTeam[1], m_aScoreInfo[1].m_aScoreText) != 0};
|
||||
bool aRecreateTeamScore[2] = {str_comp(aScoreTeam[0], m_aScoreInfo[0].m_aScoreText) != 0, str_comp(aScoreTeam[1], m_aScoreInfo[1].m_aScoreText) != 0};
|
||||
|
||||
int FlagCarrier[2] = {
|
||||
int aFlagCarrier[2] = {
|
||||
m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierRed,
|
||||
m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue};
|
||||
|
||||
bool RecreateRect = ForceScoreInfoInit;
|
||||
for(int t = 0; t < 2; t++)
|
||||
{
|
||||
if(RecreateTeamScore[t])
|
||||
if(aRecreateTeamScore[t])
|
||||
{
|
||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(0, 14.0f, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], -1, -1.0f);
|
||||
mem_copy(m_aScoreInfo[t].m_aScoreText, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], sizeof(m_aScoreInfo[t].m_aScoreText));
|
||||
|
@ -217,7 +218,7 @@ void CHud::RenderScoreHud()
|
|||
Graphics()->RenderQuadContainer(m_aScoreInfo[t].m_RoundRectQuadContainerIndex, -1);
|
||||
|
||||
// draw score
|
||||
if(RecreateTeamScore[t])
|
||||
if(aRecreateTeamScore[t])
|
||||
{
|
||||
if(m_aScoreInfo[t].m_TextScoreContainerIndex != -1)
|
||||
TextRender()->DeleteTextContainer(m_aScoreInfo[t].m_TextScoreContainerIndex);
|
||||
|
@ -236,21 +237,21 @@ void CHud::RenderScoreHud()
|
|||
|
||||
if(GameFlags & GAMEFLAG_FLAGS)
|
||||
{
|
||||
int BlinkTimer = (m_pClient->m_FlagDropTick[t] != 0 &&
|
||||
(Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_FlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ?
|
||||
int BlinkTimer = (m_pClient->m_aFlagDropTick[t] != 0 &&
|
||||
(Client()->GameTick(g_Config.m_ClDummy) - m_pClient->m_aFlagDropTick[t]) / Client()->GameTickSpeed() >= 25) ?
|
||||
10 :
|
||||
20;
|
||||
if(FlagCarrier[t] == FLAG_ATSTAND || (FlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick(g_Config.m_ClDummy) / BlinkTimer) & 1)))
|
||||
if(aFlagCarrier[t] == FLAG_ATSTAND || (aFlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick(g_Config.m_ClDummy) / BlinkTimer) & 1)))
|
||||
{
|
||||
// draw flag
|
||||
Graphics()->TextureSet(t == 0 ? m_pClient->m_GameSkin.m_SpriteFlagRed : m_pClient->m_GameSkin.m_SpriteFlagBlue);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_FlagOffset, m_Width - ScoreWidthMax - ImageSize, StartY + 1.0f + t * 20);
|
||||
}
|
||||
else if(FlagCarrier[t] >= 0)
|
||||
else if(aFlagCarrier[t] >= 0)
|
||||
{
|
||||
// draw name of the flag holder
|
||||
int ID = FlagCarrier[t] % MAX_CLIENTS;
|
||||
int ID = aFlagCarrier[t] % MAX_CLIENTS;
|
||||
const char *pName = m_pClient->m_aClients[ID].m_aName;
|
||||
if(str_comp(pName, m_aScoreInfo[t].m_aPlayerNameText) != 0 || RecreateRect)
|
||||
{
|
||||
|
@ -295,11 +296,11 @@ void CHud::RenderScoreHud()
|
|||
int aPos[2] = {1, 2};
|
||||
const CNetObj_PlayerInfo *apPlayerInfo[2] = {0, 0};
|
||||
int i = 0;
|
||||
for(int t = 0; t < 2 && i < MAX_CLIENTS && m_pClient->m_Snap.m_paInfoByScore[i]; ++i)
|
||||
for(int t = 0; t < 2 && i < MAX_CLIENTS && m_pClient->m_Snap.m_apInfoByScore[i]; ++i)
|
||||
{
|
||||
if(m_pClient->m_Snap.m_paInfoByScore[i]->m_Team != TEAM_SPECTATORS)
|
||||
if(m_pClient->m_Snap.m_apInfoByScore[i]->m_Team != TEAM_SPECTATORS)
|
||||
{
|
||||
apPlayerInfo[t] = m_pClient->m_Snap.m_paInfoByScore[i];
|
||||
apPlayerInfo[t] = m_pClient->m_Snap.m_apInfoByScore[i];
|
||||
if(apPlayerInfo[t]->m_ClientID == m_pClient->m_Snap.m_LocalClientID)
|
||||
Local = t;
|
||||
++t;
|
||||
|
@ -308,13 +309,13 @@ void CHud::RenderScoreHud()
|
|||
// search local player info if not a spectator, nor within top2 scores
|
||||
if(Local == -1 && m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
|
||||
{
|
||||
for(; i < MAX_CLIENTS && m_pClient->m_Snap.m_paInfoByScore[i]; ++i)
|
||||
for(; i < MAX_CLIENTS && m_pClient->m_Snap.m_apInfoByScore[i]; ++i)
|
||||
{
|
||||
if(m_pClient->m_Snap.m_paInfoByScore[i]->m_Team != TEAM_SPECTATORS)
|
||||
if(m_pClient->m_Snap.m_apInfoByScore[i]->m_Team != TEAM_SPECTATORS)
|
||||
++aPos[1];
|
||||
if(m_pClient->m_Snap.m_paInfoByScore[i]->m_ClientID == m_pClient->m_Snap.m_LocalClientID)
|
||||
if(m_pClient->m_Snap.m_apInfoByScore[i]->m_ClientID == m_pClient->m_Snap.m_LocalClientID)
|
||||
{
|
||||
apPlayerInfo[1] = m_pClient->m_Snap.m_paInfoByScore[i];
|
||||
apPlayerInfo[1] = m_pClient->m_Snap.m_apInfoByScore[i];
|
||||
Local = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -524,13 +525,13 @@ void CHud::RenderTextInfo()
|
|||
static float s_TextWidth000 = TextRender()->TextWidth(0, 12.f, "000", -1, -1.0f);
|
||||
static float s_TextWidth0000 = TextRender()->TextWidth(0, 12.f, "0000", -1, -1.0f);
|
||||
static float s_TextWidth00000 = TextRender()->TextWidth(0, 12.f, "00000", -1, -1.0f);
|
||||
static float s_TextWidth[5] = {s_TextWidth0, s_TextWidth00, s_TextWidth000, s_TextWidth0000, s_TextWidth00000};
|
||||
static float s_aTextWidth[5] = {s_TextWidth0, s_TextWidth00, s_TextWidth000, s_TextWidth0000, s_TextWidth00000};
|
||||
|
||||
int DigitIndex = GetDigitsIndex(FrameTime, 4);
|
||||
//TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,Buf,-1,-1.0f), 5, 12, Buf, -1.0f);
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, m_Width - 10 - s_TextWidth[DigitIndex], 5, 12, TEXTFLAG_RENDER);
|
||||
TextRender()->SetCursor(&Cursor, m_Width - 10 - s_aTextWidth[DigitIndex], 5, 12, TEXTFLAG_RENDER);
|
||||
Cursor.m_LineWidth = -1;
|
||||
auto OldFlags = TextRender()->GetRenderFlags();
|
||||
TextRender()->SetRenderFlags(OldFlags | TEXT_RENDER_FLAG_ONE_TIME_USE);
|
||||
|
@ -640,7 +641,7 @@ void CHud::RenderCursor()
|
|||
int CurWeapon = m_pClient->m_Snap.m_pLocalCharacter->m_Weapon % NUM_WEAPONS;
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, 1.f);
|
||||
Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponCursors[CurWeapon]);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_CursorOffset[CurWeapon], m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy].y);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_HudQuadContainerIndex, m_aCursorOffset[CurWeapon], m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy].x, m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy].y);
|
||||
}
|
||||
|
||||
void CHud::PrepareAmmoHealthAndArmorQuads()
|
||||
|
@ -656,7 +657,7 @@ void CHud::PrepareAmmoHealthAndArmorQuads()
|
|||
for(int n = 0; n < 10; n++)
|
||||
Array[n] = IGraphics::CQuadItem(x + n * 12, y, 10, 10);
|
||||
|
||||
m_AmmoOffset[i] = Graphics()->QuadContainerAddQuads(m_HudQuadContainerIndex, Array, 10);
|
||||
m_aAmmoOffset[i] = Graphics()->QuadContainerAddQuads(m_HudQuadContainerIndex, Array, 10);
|
||||
|
||||
// 0.7
|
||||
if(i == WEAPON_GRENADE)
|
||||
|
@ -733,11 +734,11 @@ void CHud::RenderAmmoHealthAndArmor(const CNetObj_Character *pCharacter)
|
|||
Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon]);
|
||||
if(AmmoOffsetY > 0)
|
||||
{
|
||||
Graphics()->RenderQuadContainerEx(m_HudQuadContainerIndex, m_AmmoOffset[CurWeapon] + QuadOffsetSixup, minimum(pCharacter->m_AmmoCount, 10), 0, AmmoOffsetY);
|
||||
Graphics()->RenderQuadContainerEx(m_HudQuadContainerIndex, m_aAmmoOffset[CurWeapon] + QuadOffsetSixup, minimum(pCharacter->m_AmmoCount, 10), 0, AmmoOffsetY);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, m_AmmoOffset[CurWeapon] + QuadOffsetSixup, minimum(pCharacter->m_AmmoCount, 10));
|
||||
Graphics()->RenderQuadContainer(m_HudQuadContainerIndex, m_aAmmoOffset[CurWeapon] + QuadOffsetSixup, minimum(pCharacter->m_AmmoCount, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1382,29 +1383,29 @@ void CHud::RenderMovementInformation(const int ClientID)
|
|||
Graphics()->QuadsEnd();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
CNetObj_Character *Character = &m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur;
|
||||
CNetObj_Character *pCharacter = &m_pClient->m_Snap.m_aCharacters[ClientID].m_Cur;
|
||||
const float TicksPerSecond = 50.0f;
|
||||
|
||||
// To make the player position relative to blocks we need to divide by the block size
|
||||
float PosX = Character->m_X / 32.0f;
|
||||
float PosY = Character->m_Y / 32.0f;
|
||||
float PosX = pCharacter->m_X / 32.0f;
|
||||
float PosY = pCharacter->m_Y / 32.0f;
|
||||
|
||||
float VelspeedX = Character->m_VelX / 256.0f * TicksPerSecond;
|
||||
if(Character->m_VelX >= -1 && Character->m_VelX <= 1)
|
||||
float VelspeedX = pCharacter->m_VelX / 256.0f * TicksPerSecond;
|
||||
if(pCharacter->m_VelX >= -1 && pCharacter->m_VelX <= 1)
|
||||
{
|
||||
VelspeedX = 0;
|
||||
}
|
||||
float VelspeedY = Character->m_VelY / 256.0f * TicksPerSecond;
|
||||
if(Character->m_VelY >= -128 && Character->m_VelY <= 128)
|
||||
float VelspeedY = pCharacter->m_VelY / 256.0f * TicksPerSecond;
|
||||
if(pCharacter->m_VelY >= -128 && pCharacter->m_VelY <= 128)
|
||||
{
|
||||
VelspeedY = 0;
|
||||
}
|
||||
// We show the speed in Blocks per Second (Bps) and therefore have to divide by the block size
|
||||
float DisplaySpeedX = VelspeedX / 32;
|
||||
float VelspeedLength = length(vec2(Character->m_VelX / 256.0f, Character->m_VelY / 256.0f)) * TicksPerSecond;
|
||||
float VelspeedLength = length(vec2(pCharacter->m_VelX / 256.0f, pCharacter->m_VelY / 256.0f)) * TicksPerSecond;
|
||||
// Todo: Use Velramp tuning of each individual player
|
||||
// Since these tuning parameters are almost never changed, the default values are sufficient in most cases
|
||||
float Ramp = VelocityRamp(VelspeedLength, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_Tuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
float Ramp = VelocityRamp(VelspeedLength, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampStart, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampRange, m_pClient->m_aTuning[g_Config.m_ClDummy].m_VelrampCurvature);
|
||||
DisplaySpeedX *= Ramp;
|
||||
float DisplaySpeedY = VelspeedY / 32;
|
||||
|
||||
|
@ -1412,12 +1413,12 @@ void CHud::RenderMovementInformation(const int ClientID)
|
|||
if(m_pClient->m_Snap.m_aCharacters[ClientID].m_HasExtendedDisplayInfo)
|
||||
{
|
||||
// On DDNet servers the more accurate angle is displayed, calculated from the target coordinates
|
||||
CNetObj_DDNetCharacter *ExtendedData = &m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedData;
|
||||
Angle = atan2f(ExtendedData->m_TargetY, ExtendedData->m_TargetX);
|
||||
CNetObj_DDNetCharacter *pExtendedData = &m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedData;
|
||||
Angle = atan2f(pExtendedData->m_TargetY, pExtendedData->m_TargetX);
|
||||
}
|
||||
else
|
||||
{
|
||||
Angle = Character->m_Angle / 256.0f;
|
||||
Angle = pCharacter->m_Angle / 256.0f;
|
||||
}
|
||||
if(Angle < 0)
|
||||
{
|
||||
|
@ -1439,14 +1440,14 @@ void CHud::RenderMovementInformation(const int ClientID)
|
|||
static float s_TextWidth0000 = TextRender()->TextWidth(0, Fontsize, "0000.00", -1, -1.0f);
|
||||
static float s_TextWidth00000 = TextRender()->TextWidth(0, Fontsize, "00000.00", -1, -1.0f);
|
||||
static float s_TextWidth000000 = TextRender()->TextWidth(0, Fontsize, "000000.00", -1, -1.0f);
|
||||
static float s_TextWidth[6] = {s_TextWidth0, s_TextWidth00, s_TextWidth000, s_TextWidth0000, s_TextWidth00000, s_TextWidth000000};
|
||||
static float s_aTextWidth[6] = {s_TextWidth0, s_TextWidth00, s_TextWidth000, s_TextWidth0000, s_TextWidth00000, s_TextWidth000000};
|
||||
static float s_TextWidthMinus0 = TextRender()->TextWidth(0, Fontsize, "-0.00", -1, -1.0f);
|
||||
static float s_TextWidthMinus00 = TextRender()->TextWidth(0, Fontsize, "-00.00", -1, -1.0f);
|
||||
static float s_TextWidthMinus000 = TextRender()->TextWidth(0, Fontsize, "-000.00", -1, -1.0f);
|
||||
static float s_TextWidthMinus0000 = TextRender()->TextWidth(0, Fontsize, "-0000.00", -1, -1.0f);
|
||||
static float s_TextWidthMinus00000 = TextRender()->TextWidth(0, Fontsize, "-00000.00", -1, -1.0f);
|
||||
static float s_TextWidthMinus000000 = TextRender()->TextWidth(0, Fontsize, "-000000.00", -1, -1.0f);
|
||||
static float s_TextWidthMinus[6] = {s_TextWidthMinus0, s_TextWidthMinus00, s_TextWidthMinus000, s_TextWidthMinus0000, s_TextWidthMinus00000, s_TextWidthMinus000000};
|
||||
static float s_aTextWidthMinus[6] = {s_TextWidthMinus0, s_TextWidthMinus00, s_TextWidthMinus000, s_TextWidthMinus0000, s_TextWidthMinus00000, s_TextWidthMinus000000};
|
||||
|
||||
if(g_Config.m_ClShowhudPlayerPosition)
|
||||
{
|
||||
|
@ -1456,14 +1457,14 @@ void CHud::RenderMovementInformation(const int ClientID)
|
|||
TextRender()->Text(0, xl, y, Fontsize, "X:", -1.0f);
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", PosX);
|
||||
DigitsIndex = GetDigitsIndex(PosX, 5);
|
||||
w = (PosX < 0) ? s_TextWidthMinus[DigitsIndex] : s_TextWidth[DigitsIndex];
|
||||
w = (PosX < 0) ? s_aTextWidthMinus[DigitsIndex] : s_aTextWidth[DigitsIndex];
|
||||
TextRender()->Text(0, xr - w, y, Fontsize, aBuf, -1.0f);
|
||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||
|
||||
TextRender()->Text(0, xl, y, Fontsize, "Y:", -1.0f);
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", PosY);
|
||||
DigitsIndex = GetDigitsIndex(PosY, 5);
|
||||
w = (PosY < 0) ? s_TextWidthMinus[DigitsIndex] : s_TextWidth[DigitsIndex];
|
||||
w = (PosY < 0) ? s_aTextWidthMinus[DigitsIndex] : s_aTextWidth[DigitsIndex];
|
||||
TextRender()->Text(0, xr - w, y, Fontsize, aBuf, -1.0f);
|
||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||
}
|
||||
|
@ -1476,14 +1477,14 @@ void CHud::RenderMovementInformation(const int ClientID)
|
|||
TextRender()->Text(0, xl, y, Fontsize, "X:", -1.0f);
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", DisplaySpeedX);
|
||||
DigitsIndex = GetDigitsIndex(DisplaySpeedX, 5);
|
||||
w = (DisplaySpeedX < 0) ? s_TextWidthMinus[DigitsIndex] : s_TextWidth[DigitsIndex];
|
||||
w = (DisplaySpeedX < 0) ? s_aTextWidthMinus[DigitsIndex] : s_aTextWidth[DigitsIndex];
|
||||
TextRender()->Text(0, xr - w, y, Fontsize, aBuf, -1.0f);
|
||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||
|
||||
TextRender()->Text(0, xl, y, Fontsize, "Y:", -1.0f);
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", DisplaySpeedY);
|
||||
DigitsIndex = GetDigitsIndex(DisplaySpeedY, 5);
|
||||
w = (DisplaySpeedY < 0) ? s_TextWidthMinus[DigitsIndex] : s_TextWidth[DigitsIndex];
|
||||
w = (DisplaySpeedY < 0) ? s_aTextWidthMinus[DigitsIndex] : s_aTextWidth[DigitsIndex];
|
||||
TextRender()->Text(0, xr - w, y, Fontsize, aBuf, -1.0f);
|
||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||
}
|
||||
|
@ -1494,7 +1495,7 @@ void CHud::RenderMovementInformation(const int ClientID)
|
|||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", DisplayAngle);
|
||||
DigitsIndex = GetDigitsIndex(DisplayAngle, 5);
|
||||
w = (DisplayAngle < 0) ? s_TextWidthMinus[DigitsIndex] : s_TextWidth[DigitsIndex];
|
||||
w = (DisplayAngle < 0) ? s_aTextWidthMinus[DigitsIndex] : s_aTextWidth[DigitsIndex];
|
||||
TextRender()->Text(0, xr - w, y, Fontsize, aBuf, -1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -1640,7 +1641,7 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
|
|||
else if(MsgType == NETMSGTYPE_SV_RECORD || m_pClient->m_GameInfo.m_RaceRecordMessage)
|
||||
{
|
||||
m_ServerRecord = (float)pMsg->m_ServerTimeBest / 100;
|
||||
m_PlayerRecord[g_Config.m_ClDummy] = (float)pMsg->m_PlayerTimeBest / 100;
|
||||
m_aPlayerRecord[g_Config.m_ClDummy] = (float)pMsg->m_PlayerTimeBest / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1731,7 +1732,7 @@ void CHud::RenderRecord()
|
|||
TextRender()->Text(0, 53, 75, 6, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
const float PlayerRecord = m_PlayerRecord[g_Config.m_ClDummy];
|
||||
const float PlayerRecord = m_aPlayerRecord[g_Config.m_ClDummy];
|
||||
if(PlayerRecord > 0.0f)
|
||||
{
|
||||
char aBuf[64];
|
||||
|
|
|
@ -87,7 +87,7 @@ private:
|
|||
void RenderDDRaceEffects();
|
||||
float m_TimeCpDiff;
|
||||
float m_ServerRecord;
|
||||
float m_PlayerRecord[NUM_DUMMIES];
|
||||
float m_aPlayerRecord[NUM_DUMMIES];
|
||||
float m_FinishTimeDiff;
|
||||
int m_DDRaceTime;
|
||||
int m_FinishTimeLastReceivedTick;
|
||||
|
@ -98,12 +98,12 @@ private:
|
|||
inline int GetDigitsIndex(int Value, int Max);
|
||||
|
||||
// Quad Offsets
|
||||
int m_AmmoOffset[NUM_WEAPONS];
|
||||
int m_aAmmoOffset[NUM_WEAPONS];
|
||||
int m_HealthOffset;
|
||||
int m_EmptyHealthOffset;
|
||||
int m_ArmorOffset;
|
||||
int m_EmptyArmorOffset;
|
||||
int m_CursorOffset[NUM_WEAPONS];
|
||||
int m_aCursorOffset[NUM_WEAPONS];
|
||||
int m_FlagOffset;
|
||||
int m_AirjumpOffset;
|
||||
int m_AirjumpEmptyOffset;
|
||||
|
|
|
@ -132,7 +132,7 @@ void CItems::RenderProjectile(const CProjectileData *pCurrent, int ItemID)
|
|||
{
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon]);
|
||||
Graphics()->SetColor(1.f, 1.f, 1.f, Alpha);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, m_ProjectileOffset[CurWeapon], Pos.x, Pos.y);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, m_aProjectileOffset[CurWeapon], Pos.x, Pos.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
}
|
||||
else if(pCurrent->m_Type == POWERUP_WEAPON)
|
||||
{
|
||||
QuadOffset = m_PickupWeaponOffset[CurWeapon];
|
||||
QuadOffset = m_aPickupWeaponOffset[CurWeapon];
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aSpritePickupWeapons[CurWeapon]);
|
||||
}
|
||||
else if(pCurrent->m_Type == POWERUP_NINJA)
|
||||
|
@ -167,7 +167,7 @@ void CItems::RenderPickup(const CNetObj_Pickup *pPrev, const CNetObj_Pickup *pCu
|
|||
}
|
||||
else if(pCurrent->m_Type >= POWERUP_ARMOR_SHOTGUN && pCurrent->m_Type <= POWERUP_ARMOR_LASER)
|
||||
{
|
||||
QuadOffset = m_PickupWeaponArmorOffset[pCurrent->m_Type - POWERUP_ARMOR_SHOTGUN];
|
||||
QuadOffset = m_aPickupWeaponArmorOffset[pCurrent->m_Type - POWERUP_ARMOR_SHOTGUN];
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aSpritePickupWeaponArmor[pCurrent->m_Type - POWERUP_ARMOR_SHOTGUN]);
|
||||
}
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
|
@ -301,9 +301,9 @@ void CItems::RenderLaser(const struct CNetObj_Laser *pCurrent, bool IsPredicted)
|
|||
Graphics()->TextureSet(GameClient()->m_ParticlesSkin.m_aSpriteParticleSplat[CurParticle]);
|
||||
Graphics()->QuadsSetRotation(Client()->GameTick(g_Config.m_ClDummy));
|
||||
Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, m_ParticleSplatOffset[CurParticle], Pos.x, Pos.y);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, m_aParticleSplatOffset[CurParticle], Pos.x, Pos.y);
|
||||
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, m_ParticleSplatOffset[CurParticle], Pos.x, Pos.y, 20.f / 24.f, 20.f / 24.f);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_ItemsQuadContainerIndex, m_aParticleSplatOffset[CurParticle], Pos.x, Pos.y, 20.f / 24.f, 20.f / 24.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ void CItems::OnRender()
|
|||
{
|
||||
for(auto *pProj = (CProjectile *)GameClient()->m_PredictedWorld.FindFirst(CGameWorld::ENTTYPE_PROJECTILE); pProj; pProj = (CProjectile *)pProj->NextEntity())
|
||||
{
|
||||
if(!IsSuper && pProj->m_Number > 0 && pProj->m_Number < (int)aSwitchers.size() && !aSwitchers[pProj->m_Number].m_Status[SwitcherTeam] && (pProj->m_Explosive ? BlinkingProjEx : BlinkingProj))
|
||||
if(!IsSuper && pProj->m_Number > 0 && pProj->m_Number < (int)aSwitchers.size() && !aSwitchers[pProj->m_Number].m_aStatus[SwitcherTeam] && (pProj->m_Explosive ? BlinkingProjEx : BlinkingProj))
|
||||
continue;
|
||||
|
||||
CProjectileData Data = pProj->GetData();
|
||||
|
@ -347,7 +347,7 @@ void CItems::OnRender()
|
|||
}
|
||||
for(auto *pPickup = (CPickup *)GameClient()->m_PredictedWorld.FindFirst(CGameWorld::ENTTYPE_PICKUP); pPickup; pPickup = (CPickup *)pPickup->NextEntity())
|
||||
{
|
||||
if(!IsSuper && pPickup->m_Layer == LAYER_SWITCH && pPickup->m_Number > 0 && pPickup->m_Number < (int)aSwitchers.size() && !aSwitchers[pPickup->m_Number].m_Status[SwitcherTeam] && BlinkingPickup)
|
||||
if(!IsSuper && pPickup->m_Layer == LAYER_SWITCH && pPickup->m_Number > 0 && pPickup->m_Number < (int)aSwitchers.size() && !aSwitchers[pPickup->m_Number].m_aStatus[SwitcherTeam] && BlinkingPickup)
|
||||
continue;
|
||||
|
||||
if(pPickup->InDDNetTile())
|
||||
|
@ -371,7 +371,7 @@ void CItems::OnRender()
|
|||
|
||||
bool Inactive = false;
|
||||
if(pEntEx)
|
||||
Inactive = !IsSuper && pEntEx->m_SwitchNumber > 0 && pEntEx->m_SwitchNumber < (int)aSwitchers.size() && !aSwitchers[pEntEx->m_SwitchNumber].m_Status[SwitcherTeam];
|
||||
Inactive = !IsSuper && pEntEx->m_SwitchNumber > 0 && pEntEx->m_SwitchNumber < (int)aSwitchers.size() && !aSwitchers[pEntEx->m_SwitchNumber].m_aStatus[SwitcherTeam];
|
||||
|
||||
if(Item.m_Type == NETOBJTYPE_PROJECTILE || Item.m_Type == NETOBJTYPE_DDNETPROJECTILE)
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ void CItems::OnInit()
|
|||
{
|
||||
RenderTools()->GetSpriteScale(g_pData->m_Weapons.m_aId[i].m_pSpriteBody, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
m_PickupWeaponOffset[i] = RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, g_pData->m_Weapons.m_aId[i].m_VisualSize * ScaleX, g_pData->m_Weapons.m_aId[i].m_VisualSize * ScaleY);
|
||||
m_aPickupWeaponOffset[i] = RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, g_pData->m_Weapons.m_aId[i].m_VisualSize * ScaleX, g_pData->m_Weapons.m_aId[i].m_VisualSize * ScaleY);
|
||||
}
|
||||
RenderTools()->GetSpriteScale(SPRITE_PICKUP_NINJA, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
|
@ -521,16 +521,16 @@ void CItems::OnInit()
|
|||
{
|
||||
RenderTools()->GetSpriteScale(SPRITE_PICKUP_ARMOR_SHOTGUN + i, ScaleX, ScaleY);
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
m_PickupWeaponArmorOffset[i] = RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
m_aPickupWeaponArmorOffset[i] = RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 64.f * ScaleX, 64.f * ScaleY);
|
||||
}
|
||||
|
||||
for(int &ProjectileOffset : m_ProjectileOffset)
|
||||
for(int &ProjectileOffset : m_aProjectileOffset)
|
||||
{
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
ProjectileOffset = RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 32.f);
|
||||
}
|
||||
|
||||
for(int &ParticleSplatOffset : m_ParticleSplatOffset)
|
||||
for(int &ParticleSplatOffset : m_aParticleSplatOffset)
|
||||
{
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
ParticleSplatOffset = RenderTools()->QuadContainerAddSprite(m_ItemsQuadContainerIndex, 24.f);
|
||||
|
|
|
@ -28,11 +28,11 @@ private:
|
|||
int m_RedFlagOffset;
|
||||
int m_PickupHealthOffset;
|
||||
int m_PickupArmorOffset;
|
||||
int m_PickupWeaponOffset[NUM_WEAPONS];
|
||||
int m_aPickupWeaponOffset[NUM_WEAPONS];
|
||||
int m_PickupNinjaOffset;
|
||||
int m_PickupWeaponArmorOffset[4];
|
||||
int m_ProjectileOffset[NUM_WEAPONS];
|
||||
int m_ParticleSplatOffset[3];
|
||||
int m_aPickupWeaponArmorOffset[4];
|
||||
int m_aProjectileOffset[NUM_WEAPONS];
|
||||
int m_aParticleSplatOffset[3];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <game/client/gameclient.h>
|
||||
|
||||
const char *const gs_aModEntitiesNames[] = {
|
||||
const char *const gs_apModEntitiesNames[] = {
|
||||
"ddnet",
|
||||
"ddrace",
|
||||
"race",
|
||||
|
@ -32,14 +32,14 @@ CMapImages::CMapImages(int TextureSize)
|
|||
{
|
||||
m_Count = 0;
|
||||
m_TextureScale = TextureSize;
|
||||
mem_zero(m_EntitiesIsLoaded, sizeof(m_EntitiesIsLoaded));
|
||||
mem_zero(m_aEntitiesIsLoaded, sizeof(m_aEntitiesIsLoaded));
|
||||
m_SpeedupArrowIsLoaded = false;
|
||||
|
||||
mem_zero(m_aTextureUsedByTileOrQuadLayerFlag, sizeof(m_aTextureUsedByTileOrQuadLayerFlag));
|
||||
|
||||
str_copy(m_aEntitiesPath, "editor/entities_clear", sizeof(m_aEntitiesPath));
|
||||
|
||||
static_assert(std::size(gs_aModEntitiesNames) == MAP_IMAGE_MOD_TYPE_COUNT, "Mod name string count is not equal to mod type count");
|
||||
static_assert(std::size(gs_apModEntitiesNames) == MAP_IMAGE_MOD_TYPE_COUNT, "Mod name string count is not equal to mod type count");
|
||||
}
|
||||
|
||||
void CMapImages::OnInit()
|
||||
|
@ -182,15 +182,15 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
else if(GameClient()->m_GameInfo.m_EntitiesVanilla)
|
||||
EntitiesModType = MAP_IMAGE_MOD_TYPE_VANILLA;
|
||||
|
||||
if(!m_EntitiesIsLoaded[(EntitiesModType * 2) + (int)EntitiesAreMasked])
|
||||
if(!m_aEntitiesIsLoaded[(EntitiesModType * 2) + (int)EntitiesAreMasked])
|
||||
{
|
||||
m_EntitiesIsLoaded[(EntitiesModType * 2) + (int)EntitiesAreMasked] = true;
|
||||
m_aEntitiesIsLoaded[(EntitiesModType * 2) + (int)EntitiesAreMasked] = true;
|
||||
|
||||
// any mod that does not mask, will get all layers unmasked
|
||||
bool WasUnknown = !EntitiesAreMasked;
|
||||
|
||||
char aPath[64];
|
||||
str_format(aPath, sizeof(aPath), "%s/%s.png", m_aEntitiesPath, gs_aModEntitiesNames[EntitiesModType]);
|
||||
str_format(aPath, sizeof(aPath), "%s/%s.png", m_aEntitiesPath, gs_apModEntitiesNames[EntitiesModType]);
|
||||
|
||||
bool GameTypeHasFrontLayer = HasFrontLayer(EntitiesModType) || WasUnknown;
|
||||
bool GameTypeHasSpeedupLayer = HasSpeedupLayer(EntitiesModType) || WasUnknown;
|
||||
|
@ -223,7 +223,7 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
if(!ImagePNGLoaded && TryDefault)
|
||||
{
|
||||
// try default
|
||||
str_format(aPath, sizeof(aPath), "editor/entities_clear/%s.png", gs_aModEntitiesNames[EntitiesModType]);
|
||||
str_format(aPath, sizeof(aPath), "editor/entities_clear/%s.png", gs_apModEntitiesNames[EntitiesModType]);
|
||||
if(Graphics()->LoadPNG(&ImgInfo, aPath, IStorage::TYPE_ALL))
|
||||
{
|
||||
ImagePNGLoaded = true;
|
||||
|
@ -261,7 +261,7 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_TUNE && !GameTypeHasTuneLayer)
|
||||
BuildThisLayer = false;
|
||||
|
||||
dbg_assert(!m_EntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n].IsValid(), "entities texture already loaded when it should not be");
|
||||
dbg_assert(!m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n].IsValid(), "entities texture already loaded when it should not be");
|
||||
|
||||
if(BuildThisLayer)
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
}
|
||||
}
|
||||
|
||||
m_EntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, ImgInfo.m_Format, TextureLoadFlag, aPath);
|
||||
m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, ImgInfo.m_Format, TextureLoadFlag, aPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
|
||||
m_TransparentTexture = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, ImgInfo.m_Format, TextureLoadFlag, aPath);
|
||||
}
|
||||
m_EntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = m_TransparentTexture;
|
||||
m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = m_TransparentTexture;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
}
|
||||
}
|
||||
|
||||
return m_EntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][EntityLayerType];
|
||||
return m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][EntityLayerType];
|
||||
}
|
||||
|
||||
IGraphics::CTextureHandle CMapImages::GetSpeedupArrow()
|
||||
|
@ -389,16 +389,16 @@ void CMapImages::ChangeEntitiesPath(const char *pPath)
|
|||
|
||||
for(int i = 0; i < MAP_IMAGE_MOD_TYPE_COUNT * 2; ++i)
|
||||
{
|
||||
if(m_EntitiesIsLoaded[i])
|
||||
if(m_aEntitiesIsLoaded[i])
|
||||
{
|
||||
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
||||
{
|
||||
if(m_EntitiesTextures[i][n].IsValid())
|
||||
Graphics()->UnloadTexture(&(m_EntitiesTextures[i][n]));
|
||||
m_EntitiesTextures[i][n] = IGraphics::CTextureHandle();
|
||||
if(m_aaEntitiesTextures[i][n].IsValid())
|
||||
Graphics()->UnloadTexture(&(m_aaEntitiesTextures[i][n]));
|
||||
m_aaEntitiesTextures[i][n] = IGraphics::CTextureHandle();
|
||||
}
|
||||
|
||||
m_EntitiesIsLoaded[i] = false;
|
||||
m_aEntitiesIsLoaded[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ enum EMapImageModType
|
|||
MAP_IMAGE_MOD_TYPE_COUNT,
|
||||
};
|
||||
|
||||
extern const char *const gs_aModEntitiesNames[];
|
||||
extern const char *const gs_apModEntitiesNames[];
|
||||
|
||||
class CMapImages : public CComponent
|
||||
{
|
||||
|
@ -78,9 +78,9 @@ public:
|
|||
void ChangeEntitiesPath(const char *pPath);
|
||||
|
||||
private:
|
||||
bool m_EntitiesIsLoaded[MAP_IMAGE_MOD_TYPE_COUNT * 2];
|
||||
bool m_aEntitiesIsLoaded[MAP_IMAGE_MOD_TYPE_COUNT * 2];
|
||||
bool m_SpeedupArrowIsLoaded;
|
||||
IGraphics::CTextureHandle m_EntitiesTextures[MAP_IMAGE_MOD_TYPE_COUNT * 2][MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT];
|
||||
IGraphics::CTextureHandle m_aaEntitiesTextures[MAP_IMAGE_MOD_TYPE_COUNT * 2][MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT];
|
||||
IGraphics::CTextureHandle m_SpeedupArrowTexture;
|
||||
IGraphics::CTextureHandle m_OverlayBottomTexture;
|
||||
IGraphics::CTextureHandle m_OverlayTopTexture;
|
||||
|
|
|
@ -904,7 +904,7 @@ void CMapLayers::OnMapLoad()
|
|||
CQuad *pQuads = (CQuad *)m_pLayers->Map()->GetDataSwapped(pQLayer->m_Data);
|
||||
for(int i = 0; i < pQLayer->m_NumQuads; ++i)
|
||||
{
|
||||
CQuad *q = &pQuads[i];
|
||||
CQuad *pQuad = &pQuads[i];
|
||||
for(int j = 0; j < 4; ++j)
|
||||
{
|
||||
int QuadIDX = j;
|
||||
|
@ -915,28 +915,28 @@ void CMapLayers::OnMapLoad()
|
|||
if(!Textured)
|
||||
{
|
||||
// ignore the conversion for the position coordinates
|
||||
vtmpQuads[i].m_aVertices[j].m_X = (q->m_aPoints[QuadIDX].x);
|
||||
vtmpQuads[i].m_aVertices[j].m_Y = (q->m_aPoints[QuadIDX].y);
|
||||
vtmpQuads[i].m_aVertices[j].m_CenterX = (q->m_aPoints[4].x);
|
||||
vtmpQuads[i].m_aVertices[j].m_CenterY = (q->m_aPoints[4].y);
|
||||
vtmpQuads[i].m_aVertices[j].m_R = (unsigned char)q->m_aColors[QuadIDX].r;
|
||||
vtmpQuads[i].m_aVertices[j].m_G = (unsigned char)q->m_aColors[QuadIDX].g;
|
||||
vtmpQuads[i].m_aVertices[j].m_B = (unsigned char)q->m_aColors[QuadIDX].b;
|
||||
vtmpQuads[i].m_aVertices[j].m_A = (unsigned char)q->m_aColors[QuadIDX].a;
|
||||
vtmpQuads[i].m_aVertices[j].m_X = (pQuad->m_aPoints[QuadIDX].x);
|
||||
vtmpQuads[i].m_aVertices[j].m_Y = (pQuad->m_aPoints[QuadIDX].y);
|
||||
vtmpQuads[i].m_aVertices[j].m_CenterX = (pQuad->m_aPoints[4].x);
|
||||
vtmpQuads[i].m_aVertices[j].m_CenterY = (pQuad->m_aPoints[4].y);
|
||||
vtmpQuads[i].m_aVertices[j].m_R = (unsigned char)pQuad->m_aColors[QuadIDX].r;
|
||||
vtmpQuads[i].m_aVertices[j].m_G = (unsigned char)pQuad->m_aColors[QuadIDX].g;
|
||||
vtmpQuads[i].m_aVertices[j].m_B = (unsigned char)pQuad->m_aColors[QuadIDX].b;
|
||||
vtmpQuads[i].m_aVertices[j].m_A = (unsigned char)pQuad->m_aColors[QuadIDX].a;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ignore the conversion for the position coordinates
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_X = (q->m_aPoints[QuadIDX].x);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_Y = (q->m_aPoints[QuadIDX].y);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_CenterX = (q->m_aPoints[4].x);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_CenterY = (q->m_aPoints[4].y);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_U = fx2f(q->m_aTexcoords[QuadIDX].x);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_V = fx2f(q->m_aTexcoords[QuadIDX].y);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_R = (unsigned char)q->m_aColors[QuadIDX].r;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_G = (unsigned char)q->m_aColors[QuadIDX].g;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_B = (unsigned char)q->m_aColors[QuadIDX].b;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_A = (unsigned char)q->m_aColors[QuadIDX].a;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_X = (pQuad->m_aPoints[QuadIDX].x);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_Y = (pQuad->m_aPoints[QuadIDX].y);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_CenterX = (pQuad->m_aPoints[4].x);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_CenterY = (pQuad->m_aPoints[4].y);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_U = fx2f(pQuad->m_aTexcoords[QuadIDX].x);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_V = fx2f(pQuad->m_aTexcoords[QuadIDX].y);
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_R = (unsigned char)pQuad->m_aColors[QuadIDX].r;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_G = (unsigned char)pQuad->m_aColors[QuadIDX].g;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_B = (unsigned char)pQuad->m_aColors[QuadIDX].b;
|
||||
vtmpQuadsTextured[i].m_aVertices[j].m_A = (unsigned char)pQuad->m_aColors[QuadIDX].a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1390,22 +1390,22 @@ void CMapLayers::RenderQuadLayer(int LayerIndex, CMapItemLayerQuads *pQuadLayer,
|
|||
size_t CurQuadOffset = 0;
|
||||
for(int i = 0; i < pQuadLayer->m_NumQuads; ++i)
|
||||
{
|
||||
CQuad *q = &pQuads[i];
|
||||
CQuad *pQuad = &pQuads[i];
|
||||
|
||||
ColorRGBA Color(1.f, 1.f, 1.f, 1.f);
|
||||
if(q->m_ColorEnv >= 0)
|
||||
if(pQuad->m_ColorEnv >= 0)
|
||||
{
|
||||
EnvelopeEval(q->m_ColorEnvOffset, q->m_ColorEnv, Color, this);
|
||||
EnvelopeEval(pQuad->m_ColorEnvOffset, pQuad->m_ColorEnv, Color, this);
|
||||
}
|
||||
|
||||
float OffsetX = 0;
|
||||
float OffsetY = 0;
|
||||
float Rot = 0;
|
||||
|
||||
if(q->m_PosEnv >= 0)
|
||||
if(pQuad->m_PosEnv >= 0)
|
||||
{
|
||||
ColorRGBA Channels;
|
||||
EnvelopeEval(q->m_PosEnvOffset, q->m_PosEnv, Channels, this);
|
||||
EnvelopeEval(pQuad->m_PosEnvOffset, pQuad->m_PosEnv, Channels, this);
|
||||
OffsetX = Channels.r;
|
||||
OffsetY = Channels.g;
|
||||
Rot = Channels.b / 180.0f * pi;
|
||||
|
@ -1570,13 +1570,13 @@ void CMapLayers::OnRender()
|
|||
if((!g_Config.m_GfxNoclip || m_Type == TYPE_FULL_DESIGN) && pGroup->m_Version >= 2 && pGroup->m_UseClipping)
|
||||
{
|
||||
// set clipping
|
||||
float Points[4];
|
||||
float aPoints[4];
|
||||
RenderTools()->MapScreenToGroup(Center.x, Center.y, m_pLayers->GameGroup(), GetCurCamera()->m_Zoom);
|
||||
Graphics()->GetScreen(&Points[0], &Points[1], &Points[2], &Points[3]);
|
||||
float x0 = (pGroup->m_ClipX - Points[0]) / (Points[2] - Points[0]);
|
||||
float y0 = (pGroup->m_ClipY - Points[1]) / (Points[3] - Points[1]);
|
||||
float x1 = ((pGroup->m_ClipX + pGroup->m_ClipW) - Points[0]) / (Points[2] - Points[0]);
|
||||
float y1 = ((pGroup->m_ClipY + pGroup->m_ClipH) - Points[1]) / (Points[3] - Points[1]);
|
||||
Graphics()->GetScreen(&aPoints[0], &aPoints[1], &aPoints[2], &aPoints[3]);
|
||||
float x0 = (pGroup->m_ClipX - aPoints[0]) / (aPoints[2] - aPoints[0]);
|
||||
float y0 = (pGroup->m_ClipY - aPoints[1]) / (aPoints[3] - aPoints[1]);
|
||||
float x1 = ((pGroup->m_ClipX + pGroup->m_ClipW) - aPoints[0]) / (aPoints[2] - aPoints[0]);
|
||||
float y1 = ((pGroup->m_ClipY + pGroup->m_ClipH) - aPoints[1]) / (aPoints[3] - aPoints[1]);
|
||||
|
||||
if(x1 < 0.0f || x0 > 1.0f || y1 < 0.0f || y0 > 1.0f)
|
||||
{
|
||||
|
|
|
@ -56,28 +56,28 @@ void CMenuBackground::OnInit()
|
|||
|
||||
void CMenuBackground::ResetPositions()
|
||||
{
|
||||
m_Positions[POS_START] = vec2(500.0f, 500.0f);
|
||||
m_Positions[POS_BROWSER_INTERNET] = vec2(1000.0f, 1000.0f);
|
||||
m_Positions[POS_BROWSER_LAN] = vec2(1100.0f, 1000.0f);
|
||||
m_Positions[POS_DEMOS] = vec2(900.0f, 100.0f);
|
||||
m_Positions[POS_NEWS] = vec2(500.0f, 750.0f);
|
||||
m_Positions[POS_BROWSER_FAVORITES] = vec2(1250.0f, 500.0f);
|
||||
m_Positions[POS_SETTINGS_LANGUAGE] = vec2(500.0f, 1200.0f);
|
||||
m_Positions[POS_SETTINGS_GENERAL] = vec2(500.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_PLAYER] = vec2(600.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_TEE] = vec2(700.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_APPEARANCE] = vec2(200.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_CONTROLS] = vec2(800.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_GRAPHICS] = vec2(900.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_SOUND] = vec2(1000.0f, 1000.0f);
|
||||
m_Positions[POS_SETTINGS_DDNET] = vec2(1200.0f, 200.0f);
|
||||
m_Positions[POS_SETTINGS_ASSETS] = vec2(500.0f, 500.0f);
|
||||
m_aPositions[POS_START] = vec2(500.0f, 500.0f);
|
||||
m_aPositions[POS_BROWSER_INTERNET] = vec2(1000.0f, 1000.0f);
|
||||
m_aPositions[POS_BROWSER_LAN] = vec2(1100.0f, 1000.0f);
|
||||
m_aPositions[POS_DEMOS] = vec2(900.0f, 100.0f);
|
||||
m_aPositions[POS_NEWS] = vec2(500.0f, 750.0f);
|
||||
m_aPositions[POS_BROWSER_FAVORITES] = vec2(1250.0f, 500.0f);
|
||||
m_aPositions[POS_SETTINGS_LANGUAGE] = vec2(500.0f, 1200.0f);
|
||||
m_aPositions[POS_SETTINGS_GENERAL] = vec2(500.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_PLAYER] = vec2(600.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_TEE] = vec2(700.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_APPEARANCE] = vec2(200.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_CONTROLS] = vec2(800.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_GRAPHICS] = vec2(900.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_SOUND] = vec2(1000.0f, 1000.0f);
|
||||
m_aPositions[POS_SETTINGS_DDNET] = vec2(1200.0f, 200.0f);
|
||||
m_aPositions[POS_SETTINGS_ASSETS] = vec2(500.0f, 500.0f);
|
||||
for(int i = 0; i < POS_BROWSER_CUSTOM_NUM; ++i)
|
||||
m_Positions[POS_BROWSER_CUSTOM0 + i] = vec2(500.0f + (75.0f * (float)i), 650.0f - (75.0f * (float)i));
|
||||
m_aPositions[POS_BROWSER_CUSTOM0 + i] = vec2(500.0f + (75.0f * (float)i), 650.0f - (75.0f * (float)i));
|
||||
for(int i = 0; i < POS_SETTINGS_RESERVED_NUM; ++i)
|
||||
m_Positions[POS_SETTINGS_RESERVED0 + i] = vec2(0, 0);
|
||||
m_aPositions[POS_SETTINGS_RESERVED0 + i] = vec2(0, 0);
|
||||
for(int i = 0; i < POS_RESERVED_NUM; ++i)
|
||||
m_Positions[POS_RESERVED0 + i] = vec2(0, 0);
|
||||
m_aPositions[POS_RESERVED0 + i] = vec2(0, 0);
|
||||
}
|
||||
|
||||
int CMenuBackground::ThemeScan(const char *pName, int IsDir, int DirType, void *pUser)
|
||||
|
@ -292,7 +292,7 @@ void CMenuBackground::LoadMenuBackground(bool HasDayHint, bool HasNightHint)
|
|||
if(Index >= TILE_TIME_CHECKPOINT_FIRST && Index <= TILE_TIME_CHECKPOINT_LAST)
|
||||
{
|
||||
int ArrayIndex = clamp<int>((Index - TILE_TIME_CHECKPOINT_FIRST), 0, NUM_POS);
|
||||
m_Positions[ArrayIndex] = vec2(x * 32.0f + 16.0f, y * 32.0f + 16.0f);
|
||||
m_aPositions[ArrayIndex] = vec2(x * 32.0f + 16.0f, y * 32.0f + 16.0f);
|
||||
}
|
||||
|
||||
x += ((CTile *)pTiles)[y * pTLayer->m_Width + x].m_Skip;
|
||||
|
@ -391,7 +391,7 @@ void CMenuBackground::ChangePosition(int PositionNumber)
|
|||
m_ChangedPosition = true;
|
||||
}
|
||||
m_AnimationStartPos = m_Camera.m_Center;
|
||||
m_RotationCenter = m_Positions[m_CurrentPosition];
|
||||
m_RotationCenter = m_aPositions[m_CurrentPosition];
|
||||
m_MoveTime = 0.0f;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ class CTheme
|
|||
{
|
||||
public:
|
||||
CTheme() {}
|
||||
CTheme(const char *n, bool HasDay, bool HasNight) :
|
||||
m_Name(n), m_HasDay(HasDay), m_HasNight(HasNight) {}
|
||||
CTheme(const char *pName, bool HasDay, bool HasNight) :
|
||||
m_Name(pName), m_HasDay(HasDay), m_HasNight(HasNight) {}
|
||||
|
||||
std::string m_Name;
|
||||
bool m_HasDay;
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
vec2 m_MenuCenter;
|
||||
vec2 m_RotationCenter;
|
||||
vec2 m_Positions[NUM_POS];
|
||||
vec2 m_aPositions[NUM_POS];
|
||||
int m_CurrentPosition;
|
||||
vec2 m_AnimationStartPos;
|
||||
bool m_ChangedPosition;
|
||||
|
|
|
@ -442,12 +442,12 @@ int CMenus::DoButton_CheckBox_Number(const void *pID, const char *pText, int Che
|
|||
return DoButton_CheckBox_Common(pID, pText, aBuf, pRect);
|
||||
}
|
||||
|
||||
int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool UseScroll, int Current, int Min, int Max, int Step, float Scale, bool IsHex, float Round, ColorRGBA *Color)
|
||||
int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool UseScroll, int Current, int Min, int Max, int Step, float Scale, bool IsHex, float Round, ColorRGBA *pColor)
|
||||
{
|
||||
// logic
|
||||
static float s_Value;
|
||||
static char s_NumStr[64];
|
||||
static void *s_LastTextpID = pID;
|
||||
static char s_aNumStr[64];
|
||||
static void *s_pLastTextpID = pID;
|
||||
const bool Inside = UI()->MouseInside(pRect);
|
||||
|
||||
if(Inside)
|
||||
|
@ -455,12 +455,12 @@ int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool
|
|||
|
||||
if(UI()->MouseButtonReleased(1) && UI()->HotItem() == pID)
|
||||
{
|
||||
s_LastTextpID = pID;
|
||||
s_pLastTextpID = pID;
|
||||
ms_ValueSelectorTextMode = true;
|
||||
if(IsHex)
|
||||
str_format(s_NumStr, sizeof(s_NumStr), "%06X", Current);
|
||||
str_format(s_aNumStr, sizeof(s_aNumStr), "%06X", Current);
|
||||
else
|
||||
str_format(s_NumStr, sizeof(s_NumStr), "%d", Current);
|
||||
str_format(s_aNumStr, sizeof(s_aNumStr), "%d", Current);
|
||||
}
|
||||
|
||||
if(UI()->CheckActiveItem(pID))
|
||||
|
@ -473,10 +473,10 @@ int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool
|
|||
}
|
||||
}
|
||||
|
||||
if(ms_ValueSelectorTextMode && s_LastTextpID == pID)
|
||||
if(ms_ValueSelectorTextMode && s_pLastTextpID == pID)
|
||||
{
|
||||
static float s_NumberBoxID = 0;
|
||||
UIEx()->DoEditBox(&s_NumberBoxID, pRect, s_NumStr, sizeof(s_NumStr), 10.0f, &s_NumberBoxID, false, CUI::CORNER_ALL);
|
||||
UIEx()->DoEditBox(&s_NumberBoxID, pRect, s_aNumStr, sizeof(s_aNumStr), 10.0f, &s_NumberBoxID, false, CUI::CORNER_ALL);
|
||||
|
||||
UI()->SetActiveItem(&s_NumberBoxID);
|
||||
|
||||
|
@ -484,9 +484,9 @@ int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool
|
|||
((UI()->MouseButtonClicked(1) || UI()->MouseButtonClicked(0)) && !Inside))
|
||||
{
|
||||
if(IsHex)
|
||||
Current = clamp(str_toint_base(s_NumStr, 16), Min, Max);
|
||||
Current = clamp(str_toint_base(s_aNumStr, 16), Min, Max);
|
||||
else
|
||||
Current = clamp(str_toint(s_NumStr), Min, Max);
|
||||
Current = clamp(str_toint(s_aNumStr), Min, Max);
|
||||
//m_LockMouse = false;
|
||||
UI()->SetActiveItem(nullptr);
|
||||
ms_ValueSelectorTextMode = false;
|
||||
|
@ -556,14 +556,14 @@ int CMenus::DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool
|
|||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Current);
|
||||
}
|
||||
RenderTools()->DrawUIRect(pRect, *Color, CUI::CORNER_ALL, Round);
|
||||
RenderTools()->DrawUIRect(pRect, *pColor, CUI::CORNER_ALL, Round);
|
||||
UI()->DoLabel(pRect, aBuf, 10, TEXTALIGN_CENTER);
|
||||
}
|
||||
|
||||
return Current;
|
||||
}
|
||||
|
||||
int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *NewModifierCombination)
|
||||
int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *pNewModifierCombination)
|
||||
{
|
||||
// process
|
||||
static void *pGrabbedID = 0;
|
||||
|
@ -571,7 +571,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCo
|
|||
static int s_ButtonUsed = 0;
|
||||
const bool Inside = UI()->MouseHovered(pRect);
|
||||
int NewKey = Key;
|
||||
*NewModifierCombination = ModifierCombination;
|
||||
*pNewModifierCombination = ModifierCombination;
|
||||
|
||||
if(!UI()->MouseButton(0) && !UI()->MouseButton(1) && pGrabbedID == pID)
|
||||
MouseReleased = true;
|
||||
|
@ -584,7 +584,7 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCo
|
|||
if(m_Binder.m_Key.m_Key != KEY_ESCAPE)
|
||||
{
|
||||
NewKey = m_Binder.m_Key.m_Key;
|
||||
*NewModifierCombination = m_Binder.m_ModifierCombination;
|
||||
*pNewModifierCombination = m_Binder.m_ModifierCombination;
|
||||
}
|
||||
m_Binder.m_GotKey = false;
|
||||
UI()->SetActiveItem(nullptr);
|
||||
|
@ -630,8 +630,8 @@ int CMenus::DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCo
|
|||
if(Key)
|
||||
{
|
||||
char aBuf[64];
|
||||
if(*NewModifierCombination)
|
||||
str_format(aBuf, sizeof(aBuf), "%s%s", CBinds::GetKeyBindModifiersName(*NewModifierCombination), Input()->KeyName(Key));
|
||||
if(*pNewModifierCombination)
|
||||
str_format(aBuf, sizeof(aBuf), "%s%s", CBinds::GetKeyBindModifiersName(*pNewModifierCombination), Input()->KeyName(Key));
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%s", Input()->KeyName(Key));
|
||||
|
||||
|
@ -2710,7 +2710,7 @@ int CMenus::MenuImageScan(const char *pName, int IsDir, int DirType, void *pUser
|
|||
CMenuImage MenuImage;
|
||||
MenuImage.m_OrgTexture = pSelf->Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0);
|
||||
|
||||
unsigned char *d = (unsigned char *)Info.m_pData;
|
||||
unsigned char *pData = (unsigned char *)Info.m_pData;
|
||||
//int Pitch = Info.m_Width*4;
|
||||
|
||||
// create colorless version
|
||||
|
@ -2719,10 +2719,10 @@ int CMenus::MenuImageScan(const char *pName, int IsDir, int DirType, void *pUser
|
|||
// make the texture gray scale
|
||||
for(int i = 0; i < Info.m_Width * Info.m_Height; i++)
|
||||
{
|
||||
int v = (d[i * Step] + d[i * Step + 1] + d[i * Step + 2]) / 3;
|
||||
d[i * Step] = v;
|
||||
d[i * Step + 1] = v;
|
||||
d[i * Step + 2] = v;
|
||||
int v = (pData[i * Step] + pData[i * Step + 1] + pData[i * Step + 2]) / 3;
|
||||
pData[i * Step] = v;
|
||||
pData[i * Step + 1] = v;
|
||||
pData[i * Step + 2] = v;
|
||||
}
|
||||
|
||||
MenuImage.m_GreyTexture = pSelf->Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0);
|
||||
|
|
|
@ -93,11 +93,11 @@ class CMenus : public CComponent
|
|||
int DoButton_CheckBox_Number(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
ColorHSLA DoLine_ColorPicker(int *pResetID, float LineSize, float WantedPickerPosition, float LabelSize, float BottomMargin, CUIRect *pMainRect, const char *pText, unsigned int *pColorValue, ColorRGBA DefaultColor, bool CheckBoxSpacing = true, bool UseCheckBox = false, int *pCheckBoxValue = nullptr);
|
||||
void DoLaserPreview(const CUIRect *pRect, ColorHSLA OutlineColor, ColorHSLA InnerColor);
|
||||
int DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool UseScroll, int Current, int Min, int Max, int Step, float Scale, bool IsHex, float Round, ColorRGBA *Color);
|
||||
int DoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, bool UseScroll, int Current, int Min, int Max, int Step, float Scale, bool IsHex, float Round, ColorRGBA *pColor);
|
||||
int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
|
||||
void DoButton_KeySelect(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||
int DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *NewModifierCombination);
|
||||
int DoKeyReader(void *pID, const CUIRect *pRect, int Key, int ModifierCombination, int *pNewModifierCombination);
|
||||
|
||||
void DoSettingsControlsButtons(int Start, int Stop, CUIRect View);
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
|
||||
#include "menus.h"
|
||||
|
||||
static const int g_OffsetColFlagLock = 2;
|
||||
static const int g_OffsetColFav = g_OffsetColFlagLock + 3;
|
||||
static const int g_OffsetColOff = g_OffsetColFav + 3;
|
||||
static const int g_OffsetColName = g_OffsetColOff + 3;
|
||||
static const int g_OffsetColGameType = g_OffsetColName + 3;
|
||||
static const int g_OffsetColMap = g_OffsetColGameType + 3;
|
||||
static const int g_OffsetColPlayers = g_OffsetColMap + 3;
|
||||
static const int g_OffsetColPing = g_OffsetColPlayers + 3;
|
||||
static const int g_OffsetColVersion = g_OffsetColPing + 3;
|
||||
static const int gs_OffsetColFlagLock = 2;
|
||||
static const int gs_OffsetColFav = gs_OffsetColFlagLock + 3;
|
||||
static const int gs_OffsetColOff = gs_OffsetColFav + 3;
|
||||
static const int gs_OffsetColName = gs_OffsetColOff + 3;
|
||||
static const int gs_OffsetColGameType = gs_OffsetColName + 3;
|
||||
static const int gs_OffsetColMap = gs_OffsetColGameType + 3;
|
||||
static const int gs_OffsetColPlayers = gs_OffsetColMap + 3;
|
||||
static const int gs_OffsetColPing = gs_OffsetColPlayers + 3;
|
||||
static const int gs_OffsetColVersion = gs_OffsetColPing + 3;
|
||||
|
||||
void FormatServerbrowserPing(char *pBuffer, int BufferLength, const CServerInfo *pInfo)
|
||||
{
|
||||
|
@ -326,22 +326,22 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
{
|
||||
if(pItem->m_Flags & SERVER_FLAG_PASSWORD)
|
||||
{
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(g_OffsetColFlagLock + 0), &Button, {0.75f, 0.75f, 0.75f, 1}, TextRender()->DefaultTextOutlineColor(), "\xEF\x80\xA3", TEXTALIGN_CENTER);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(gs_OffsetColFlagLock + 0), &Button, {0.75f, 0.75f, 0.75f, 1}, TextRender()->DefaultTextOutlineColor(), "\xEF\x80\xA3", TEXTALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
else if(ID == COL_FLAG_FAV)
|
||||
{
|
||||
if(pItem->m_Favorite)
|
||||
{
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(g_OffsetColFav + 0), &Button, {0.94f, 0.4f, 0.4f, 1}, TextRender()->DefaultTextOutlineColor(), "\xEF\x80\x84", TEXTALIGN_CENTER);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(gs_OffsetColFav + 0), &Button, {0.94f, 0.4f, 0.4f, 1}, TextRender()->DefaultTextOutlineColor(), "\xEF\x80\x84", TEXTALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
else if(ID == COL_FLAG_OFFICIAL)
|
||||
{
|
||||
if(pItem->m_Official && g_Config.m_UiPage != PAGE_DDNET && g_Config.m_UiPage != PAGE_KOG)
|
||||
{
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(g_OffsetColOff + 0), &Button, {0.4f, 0.7f, 0.94f, 1}, {0.0f, 0.0f, 0.0f, 1.0f}, "\xEF\x82\xA3", TEXTALIGN_CENTER);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(g_OffsetColOff + 1), &Button, {0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 0.0f}, "\xEF\x80\x8C", TEXTALIGN_CENTER, true);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(gs_OffsetColOff + 0), &Button, {0.4f, 0.7f, 0.94f, 1}, {0.0f, 0.0f, 0.0f, 1.0f}, "\xEF\x82\xA3", TEXTALIGN_CENTER);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(gs_OffsetColOff + 1), &Button, {0.0f, 0.0f, 0.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 0.0f}, "\xEF\x80\x8C", TEXTALIGN_CENTER, true);
|
||||
}
|
||||
}
|
||||
else if(ID == COL_NAME)
|
||||
|
@ -354,17 +354,17 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
const char *pStr = str_utf8_find_nocase(pItem->m_aName, g_Config.m_BrFilterString);
|
||||
if(pStr)
|
||||
{
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 0), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)(pStr - pItem->m_aName));
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColName + 0), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)(pStr - pItem->m_aName));
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 1), &Button, pStr, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(g_OffsetColName + 0)->m_Cursor);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColName + 1), &Button, pStr, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(gs_OffsetColName + 0)->m_Cursor);
|
||||
TextRender()->TextColor(1, 1, 1, 1);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, TEXTALIGN_LEFT, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(g_OffsetColName + 1)->m_Cursor);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColName + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, TEXTALIGN_LEFT, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(gs_OffsetColName + 1)->m_Cursor);
|
||||
}
|
||||
else
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColName), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
}
|
||||
else
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColName), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColName), &Button, pItem->m_aName, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
}
|
||||
else if(ID == COL_MAP)
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
|
||||
if(g_Config.m_BrIndicateFinished && pItem->m_HasRank == 1)
|
||||
{
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(g_OffsetColFlagLock + 1), &Icon, TextRender()->DefaultTextColor(), TextRender()->DefaultTextOutlineColor(), "\xEF\x84\x9E", TEXTALIGN_CENTER);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(gs_OffsetColFlagLock + 1), &Icon, TextRender()->DefaultTextColor(), TextRender()->DefaultTextOutlineColor(), "\xEF\x84\x9E", TEXTALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,17 +389,17 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
const char *pStr = str_utf8_find_nocase(pItem->m_aMap, g_Config.m_BrFilterString);
|
||||
if(pStr)
|
||||
{
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 0), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)(pStr - pItem->m_aMap));
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColMap + 0), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)(pStr - pItem->m_aMap));
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 1), &Button, pStr, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(g_OffsetColMap + 0)->m_Cursor);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColMap + 1), &Button, pStr, FontSize, TEXTALIGN_LEFT, Button.w, 1, true, (int)str_length(g_Config.m_BrFilterString), &pItem->m_pUIElement->Get(gs_OffsetColMap + 0)->m_Cursor);
|
||||
TextRender()->TextColor(1, 1, 1, 1);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, TEXTALIGN_LEFT, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(g_OffsetColMap + 1)->m_Cursor);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColMap + 2), &Button, pStr + str_length(g_Config.m_BrFilterString), FontSize, TEXTALIGN_LEFT, Button.w, 1, true, -1, &pItem->m_pUIElement->Get(gs_OffsetColMap + 1)->m_Cursor);
|
||||
}
|
||||
else
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColMap), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
}
|
||||
else
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColMap), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColMap), &Button, pItem->m_aMap, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
}
|
||||
else if(ID == COL_PLAYERS)
|
||||
{
|
||||
|
@ -409,14 +409,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
{
|
||||
Button.VSplitLeft(Button.h, &Icon, &Button);
|
||||
Icon.Margin(2.0f, &Icon);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(g_OffsetColFav + 1), &Icon, {0.94f, 0.4f, 0.4f, 1}, TextRender()->DefaultTextOutlineColor(), "\xEF\x80\x84", TEXTALIGN_LEFT);
|
||||
RenderBrowserIcons(*pItem->m_pUIElement->Get(gs_OffsetColFav + 1), &Icon, {0.94f, 0.4f, 0.4f, 1}, TextRender()->DefaultTextOutlineColor(), "\xEF\x80\x84", TEXTALIGN_LEFT);
|
||||
}
|
||||
|
||||
str_format(aTemp, sizeof(aTemp), "%i/%i", pItem->m_NumFilteredPlayers, ServerBrowser()->Max(*pItem));
|
||||
if(g_Config.m_BrFilterString[0] && (pItem->m_QuickSearchHit & IServerBrowser::QUICK_PLAYER))
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1);
|
||||
float FontSize = 12.0f;
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPlayers), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColPlayers), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
|
||||
TextRender()->TextColor(1, 1, 1, 1);
|
||||
}
|
||||
else if(ID == COL_PING)
|
||||
|
@ -430,14 +430,14 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
}
|
||||
|
||||
float FontSize = 12.0f;
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColPing), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColPing), &Button, aTemp, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
else if(ID == COL_VERSION)
|
||||
{
|
||||
const char *pVersion = pItem->m_aVersion;
|
||||
float FontSize = 12.0f;
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColVersion), &Button, pVersion, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColVersion), &Button, pVersion, FontSize, TEXTALIGN_RIGHT, -1, 1, false);
|
||||
}
|
||||
else if(ID == COL_GAMETYPE)
|
||||
{
|
||||
|
@ -464,11 +464,11 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
|
||||
ColorRGBA rgb = color_cast<ColorRGBA>(hsl);
|
||||
TextRender()->TextColor(rgb);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(g_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
UI()->DoLabelStreamed(*pItem->m_pUIElement->Get(gs_OffsetColGameType), &Button, pItem->m_aGameType, FontSize, TEXTALIGN_LEFT, Button.w, 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1193,14 +1193,14 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
if(g_Config.m_BrFilterString[0])
|
||||
{
|
||||
// highlight the parts that matches
|
||||
const char *s = str_utf8_find_nocase(pName, g_Config.m_BrFilterString);
|
||||
if(s)
|
||||
const char *pFilteredStr = str_utf8_find_nocase(pName, g_Config.m_BrFilterString);
|
||||
if(pFilteredStr)
|
||||
{
|
||||
TextRender()->TextEx(&Cursor, pName, (int)(s - pName));
|
||||
TextRender()->TextEx(&Cursor, pName, (int)(pFilteredStr - pName));
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1.0f);
|
||||
TextRender()->TextEx(&Cursor, s, str_length(g_Config.m_BrFilterString));
|
||||
TextRender()->TextEx(&Cursor, pFilteredStr, str_length(g_Config.m_BrFilterString));
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
TextRender()->TextEx(&Cursor, s + str_length(g_Config.m_BrFilterString), -1);
|
||||
TextRender()->TextEx(&Cursor, pFilteredStr + str_length(g_Config.m_BrFilterString), -1);
|
||||
}
|
||||
else
|
||||
TextRender()->TextEx(&Cursor, pName, -1);
|
||||
|
@ -1215,14 +1215,14 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View)
|
|||
if(g_Config.m_BrFilterString[0])
|
||||
{
|
||||
// highlight the parts that matches
|
||||
const char *s = str_utf8_find_nocase(pClan, g_Config.m_BrFilterString);
|
||||
if(s)
|
||||
const char *pFilteredString = str_utf8_find_nocase(pClan, g_Config.m_BrFilterString);
|
||||
if(pFilteredString)
|
||||
{
|
||||
TextRender()->TextEx(&Cursor, pClan, (int)(s - pClan));
|
||||
TextRender()->TextEx(&Cursor, pClan, (int)(pFilteredString - pClan));
|
||||
TextRender()->TextColor(0.4f, 0.4f, 1.0f, 1.0f);
|
||||
TextRender()->TextEx(&Cursor, s, str_length(g_Config.m_BrFilterString));
|
||||
TextRender()->TextEx(&Cursor, pFilteredString, str_length(g_Config.m_BrFilterString));
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
TextRender()->TextEx(&Cursor, s + str_length(g_Config.m_BrFilterString), -1);
|
||||
TextRender()->TextEx(&Cursor, pFilteredString + str_length(g_Config.m_BrFilterString), -1);
|
||||
}
|
||||
else
|
||||
TextRender()->TextEx(&Cursor, pClan, -1);
|
||||
|
|
|
@ -216,10 +216,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
}
|
||||
|
||||
// seek to 0-90%
|
||||
const int SeekPercentKeys[] = {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9};
|
||||
for(unsigned i = 0; i < std::size(SeekPercentKeys); i++)
|
||||
const int aSeekPercentKeys[] = {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9};
|
||||
for(unsigned i = 0; i < std::size(aSeekPercentKeys); i++)
|
||||
{
|
||||
if(Input()->KeyPress(SeekPercentKeys[i]))
|
||||
if(Input()->KeyPress(aSeekPercentKeys[i]))
|
||||
{
|
||||
DemoPlayer()->SeekPercent(i * 0.1f);
|
||||
break;
|
||||
|
@ -273,7 +273,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
// do seekbar
|
||||
{
|
||||
static int s_SeekBarID = 0;
|
||||
void *id = &s_SeekBarID;
|
||||
void *pId = &s_SeekBarID;
|
||||
char aBuffer[128];
|
||||
|
||||
// draw seek bar
|
||||
|
@ -333,7 +333,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
// do the logic
|
||||
const bool Inside = UI()->MouseInside(&SeekBar);
|
||||
|
||||
if(UI()->CheckActiveItem(id))
|
||||
if(UI()->CheckActiveItem(pId))
|
||||
{
|
||||
if(!UI()->MouseButton(0))
|
||||
UI()->SetActiveItem(nullptr);
|
||||
|
@ -369,14 +369,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(UI()->HotItem() == id)
|
||||
else if(UI()->HotItem() == pId)
|
||||
{
|
||||
if(UI()->MouseButton(0))
|
||||
UI()->SetActiveItem(id);
|
||||
UI()->SetActiveItem(pId);
|
||||
}
|
||||
|
||||
if(Inside)
|
||||
UI()->SetHotItem(id);
|
||||
UI()->SetHotItem(pId);
|
||||
}
|
||||
|
||||
if(CurrentTick == TotalTicks)
|
||||
|
|
|
@ -237,7 +237,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
|||
|
||||
int TotalPlayers = 0;
|
||||
|
||||
for(auto &pInfoByName : m_pClient->m_Snap.m_paInfoByName)
|
||||
for(auto &pInfoByName : m_pClient->m_Snap.m_apInfoByName)
|
||||
{
|
||||
if(!pInfoByName)
|
||||
continue;
|
||||
|
@ -261,10 +261,10 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
|||
|
||||
for(int i = 0, Count = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(!m_pClient->m_Snap.m_paInfoByName[i])
|
||||
if(!m_pClient->m_Snap.m_apInfoByName[i])
|
||||
continue;
|
||||
|
||||
int Index = m_pClient->m_Snap.m_paInfoByName[i]->m_ClientID;
|
||||
int Index = m_pClient->m_Snap.m_apInfoByName[i]->m_ClientID;
|
||||
|
||||
if(Index == m_pClient->m_Snap.m_LocalClientID)
|
||||
continue;
|
||||
|
@ -507,7 +507,7 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
|
|||
int NumOptions = 0;
|
||||
int Selected = 0;
|
||||
static int aPlayerIDs[MAX_CLIENTS];
|
||||
for(auto &pInfoByName : m_pClient->m_Snap.m_paInfoByName)
|
||||
for(auto &pInfoByName : m_pClient->m_Snap.m_apInfoByName)
|
||||
{
|
||||
if(!pInfoByName)
|
||||
continue;
|
||||
|
@ -648,7 +648,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
else if(s_ControlPage == 1)
|
||||
{
|
||||
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
|
||||
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
m_pClient->m_Snap.m_apPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
{
|
||||
m_pClient->m_Voting.CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
|
||||
SetActive(false);
|
||||
|
@ -657,7 +657,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
else if(s_ControlPage == 2)
|
||||
{
|
||||
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
|
||||
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
m_pClient->m_Snap.m_apPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
{
|
||||
m_pClient->m_Voting.CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason);
|
||||
SetActive(false);
|
||||
|
@ -700,7 +700,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
else if(s_ControlPage == 1)
|
||||
{
|
||||
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
|
||||
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
m_pClient->m_Snap.m_apPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
{
|
||||
m_pClient->m_Voting.CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
|
||||
SetActive(false);
|
||||
|
@ -709,7 +709,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
else if(s_ControlPage == 2)
|
||||
{
|
||||
if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
|
||||
m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
m_pClient->m_Snap.m_apPlayerInfos[m_CallvoteSelectedPlayer])
|
||||
{
|
||||
m_pClient->m_Voting.CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
|
||||
SetActive(false);
|
||||
|
|
|
@ -417,16 +417,16 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
Eyes = MainView;
|
||||
|
||||
char *pSkinName = g_Config.m_ClPlayerSkin;
|
||||
int *UseCustomColor = &g_Config.m_ClPlayerUseCustomColor;
|
||||
unsigned *ColorBody = &g_Config.m_ClPlayerColorBody;
|
||||
unsigned *ColorFeet = &g_Config.m_ClPlayerColorFeet;
|
||||
int *pUseCustomColor = &g_Config.m_ClPlayerUseCustomColor;
|
||||
unsigned *pColorBody = &g_Config.m_ClPlayerColorBody;
|
||||
unsigned *pColorFeet = &g_Config.m_ClPlayerColorFeet;
|
||||
|
||||
if(m_Dummy)
|
||||
{
|
||||
pSkinName = g_Config.m_ClDummySkin;
|
||||
UseCustomColor = &g_Config.m_ClDummyUseCustomColor;
|
||||
ColorBody = &g_Config.m_ClDummyColorBody;
|
||||
ColorFeet = &g_Config.m_ClDummyColorFeet;
|
||||
pUseCustomColor = &g_Config.m_ClDummyUseCustomColor;
|
||||
pColorBody = &g_Config.m_ClDummyColorBody;
|
||||
pColorFeet = &g_Config.m_ClDummyColorFeet;
|
||||
}
|
||||
|
||||
// skin info
|
||||
|
@ -435,11 +435,11 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
OwnSkinInfo.m_OriginalRenderSkin = pSkin->m_OriginalSkin;
|
||||
OwnSkinInfo.m_ColorableRenderSkin = pSkin->m_ColorableSkin;
|
||||
OwnSkinInfo.m_SkinMetrics = pSkin->m_Metrics;
|
||||
OwnSkinInfo.m_CustomColoredSkin = *UseCustomColor;
|
||||
if(*UseCustomColor)
|
||||
OwnSkinInfo.m_CustomColoredSkin = *pUseCustomColor;
|
||||
if(*pUseCustomColor)
|
||||
{
|
||||
OwnSkinInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSLA(*ColorBody).UnclampLighting());
|
||||
OwnSkinInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSLA(*ColorFeet).UnclampLighting());
|
||||
OwnSkinInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSLA(*pColorBody).UnclampLighting());
|
||||
OwnSkinInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSLA(*pColorFeet).UnclampLighting());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -506,8 +506,8 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
|
||||
SkinPrefix.HSplitTop(2.0f, 0, &SkinPrefix);
|
||||
{
|
||||
static const char *s_aSkinPrefixes[] = {"kitty", "santa"};
|
||||
for(auto &pPrefix : s_aSkinPrefixes)
|
||||
static const char *s_apSkinPrefixes[] = {"kitty", "santa"};
|
||||
for(auto &pPrefix : s_apSkinPrefixes)
|
||||
{
|
||||
SkinPrefix.HSplitTop(20.0f, &Button, &SkinPrefix);
|
||||
Button.HMargin(2.0f, &Button);
|
||||
|
@ -596,33 +596,33 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
MainView.HSplitTop(20.0f, &Button, &MainView);
|
||||
Button.VSplitLeft(150.0f, &Button, 0);
|
||||
static int s_CustomColorID = 0;
|
||||
if(DoButton_CheckBox(&s_CustomColorID, Localize("Custom colors"), *UseCustomColor, &Button))
|
||||
if(DoButton_CheckBox(&s_CustomColorID, Localize("Custom colors"), *pUseCustomColor, &Button))
|
||||
{
|
||||
*UseCustomColor = *UseCustomColor ? 0 : 1;
|
||||
*pUseCustomColor = *pUseCustomColor ? 0 : 1;
|
||||
SetNeedSendInfo();
|
||||
}
|
||||
|
||||
MainView.HSplitTop(5.0f, 0, &MainView);
|
||||
MainView.HSplitTop(82.5f, &Label, &MainView);
|
||||
if(*UseCustomColor)
|
||||
if(*pUseCustomColor)
|
||||
{
|
||||
CUIRect aRects[2];
|
||||
Label.VSplitMid(&aRects[0], &aRects[1], 20.0f);
|
||||
|
||||
unsigned *paColors[2] = {ColorBody, ColorFeet};
|
||||
const char *paParts[] = {Localize("Body"), Localize("Feet")};
|
||||
unsigned *apColors[2] = {pColorBody, pColorFeet};
|
||||
const char *apParts[] = {Localize("Body"), Localize("Feet")};
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
aRects[i].HSplitTop(20.0f, &Label, &aRects[i]);
|
||||
UI()->DoLabel(&Label, paParts[i], 14.0f, TEXTALIGN_LEFT);
|
||||
UI()->DoLabel(&Label, apParts[i], 14.0f, TEXTALIGN_LEFT);
|
||||
aRects[i].VSplitLeft(10.0f, 0, &aRects[i]);
|
||||
aRects[i].HSplitTop(2.5f, 0, &aRects[i]);
|
||||
|
||||
unsigned PrevColor = *paColors[i];
|
||||
RenderHSLScrollbars(&aRects[i], paColors[i], false, true);
|
||||
unsigned PrevColor = *apColors[i];
|
||||
RenderHSLScrollbars(&aRects[i], apColors[i], false, true);
|
||||
|
||||
if(PrevColor != *paColors[i])
|
||||
if(PrevColor != *apColors[i])
|
||||
{
|
||||
SetNeedSendInfo();
|
||||
}
|
||||
|
@ -640,24 +640,24 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
s_vSkinList.clear();
|
||||
for(int i = 0; i < m_pClient->m_Skins.Num(); ++i)
|
||||
{
|
||||
const CSkin *s = m_pClient->m_Skins.Get(i);
|
||||
const CSkin *pSkinToBeSelected = m_pClient->m_Skins.Get(i);
|
||||
|
||||
// filter quick search
|
||||
if(g_Config.m_ClSkinFilterString[0] != '\0' && !str_utf8_find_nocase(s->m_aName, g_Config.m_ClSkinFilterString))
|
||||
if(g_Config.m_ClSkinFilterString[0] != '\0' && !str_utf8_find_nocase(pSkinToBeSelected->m_aName, g_Config.m_ClSkinFilterString))
|
||||
continue;
|
||||
|
||||
// no special skins
|
||||
if((s->m_aName[0] == 'x' && s->m_aName[1] == '_'))
|
||||
if((pSkinToBeSelected->m_aName[0] == 'x' && pSkinToBeSelected->m_aName[1] == '_'))
|
||||
continue;
|
||||
|
||||
// vanilla skins only
|
||||
if(g_Config.m_ClVanillaSkinsOnly && !s->m_IsVanilla)
|
||||
if(g_Config.m_ClVanillaSkinsOnly && !pSkinToBeSelected->m_IsVanilla)
|
||||
continue;
|
||||
|
||||
if(s == 0)
|
||||
if(pSkinToBeSelected == 0)
|
||||
continue;
|
||||
|
||||
s_vSkinList.emplace_back(s);
|
||||
s_vSkinList.emplace_back(pSkinToBeSelected);
|
||||
}
|
||||
std::sort(s_vSkinList.begin(), s_vSkinList.end());
|
||||
s_InitSkinlist = false;
|
||||
|
@ -668,20 +668,20 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
UiDoListboxStart(&s_InitSkinlist, &SkinList, 50.0f, Localize("Skins"), "", s_vSkinList.size(), 4, OldSelected, s_ScrollValue);
|
||||
for(size_t i = 0; i < s_vSkinList.size(); ++i)
|
||||
{
|
||||
const CSkin *s = s_vSkinList[i].m_pSkin;
|
||||
const CSkin *pSkinToBeDraw = s_vSkinList[i].m_pSkin;
|
||||
|
||||
if(str_comp(s->m_aName, pSkinName) == 0)
|
||||
if(str_comp(pSkinToBeDraw->m_aName, pSkinName) == 0)
|
||||
OldSelected = i;
|
||||
|
||||
CListboxItem Item = UiDoListboxNextItem(s, OldSelected >= 0 && (size_t)OldSelected == i);
|
||||
CListboxItem Item = UiDoListboxNextItem(pSkinToBeDraw, OldSelected >= 0 && (size_t)OldSelected == i);
|
||||
if(Item.m_Visible)
|
||||
{
|
||||
CTeeRenderInfo Info = OwnSkinInfo;
|
||||
Info.m_CustomColoredSkin = *UseCustomColor;
|
||||
Info.m_CustomColoredSkin = *pUseCustomColor;
|
||||
|
||||
Info.m_OriginalRenderSkin = s->m_OriginalSkin;
|
||||
Info.m_ColorableRenderSkin = s->m_ColorableSkin;
|
||||
Info.m_SkinMetrics = s->m_Metrics;
|
||||
Info.m_OriginalRenderSkin = pSkinToBeDraw->m_OriginalSkin;
|
||||
Info.m_ColorableRenderSkin = pSkinToBeDraw->m_ColorableSkin;
|
||||
Info.m_SkinMetrics = pSkinToBeDraw->m_Metrics;
|
||||
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &Info, OffsetToMid);
|
||||
TeeRenderPos = vec2(Item.m_Rect.x + 30, Item.m_Rect.y + Item.m_Rect.h / 2 + OffsetToMid.y);
|
||||
|
@ -690,10 +690,10 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
Item.m_Rect.VSplitLeft(60.0f, 0, &Item.m_Rect);
|
||||
SLabelProperties Props;
|
||||
Props.m_MaxWidth = Item.m_Rect.w;
|
||||
UI()->DoLabel(&Item.m_Rect, s->m_aName, 12.0f, TEXTALIGN_LEFT, Props);
|
||||
UI()->DoLabel(&Item.m_Rect, pSkinToBeDraw->m_aName, 12.0f, TEXTALIGN_LEFT, Props);
|
||||
if(g_Config.m_Debug)
|
||||
{
|
||||
ColorRGBA BloodColor = *UseCustomColor ? color_cast<ColorRGBA>(ColorHSLA(*ColorBody)) : s->m_BloodColor;
|
||||
ColorRGBA BloodColor = *pUseCustomColor ? color_cast<ColorRGBA>(ColorHSLA(*pColorBody)) : pSkinToBeDraw->m_BloodColor;
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(BloodColor.r, BloodColor.g, BloodColor.b, 1.0f);
|
||||
|
@ -1394,12 +1394,12 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
|
||||
// switches
|
||||
static float s_ScrollValueDrop = 0;
|
||||
const char *pWindowModes[] = {Localize("Windowed"), Localize("Windowed borderless"), Localize("Windowed fullscreen"), Localize("Desktop fullscreen"), Localize("Fullscreen")};
|
||||
static const int s_NumWindowMode = std::size(pWindowModes);
|
||||
const char *apWindowModes[] = {Localize("Windowed"), Localize("Windowed borderless"), Localize("Windowed fullscreen"), Localize("Desktop fullscreen"), Localize("Fullscreen")};
|
||||
static const int s_NumWindowMode = std::size(apWindowModes);
|
||||
static int s_aWindowModeIDs[s_NumWindowMode];
|
||||
const void *aWindowModeIDs[s_NumWindowMode];
|
||||
const void *apWindowModeIDs[s_NumWindowMode];
|
||||
for(int i = 0; i < s_NumWindowMode; ++i)
|
||||
aWindowModeIDs[i] = &s_aWindowModeIDs[i];
|
||||
apWindowModeIDs[i] = &s_aWindowModeIDs[i];
|
||||
static int s_WindowModeDropDownState = 0;
|
||||
|
||||
static int s_OldSelectedBackend = -1;
|
||||
|
@ -1407,7 +1407,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
|
||||
OldSelected = (g_Config.m_GfxFullscreen ? (g_Config.m_GfxFullscreen == 1 ? 4 : (g_Config.m_GfxFullscreen == 2 ? 3 : 2)) : (g_Config.m_GfxBorderless ? 1 : 0));
|
||||
|
||||
const int NewWindowMode = RenderDropDown(s_WindowModeDropDownState, &MainView, OldSelected, aWindowModeIDs, pWindowModes, s_NumWindowMode, &s_NumWindowMode, s_ScrollValueDrop);
|
||||
const int NewWindowMode = RenderDropDown(s_WindowModeDropDownState, &MainView, OldSelected, apWindowModeIDs, apWindowModes, s_NumWindowMode, &s_NumWindowMode, s_ScrollValueDrop);
|
||||
if(OldSelected != NewWindowMode)
|
||||
{
|
||||
if(NewWindowMode == 0)
|
||||
|
@ -1679,7 +1679,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
vGPUIDPtrs[i] = vGPUIDs[i].get();
|
||||
if(i == 0)
|
||||
{
|
||||
str_format(aCurDeviceName, sizeof(aCurDeviceName), "%s(%s)", Localize("auto"), GPUList.m_AutoGPU.m_Name);
|
||||
str_format(aCurDeviceName, sizeof(aCurDeviceName), "%s(%s)", Localize("auto"), GPUList.m_AutoGPU.m_aName);
|
||||
vGPUIDNames[i] = aCurDeviceName;
|
||||
if(str_comp("auto", g_Config.m_GfxGPUName) == 0)
|
||||
{
|
||||
|
@ -1688,8 +1688,8 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
}
|
||||
else
|
||||
{
|
||||
vGPUIDNames[i] = GPUList.m_vGPUs[i - 1].m_Name;
|
||||
if(str_comp(GPUList.m_vGPUs[i - 1].m_Name, g_Config.m_GfxGPUName) == 0)
|
||||
vGPUIDNames[i] = GPUList.m_vGPUs[i - 1].m_aName;
|
||||
if(str_comp(GPUList.m_vGPUs[i - 1].m_aName, g_Config.m_GfxGPUName) == 0)
|
||||
{
|
||||
OldSelectedGPU = i;
|
||||
}
|
||||
|
@ -1708,7 +1708,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_vGPUs[NewGPU - 1].m_Name, sizeof(g_Config.m_GfxGPUName));
|
||||
str_copy(g_Config.m_GfxGPUName, GPUList.m_vGPUs[NewGPU - 1].m_aName, sizeof(g_Config.m_GfxGPUName));
|
||||
CheckSettings = true;
|
||||
s_GfxGPUChanged = NewGPU != s_OldSelectedGPU;
|
||||
}
|
||||
|
@ -1847,8 +1847,8 @@ class CLanguage
|
|||
{
|
||||
public:
|
||||
CLanguage() = default;
|
||||
CLanguage(const char *n, const char *f, int Code) :
|
||||
m_Name(n), m_FileName(f), m_CountryCode(Code) {}
|
||||
CLanguage(const char *pName, const char *pFileName, int Code) :
|
||||
m_Name(pName), m_FileName(pFileName), m_CountryCode(Code) {}
|
||||
|
||||
std::string m_Name;
|
||||
std::string m_FileName;
|
||||
|
@ -1982,7 +1982,7 @@ void CMenus::RenderSettings(CUIRect MainView)
|
|||
|
||||
CUIRect Button;
|
||||
|
||||
const char *aTabs[] = {
|
||||
const char *apTabs[] = {
|
||||
Localize("Language"),
|
||||
Localize("General"),
|
||||
Localize("Player"),
|
||||
|
@ -1994,14 +1994,14 @@ void CMenus::RenderSettings(CUIRect MainView)
|
|||
Localize("DDNet"),
|
||||
Localize("Assets")};
|
||||
|
||||
int NumTabs = (int)std::size(aTabs);
|
||||
int NumTabs = (int)std::size(apTabs);
|
||||
int PreviousPage = g_Config.m_UiSettingsPage;
|
||||
|
||||
for(int i = 0; i < NumTabs; i++)
|
||||
{
|
||||
TabBar.HSplitTop(10, &Button, &TabBar);
|
||||
TabBar.HSplitTop(26, &Button, &TabBar);
|
||||
if(DoButton_MenuTab(aTabs[i], aTabs[i], g_Config.m_UiSettingsPage == i, &Button, CUI::CORNER_R, &m_aAnimatorsSettingsTab[i]))
|
||||
if(DoButton_MenuTab(apTabs[i], apTabs[i], g_Config.m_UiSettingsPage == i, &Button, CUI::CORNER_R, &m_aAnimatorsSettingsTab[i]))
|
||||
g_Config.m_UiSettingsPage = i;
|
||||
}
|
||||
|
||||
|
@ -2119,8 +2119,8 @@ ColorHSLA CMenus::RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool
|
|||
ColorHSLA Color(*pColor, Alpha);
|
||||
CUIRect Preview, Button, Label;
|
||||
char aBuf[32];
|
||||
float *paComponent[] = {&Color.h, &Color.s, &Color.l, &Color.a};
|
||||
const char *aLabels[] = {Localize("Hue"), Localize("Sat."), Localize("Lht."), Localize("Alpha")};
|
||||
float *apComponent[] = {&Color.h, &Color.s, &Color.l, &Color.a};
|
||||
const char *apLabels[] = {Localize("Hue"), Localize("Sat."), Localize("Lht."), Localize("Alpha")};
|
||||
|
||||
float SizePerEntry = 20.0f;
|
||||
float MarginPerEntry = 5.0f;
|
||||
|
@ -2410,7 +2410,7 @@ ColorHSLA CMenus::RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool
|
|||
CUIRect Rail;
|
||||
Button.Margin(2.0f, &Rail);
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %03d", aLabels[i], (int)(*paComponent[i] * 255));
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %03d", apLabels[i], (int)(*apComponent[i] * 255));
|
||||
UI()->DoLabel(&Label, aBuf, 14.0f, TEXTALIGN_LEFT);
|
||||
|
||||
ColorHSLA CurColorPureHSLA(RenderColorHSLA.r, 1, 0.5f, 1);
|
||||
|
@ -2425,28 +2425,28 @@ ColorHSLA CMenus::RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool
|
|||
else if(i == 1)
|
||||
{
|
||||
RenderHSLSatRect(&Rail, CurColorPure);
|
||||
ColorInner = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *paComponent[1], CurColorPureHSLA.b, 1));
|
||||
ColorInner = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *apComponent[1], CurColorPureHSLA.b, 1));
|
||||
}
|
||||
else if(i == 2)
|
||||
{
|
||||
ColorRGBA CurColorSat = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *paComponent[1], 0.5f, 1));
|
||||
ColorRGBA CurColorSat = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *apComponent[1], 0.5f, 1));
|
||||
RenderHSLLightRect(&Rail, CurColorSat);
|
||||
float LightVal = *paComponent[2];
|
||||
float LightVal = *apComponent[2];
|
||||
if(ClampedLight)
|
||||
LightVal = ColorHSLA::DARKEST_LGT + LightVal * (1.0f - ColorHSLA::DARKEST_LGT);
|
||||
ColorInner = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *paComponent[1], LightVal, 1));
|
||||
ColorInner = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *apComponent[1], LightVal, 1));
|
||||
}
|
||||
else if(i == 3)
|
||||
{
|
||||
ColorRGBA CurColorFull = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *paComponent[1], *paComponent[2], 1));
|
||||
ColorRGBA CurColorFull = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *apComponent[1], *apComponent[2], 1));
|
||||
RenderHSLAlphaRect(&Rail, CurColorFull);
|
||||
float LightVal = *paComponent[2];
|
||||
float LightVal = *apComponent[2];
|
||||
if(ClampedLight)
|
||||
LightVal = ColorHSLA::DARKEST_LGT + LightVal * (1.0f - ColorHSLA::DARKEST_LGT);
|
||||
ColorInner = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *paComponent[1], LightVal, *paComponent[3]));
|
||||
ColorInner = color_cast<ColorRGBA>(ColorHSLA(CurColorPureHSLA.r, *apComponent[1], LightVal, *apComponent[3]));
|
||||
}
|
||||
|
||||
*paComponent[i] = UIEx()->DoScrollbarH(&((char *)pColor)[i], &Button, *paComponent[i], &ColorInner);
|
||||
*apComponent[i] = UIEx()->DoScrollbarH(&((char *)pColor)[i], &Button, *apComponent[i], &ColorInner);
|
||||
}
|
||||
|
||||
*pColor = Color.Pack(Alpha);
|
||||
|
@ -2620,16 +2620,16 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
Section.Margin(SectionMargin, &Section);
|
||||
|
||||
int i = 0;
|
||||
static int ResetIDs[24];
|
||||
static int s_aResetIDs[24];
|
||||
|
||||
DoLine_ColorPicker(&ResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("System message"), &g_Config.m_ClMessageSystemColor, ColorRGBA(1.0f, 1.0f, 0.5f), true, true, &g_Config.m_ClShowChatSystem);
|
||||
DoLine_ColorPicker(&ResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Highlighted message"), &g_Config.m_ClMessageHighlightColor, ColorRGBA(1.0f, 0.5f, 0.5f));
|
||||
DoLine_ColorPicker(&ResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Team message"), &g_Config.m_ClMessageTeamColor, ColorRGBA(0.65f, 1.0f, 0.65f));
|
||||
DoLine_ColorPicker(&ResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Friend message"), &g_Config.m_ClMessageFriendColor, ColorRGBA(1.0f, 0.137f, 0.137f), true, true, &g_Config.m_ClMessageFriend);
|
||||
DoLine_ColorPicker(&ResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Normal message"), &g_Config.m_ClMessageColor, ColorRGBA(1.0f, 1.0f, 1.0f));
|
||||
DoLine_ColorPicker(&s_aResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("System message"), &g_Config.m_ClMessageSystemColor, ColorRGBA(1.0f, 1.0f, 0.5f), true, true, &g_Config.m_ClShowChatSystem);
|
||||
DoLine_ColorPicker(&s_aResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Highlighted message"), &g_Config.m_ClMessageHighlightColor, ColorRGBA(1.0f, 0.5f, 0.5f));
|
||||
DoLine_ColorPicker(&s_aResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Team message"), &g_Config.m_ClMessageTeamColor, ColorRGBA(0.65f, 1.0f, 0.65f));
|
||||
DoLine_ColorPicker(&s_aResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Friend message"), &g_Config.m_ClMessageFriendColor, ColorRGBA(1.0f, 0.137f, 0.137f), true, true, &g_Config.m_ClMessageFriend);
|
||||
DoLine_ColorPicker(&s_aResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, Localize("Normal message"), &g_Config.m_ClMessageColor, ColorRGBA(1.0f, 1.0f, 1.0f));
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "%s (echo)", Localize("Client message"));
|
||||
DoLine_ColorPicker(&ResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, aBuf, &g_Config.m_ClMessageClientColor, ColorRGBA(0.5f, 0.78f, 1.0f));
|
||||
DoLine_ColorPicker(&s_aResetIDs[i++], ColorPickerLineSize, LeftViewColorPickerPosition, ColorPickerLabelSize, ColorPickerLineSpacing, &Section, aBuf, &g_Config.m_ClMessageClientColor, ColorRGBA(0.5f, 0.78f, 1.0f));
|
||||
|
||||
// ***** Chat Preview ***** //
|
||||
RightView.HSplitTop(HeadlineAndVMargin, &Label, &RightView);
|
||||
|
@ -2673,7 +2673,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
constexpr float OffsetTeeY = RealTeeSizeHalved;
|
||||
const float FullHeightMinusTee = RealOffsetY - RealTeeSize;
|
||||
|
||||
CTeeRenderInfo RenderInfo[PreviewTeeCount];
|
||||
CTeeRenderInfo aRenderInfo[PreviewTeeCount];
|
||||
|
||||
// Backgrounds first
|
||||
if(!g_Config.m_ClChatOld)
|
||||
|
@ -2682,36 +2682,36 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(0, 0, 0, 0.12f);
|
||||
|
||||
char LineBuilder[128];
|
||||
char aLineBuilder[128];
|
||||
float Width;
|
||||
float TempY = Y;
|
||||
constexpr float RealBackgroundRounding = CChat::MESSAGE_ROUNDING * 2.0f;
|
||||
|
||||
if(g_Config.m_ClShowChatSystem)
|
||||
{
|
||||
str_format(LineBuilder, sizeof(LineBuilder), "*** '%s' entered and joined the game", aBuf);
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||
str_format(aLineBuilder, sizeof(aLineBuilder), "*** '%s' entered and joined the game", aBuf);
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, aLineBuilder, -1, -1);
|
||||
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX, RealFontSize + RealMsgPaddingY, RealBackgroundRounding, CUI::CORNER_ALL);
|
||||
TempY += RealOffsetY;
|
||||
}
|
||||
|
||||
str_format(LineBuilder, sizeof(LineBuilder), "%sRandom Tee: Hey, how are you %s?", g_Config.m_ClShowIDs ? " 7: " : "", aBuf);
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||
str_format(aLineBuilder, sizeof(aLineBuilder), "%sRandom Tee: Hey, how are you %s?", g_Config.m_ClShowIDs ? " 7: " : "", aBuf);
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, aLineBuilder, -1, -1);
|
||||
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, RealBackgroundRounding, CUI::CORNER_ALL);
|
||||
TempY += RealOffsetY;
|
||||
|
||||
str_format(LineBuilder, sizeof(LineBuilder), "%sYour Teammate: Let's speedrun this!", g_Config.m_ClShowIDs ? "11: " : "");
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||
str_format(aLineBuilder, sizeof(aLineBuilder), "%sYour Teammate: Let's speedrun this!", g_Config.m_ClShowIDs ? "11: " : "");
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, aLineBuilder, -1, -1);
|
||||
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, RealBackgroundRounding, CUI::CORNER_ALL);
|
||||
TempY += RealOffsetY;
|
||||
|
||||
str_format(LineBuilder, sizeof(LineBuilder), "%s%sFriend: Hello there", g_Config.m_ClMessageFriend ? "♥ " : "", g_Config.m_ClShowIDs ? " 8: " : "");
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||
str_format(aLineBuilder, sizeof(aLineBuilder), "%s%sFriend: Hello there", g_Config.m_ClMessageFriend ? "♥ " : "", g_Config.m_ClShowIDs ? " 8: " : "");
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, aLineBuilder, -1, -1);
|
||||
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, RealBackgroundRounding, CUI::CORNER_ALL);
|
||||
TempY += RealOffsetY;
|
||||
|
||||
str_format(LineBuilder, sizeof(LineBuilder), "%sSpammer [6]: Hey fools, I'm spamming here!", g_Config.m_ClShowIDs ? " 9: " : "");
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||
str_format(aLineBuilder, sizeof(aLineBuilder), "%sSpammer [6]: Hey fools, I'm spamming here!", g_Config.m_ClShowIDs ? " 9: " : "");
|
||||
Width = TextRender()->TextWidth(0, RealFontSize, aLineBuilder, -1, -1);
|
||||
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, RealBackgroundRounding, CUI::CORNER_ALL);
|
||||
TempY += RealOffsetY;
|
||||
|
||||
|
@ -2724,7 +2724,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
|
||||
int DefaultInd = GameClient()->m_Skins.Find("default");
|
||||
|
||||
for(auto &Info : RenderInfo)
|
||||
for(auto &Info : aRenderInfo)
|
||||
{
|
||||
Info.m_Size = RealTeeSize;
|
||||
Info.m_CustomColoredSkin = false;
|
||||
|
@ -2733,10 +2733,10 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
int ind = -1;
|
||||
int pos = 0;
|
||||
|
||||
RenderInfo[pos++].m_OriginalRenderSkin = GameClient()->m_Skins.Get(DefaultInd)->m_OriginalSkin;
|
||||
RenderInfo[pos++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("pinky")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
|
||||
RenderInfo[pos++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("cammostripes")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
|
||||
RenderInfo[pos++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("beast")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : RenderInfo[0].m_OriginalRenderSkin;
|
||||
aRenderInfo[pos++].m_OriginalRenderSkin = GameClient()->m_Skins.Get(DefaultInd)->m_OriginalSkin;
|
||||
aRenderInfo[pos++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("pinky")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : aRenderInfo[0].m_OriginalRenderSkin;
|
||||
aRenderInfo[pos++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("cammostripes")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : aRenderInfo[0].m_OriginalRenderSkin;
|
||||
aRenderInfo[pos++].m_OriginalRenderSkin = (ind = GameClient()->m_Skins.Find("beast")) != -1 ? GameClient()->m_Skins.Get(ind)->m_OriginalSkin : aRenderInfo[0].m_OriginalRenderSkin;
|
||||
}
|
||||
|
||||
// System
|
||||
|
@ -2760,7 +2760,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||
TextRender()->TextEx(&Cursor, "?", -1);
|
||||
if(!g_Config.m_ClChatOld)
|
||||
RenderTools()->RenderTee(pIdleState, &RenderInfo[1], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
RenderTools()->RenderTee(pIdleState, &aRenderInfo[1], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||
|
||||
// Team
|
||||
|
@ -2770,7 +2770,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
TextRender()->TextEx(&Cursor, "11: ", -1);
|
||||
TextRender()->TextEx(&Cursor, "Your Teammate: Let's speedrun this!", -1);
|
||||
if(!g_Config.m_ClChatOld)
|
||||
RenderTools()->RenderTee(pIdleState, &RenderInfo[0], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
RenderTools()->RenderTee(pIdleState, &aRenderInfo[0], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||
|
||||
// Friend
|
||||
|
@ -2787,7 +2787,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
TextRender()->TextColor(NormalColor);
|
||||
TextRender()->TextEx(&Cursor, "Hello there", -1);
|
||||
if(!g_Config.m_ClChatOld)
|
||||
RenderTools()->RenderTee(pIdleState, &RenderInfo[2], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
RenderTools()->RenderTee(pIdleState, &aRenderInfo[2], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||
|
||||
// Normal
|
||||
|
@ -2801,7 +2801,7 @@ void CMenus::RenderSettingsAppearance(CUIRect MainView)
|
|||
TextRender()->TextColor(NormalColor);
|
||||
TextRender()->TextEx(&Cursor, ": Hey fools, I'm spamming here!", -1);
|
||||
if(!g_Config.m_ClChatOld)
|
||||
RenderTools()->RenderTee(pIdleState, &RenderInfo[3], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
RenderTools()->RenderTee(pIdleState, &aRenderInfo[3], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||
|
||||
// Client
|
||||
|
|
|
@ -43,7 +43,7 @@ void CMenus::LoadEntities(SCustomEntities *pEntitiesItem, void *pUser)
|
|||
{
|
||||
for(int i = 0; i < MAP_IMAGE_MOD_TYPE_COUNT; ++i)
|
||||
{
|
||||
str_format(aBuff, sizeof(aBuff), "editor/entities_clear/%s.png", gs_aModEntitiesNames[i]);
|
||||
str_format(aBuff, sizeof(aBuff), "editor/entities_clear/%s.png", gs_apModEntitiesNames[i]);
|
||||
CImageInfo ImgInfo;
|
||||
if(pThis->Graphics()->LoadPNG(&ImgInfo, aBuff, IStorage::TYPE_ALL))
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ void CMenus::LoadEntities(SCustomEntities *pEntitiesItem, void *pUser)
|
|||
{
|
||||
for(int i = 0; i < MAP_IMAGE_MOD_TYPE_COUNT; ++i)
|
||||
{
|
||||
str_format(aBuff, sizeof(aBuff), "assets/entities/%s/%s.png", pEntitiesItem->m_aName, gs_aModEntitiesNames[i]);
|
||||
str_format(aBuff, sizeof(aBuff), "assets/entities/%s/%s.png", pEntitiesItem->m_aName, gs_apModEntitiesNames[i]);
|
||||
CImageInfo ImgInfo;
|
||||
if(pThis->Graphics()->LoadPNG(&ImgInfo, aBuff, IStorage::TYPE_ALL))
|
||||
{
|
||||
|
@ -241,18 +241,18 @@ int CMenus::ExtrasScan(const char *pName, int IsDir, int DirType, void *pUser)
|
|||
return AssetScan(pName, IsDir, DirType, pThis->m_vExtrasList, "extras", pGraphics, pUser);
|
||||
}
|
||||
|
||||
static std::vector<const CMenus::SCustomEntities *> s_vpSearchEntitiesList;
|
||||
static std::vector<const CMenus::SCustomGame *> s_vpSearchGamesList;
|
||||
static std::vector<const CMenus::SCustomEmoticon *> s_vpSearchEmoticonsList;
|
||||
static std::vector<const CMenus::SCustomParticle *> s_vpSearchParticlesList;
|
||||
static std::vector<const CMenus::SCustomHud *> s_vpSearchHudList;
|
||||
static std::vector<const CMenus::SCustomExtras *> s_vpSearchExtrasList;
|
||||
static std::vector<const CMenus::SCustomEntities *> gs_vpSearchEntitiesList;
|
||||
static std::vector<const CMenus::SCustomGame *> gs_vpSearchGamesList;
|
||||
static std::vector<const CMenus::SCustomEmoticon *> gs_vpSearchEmoticonsList;
|
||||
static std::vector<const CMenus::SCustomParticle *> gs_vpSearchParticlesList;
|
||||
static std::vector<const CMenus::SCustomHud *> gs_vpSearchHudList;
|
||||
static std::vector<const CMenus::SCustomExtras *> gs_vpSearchExtrasList;
|
||||
|
||||
static bool s_InitCustomList[NUMBER_OF_ASSETS_TABS] = {
|
||||
static bool gs_aInitCustomList[NUMBER_OF_ASSETS_TABS] = {
|
||||
true,
|
||||
};
|
||||
|
||||
static size_t s_CustomListSize[NUMBER_OF_ASSETS_TABS] = {
|
||||
static size_t gs_aCustomListSize[NUMBER_OF_ASSETS_TABS] = {
|
||||
0,
|
||||
};
|
||||
|
||||
|
@ -263,17 +263,17 @@ static int s_CurCustomTab = ASSETS_TAB_ENTITIES;
|
|||
static const CMenus::SCustomItem *GetCustomItem(int CurTab, size_t Index)
|
||||
{
|
||||
if(CurTab == ASSETS_TAB_ENTITIES)
|
||||
return s_vpSearchEntitiesList[Index];
|
||||
return gs_vpSearchEntitiesList[Index];
|
||||
else if(CurTab == ASSETS_TAB_GAME)
|
||||
return s_vpSearchGamesList[Index];
|
||||
return gs_vpSearchGamesList[Index];
|
||||
else if(CurTab == ASSETS_TAB_EMOTICONS)
|
||||
return s_vpSearchEmoticonsList[Index];
|
||||
return gs_vpSearchEmoticonsList[Index];
|
||||
else if(CurTab == ASSETS_TAB_PARTICLES)
|
||||
return s_vpSearchParticlesList[Index];
|
||||
return gs_vpSearchParticlesList[Index];
|
||||
else if(CurTab == ASSETS_TAB_HUD)
|
||||
return s_vpSearchHudList[Index];
|
||||
return gs_vpSearchHudList[Index];
|
||||
else if(CurTab == ASSETS_TAB_EXTRAS)
|
||||
return s_vpSearchExtrasList[Index];
|
||||
return gs_vpSearchExtrasList[Index];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ void CMenus::ClearCustomItems(int CurTab)
|
|||
// reload current DDNet particles skin
|
||||
GameClient()->LoadExtrasSkin(g_Config.m_ClAssetExtras);
|
||||
}
|
||||
s_InitCustomList[CurTab] = true;
|
||||
gs_aInitCustomList[CurTab] = true;
|
||||
}
|
||||
|
||||
template<typename TName, typename TCaller>
|
||||
|
@ -360,8 +360,8 @@ void InitAssetList(std::vector<TName> &vAssetList, const char *pAssetPath, const
|
|||
pStorage->ListDirectory(IStorage::TYPE_ALL, pAssetPath, pfnCallback, Caller);
|
||||
std::sort(vAssetList.begin(), vAssetList.end());
|
||||
}
|
||||
if(vAssetList.size() != s_CustomListSize[s_CurCustomTab])
|
||||
s_InitCustomList[s_CurCustomTab] = true;
|
||||
if(vAssetList.size() != gs_aCustomListSize[s_CurCustomTab])
|
||||
gs_aInitCustomList[s_CurCustomTab] = true;
|
||||
}
|
||||
|
||||
template<typename TName>
|
||||
|
@ -371,13 +371,13 @@ int InitSearchList(std::vector<const TName *> &vpSearchList, std::vector<TName>
|
|||
int ListSize = vAssetList.size();
|
||||
for(int i = 0; i < ListSize; ++i)
|
||||
{
|
||||
const TName *s = &vAssetList[i];
|
||||
const TName *pAsset = &vAssetList[i];
|
||||
|
||||
// filter quick search
|
||||
if(s_aFilterString[s_CurCustomTab][0] != '\0' && !str_utf8_find_nocase(s->m_aName, s_aFilterString[s_CurCustomTab]))
|
||||
if(s_aFilterString[s_CurCustomTab][0] != '\0' && !str_utf8_find_nocase(pAsset->m_aName, s_aFilterString[s_CurCustomTab]))
|
||||
continue;
|
||||
|
||||
vpSearchList.push_back(s);
|
||||
vpSearchList.push_back(pAsset);
|
||||
}
|
||||
return vAssetList.size();
|
||||
}
|
||||
|
@ -429,8 +429,8 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
Storage()->ListDirectory(IStorage::TYPE_ALL, "assets/entities", EntitiesScan, &User);
|
||||
std::sort(m_vEntitiesList.begin(), m_vEntitiesList.end());
|
||||
}
|
||||
if(m_vEntitiesList.size() != s_CustomListSize[s_CurCustomTab])
|
||||
s_InitCustomList[s_CurCustomTab] = true;
|
||||
if(m_vEntitiesList.size() != gs_aCustomListSize[s_CurCustomTab])
|
||||
gs_aInitCustomList[s_CurCustomTab] = true;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
|
@ -458,46 +458,46 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
// skin selector
|
||||
MainView.HSplitTop(MainView.h - 10.0f - ms_ButtonHeight, &CustomList, &MainView);
|
||||
static float s_ScrollValue = 0.0f;
|
||||
if(s_InitCustomList[s_CurCustomTab])
|
||||
if(gs_aInitCustomList[s_CurCustomTab])
|
||||
{
|
||||
int ListSize = 0;
|
||||
if(s_CurCustomTab == ASSETS_TAB_ENTITIES)
|
||||
{
|
||||
s_vpSearchEntitiesList.clear();
|
||||
gs_vpSearchEntitiesList.clear();
|
||||
ListSize = m_vEntitiesList.size();
|
||||
for(int i = 0; i < ListSize; ++i)
|
||||
{
|
||||
const SCustomEntities *s = &m_vEntitiesList[i];
|
||||
const SCustomEntities *pEntity = &m_vEntitiesList[i];
|
||||
|
||||
// filter quick search
|
||||
if(s_aFilterString[s_CurCustomTab][0] != '\0' && !str_utf8_find_nocase(s->m_aName, s_aFilterString[s_CurCustomTab]))
|
||||
if(s_aFilterString[s_CurCustomTab][0] != '\0' && !str_utf8_find_nocase(pEntity->m_aName, s_aFilterString[s_CurCustomTab]))
|
||||
continue;
|
||||
|
||||
s_vpSearchEntitiesList.push_back(s);
|
||||
gs_vpSearchEntitiesList.push_back(pEntity);
|
||||
}
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
ListSize = InitSearchList(s_vpSearchGamesList, m_vGameList);
|
||||
ListSize = InitSearchList(gs_vpSearchGamesList, m_vGameList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EMOTICONS)
|
||||
{
|
||||
ListSize = InitSearchList(s_vpSearchEmoticonsList, m_vEmoticonList);
|
||||
ListSize = InitSearchList(gs_vpSearchEmoticonsList, m_vEmoticonList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_PARTICLES)
|
||||
{
|
||||
ListSize = InitSearchList(s_vpSearchParticlesList, m_vParticlesList);
|
||||
ListSize = InitSearchList(gs_vpSearchParticlesList, m_vParticlesList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_HUD)
|
||||
{
|
||||
ListSize = InitSearchList(s_vpSearchHudList, m_vHudList);
|
||||
ListSize = InitSearchList(gs_vpSearchHudList, m_vHudList);
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EXTRAS)
|
||||
{
|
||||
ListSize = InitSearchList(s_vpSearchExtrasList, m_vExtrasList);
|
||||
ListSize = InitSearchList(gs_vpSearchExtrasList, m_vExtrasList);
|
||||
}
|
||||
s_InitCustomList[s_CurCustomTab] = false;
|
||||
s_CustomListSize[s_CurCustomTab] = ListSize;
|
||||
gs_aInitCustomList[s_CurCustomTab] = false;
|
||||
gs_aCustomListSize[s_CurCustomTab] = ListSize;
|
||||
}
|
||||
|
||||
int OldSelected = -1;
|
||||
|
@ -509,69 +509,69 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
|
||||
if(s_CurCustomTab == ASSETS_TAB_ENTITIES)
|
||||
{
|
||||
SearchListSize = s_vpSearchEntitiesList.size();
|
||||
SearchListSize = gs_vpSearchEntitiesList.size();
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
SearchListSize = s_vpSearchGamesList.size();
|
||||
SearchListSize = gs_vpSearchGamesList.size();
|
||||
TextureHeight = 75;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EMOTICONS)
|
||||
{
|
||||
SearchListSize = s_vpSearchEmoticonsList.size();
|
||||
SearchListSize = gs_vpSearchEmoticonsList.size();
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_PARTICLES)
|
||||
{
|
||||
SearchListSize = s_vpSearchParticlesList.size();
|
||||
SearchListSize = gs_vpSearchParticlesList.size();
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_HUD)
|
||||
{
|
||||
SearchListSize = s_vpSearchHudList.size();
|
||||
SearchListSize = gs_vpSearchHudList.size();
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EXTRAS)
|
||||
{
|
||||
SearchListSize = s_vpSearchExtrasList.size();
|
||||
SearchListSize = gs_vpSearchExtrasList.size();
|
||||
}
|
||||
|
||||
UiDoListboxStart(&s_InitCustomList[s_CurCustomTab], &CustomList, TextureHeight + 15.0f + 10.0f + Margin, "", "", SearchListSize, CustomList.w / (Margin + TextureWidth), OldSelected, s_ScrollValue, true);
|
||||
UiDoListboxStart(&gs_aInitCustomList[s_CurCustomTab], &CustomList, TextureHeight + 15.0f + 10.0f + Margin, "", "", SearchListSize, CustomList.w / (Margin + TextureWidth), OldSelected, s_ScrollValue, true);
|
||||
for(size_t i = 0; i < SearchListSize; ++i)
|
||||
{
|
||||
const SCustomItem *s = GetCustomItem(s_CurCustomTab, i);
|
||||
if(s == NULL)
|
||||
const SCustomItem *pItem = GetCustomItem(s_CurCustomTab, i);
|
||||
if(pItem == NULL)
|
||||
continue;
|
||||
|
||||
if(s_CurCustomTab == ASSETS_TAB_ENTITIES)
|
||||
{
|
||||
if(str_comp(s->m_aName, g_Config.m_ClAssetsEntites) == 0)
|
||||
if(str_comp(pItem->m_aName, g_Config.m_ClAssetsEntites) == 0)
|
||||
OldSelected = i;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_GAME)
|
||||
{
|
||||
if(str_comp(s->m_aName, g_Config.m_ClAssetGame) == 0)
|
||||
if(str_comp(pItem->m_aName, g_Config.m_ClAssetGame) == 0)
|
||||
OldSelected = i;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EMOTICONS)
|
||||
{
|
||||
if(str_comp(s->m_aName, g_Config.m_ClAssetEmoticons) == 0)
|
||||
if(str_comp(pItem->m_aName, g_Config.m_ClAssetEmoticons) == 0)
|
||||
OldSelected = i;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_PARTICLES)
|
||||
{
|
||||
if(str_comp(s->m_aName, g_Config.m_ClAssetParticles) == 0)
|
||||
if(str_comp(pItem->m_aName, g_Config.m_ClAssetParticles) == 0)
|
||||
OldSelected = i;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_HUD)
|
||||
{
|
||||
if(str_comp(s->m_aName, g_Config.m_ClAssetHud) == 0)
|
||||
if(str_comp(pItem->m_aName, g_Config.m_ClAssetHud) == 0)
|
||||
OldSelected = i;
|
||||
}
|
||||
else if(s_CurCustomTab == ASSETS_TAB_EXTRAS)
|
||||
{
|
||||
if(str_comp(s->m_aName, g_Config.m_ClAssetExtras) == 0)
|
||||
if(str_comp(pItem->m_aName, g_Config.m_ClAssetExtras) == 0)
|
||||
OldSelected = i;
|
||||
}
|
||||
|
||||
CListboxItem Item = UiDoListboxNextItem(s, OldSelected >= 0 && (size_t)OldSelected == i);
|
||||
CListboxItem Item = UiDoListboxNextItem(pItem, OldSelected >= 0 && (size_t)OldSelected == i);
|
||||
CUIRect ItemRect = Item.m_Rect;
|
||||
ItemRect.Margin(Margin / 2, &ItemRect);
|
||||
if(Item.m_Visible)
|
||||
|
@ -579,11 +579,11 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
CUIRect TextureRect;
|
||||
ItemRect.HSplitTop(15, &ItemRect, &TextureRect);
|
||||
TextureRect.HSplitTop(10, NULL, &TextureRect);
|
||||
UI()->DoLabel(&ItemRect, s->m_aName, ItemRect.h - 2, TEXTALIGN_CENTER);
|
||||
if(s->m_RenderTexture.IsValid())
|
||||
UI()->DoLabel(&ItemRect, pItem->m_aName, ItemRect.h - 2, TEXTALIGN_CENTER);
|
||||
if(pItem->m_RenderTexture.IsValid())
|
||||
{
|
||||
Graphics()->WrapClamp();
|
||||
Graphics()->TextureSet(s->m_RenderTexture);
|
||||
Graphics()->TextureSet(pItem->m_RenderTexture);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(1, 1, 1, 1);
|
||||
IGraphics::CQuadItem QuadItem(TextureRect.x + (TextureRect.w - TextureWidth) / 2, TextureRect.y + (TextureRect.h - TextureHeight) / 2, TextureWidth, TextureHeight);
|
||||
|
@ -660,7 +660,7 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
|||
}
|
||||
EditProps.m_pEmptyText = Localize("Search");
|
||||
if(UIEx()->DoClearableEditBox(&s_aFilterString[s_CurCustomTab], &s_ClearButton, &QuickSearch, s_aFilterString[s_CurCustomTab], sizeof(s_aFilterString[0]), 14.0f, &s_Offset, false, CUI::CORNER_ALL, EditProps))
|
||||
s_InitCustomList[s_CurCustomTab] = true;
|
||||
gs_aInitCustomList[s_CurCustomTab] = true;
|
||||
}
|
||||
|
||||
DirectoryButton.HSplitTop(5.0f, 0, &DirectoryButton);
|
||||
|
|
|
@ -84,7 +84,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
{
|
||||
float a = 1;
|
||||
if(g_Config.m_ClNameplatesAlways == 0)
|
||||
a = clamp(1 - powf(distance(m_pClient->m_Controls.m_TargetPos[g_Config.m_ClDummy], Position) / 200.0f, 16.0f), 0.0f, 1.0f);
|
||||
a = clamp(1 - powf(distance(m_pClient->m_Controls.m_aTargetPos[g_Config.m_ClDummy], Position) / 200.0f, 16.0f), 0.0f, 1.0f);
|
||||
|
||||
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientID].m_aName;
|
||||
if(str_comp(pName, m_aNamePlates[ClientID].m_aName) != 0 || FontSize != m_aNamePlates[ClientID].m_NameTextFontSize)
|
||||
|
@ -278,7 +278,7 @@ void CNamePlates::OnRender()
|
|||
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_paPlayerInfos[i];
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_apPlayerInfos[i];
|
||||
if(!pInfo)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -287,7 +287,6 @@ void CParticles::RenderGroup(int Group)
|
|||
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Pos[0] = p.x;
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Pos[1] = p.y;
|
||||
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Scale = Size;
|
||||
s_aParticleRenderInfo[CurParticleRenderCount].m_Rotation = m_aParticles[i].m_Rot;
|
||||
|
||||
|
|
|
@ -84,19 +84,19 @@ float CPlayers::GetPlayerTargetAngle(
|
|||
AngleIntraTick = Client()->IntraGameTick(g_Config.m_ClDummy);
|
||||
if(ClientID >= 0 && m_pClient->m_Snap.m_aCharacters[ClientID].m_HasExtendedDisplayInfo)
|
||||
{
|
||||
CNetObj_DDNetCharacter *ExtendedData = &m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedData;
|
||||
CNetObj_DDNetCharacter *pExtendedData = &m_pClient->m_Snap.m_aCharacters[ClientID].m_ExtendedData;
|
||||
if(m_pClient->m_Snap.m_aCharacters[ClientID].m_PrevExtendedData)
|
||||
{
|
||||
const CNetObj_DDNetCharacter *PrevExtendedData = m_pClient->m_Snap.m_aCharacters[ClientID].m_PrevExtendedData;
|
||||
|
||||
float MixX = mix((float)PrevExtendedData->m_TargetX, (float)ExtendedData->m_TargetX, AngleIntraTick);
|
||||
float MixY = mix((float)PrevExtendedData->m_TargetY, (float)ExtendedData->m_TargetY, AngleIntraTick);
|
||||
float MixX = mix((float)PrevExtendedData->m_TargetX, (float)pExtendedData->m_TargetX, AngleIntraTick);
|
||||
float MixY = mix((float)PrevExtendedData->m_TargetY, (float)pExtendedData->m_TargetY, AngleIntraTick);
|
||||
|
||||
return angle(vec2(MixX, MixY));
|
||||
}
|
||||
else
|
||||
{
|
||||
return angle(vec2(ExtendedData->m_TargetX, ExtendedData->m_TargetY));
|
||||
return angle(vec2(pExtendedData->m_TargetX, pExtendedData->m_TargetY));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -143,7 +143,7 @@ void CPlayers::RenderHookCollLine(
|
|||
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
// just use the direct input if it's the local player we are rendering
|
||||
Angle = angle(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy]);
|
||||
Angle = angle(m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -170,15 +170,15 @@ void CPlayers::RenderHookCollLine(
|
|||
|
||||
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
ExDirection = normalize(vec2((int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].x, (int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].y));
|
||||
ExDirection = normalize(vec2((int)m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy].x, (int)m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy].y));
|
||||
|
||||
// fix direction if mouse is exactly in the center
|
||||
if(!(int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].x && !(int)m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy].y)
|
||||
if(!(int)m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy].x && !(int)m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy].y)
|
||||
ExDirection = vec2(1, 0);
|
||||
}
|
||||
Graphics()->TextureClear();
|
||||
vec2 InitPos = Position;
|
||||
vec2 FinishPos = InitPos + ExDirection * (m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength - 42.0f);
|
||||
vec2 FinishPos = InitPos + ExDirection * (m_pClient->m_aTuning[g_Config.m_ClDummy].m_HookLength - 42.0f);
|
||||
|
||||
if(g_Config.m_ClHookCollSize > 0)
|
||||
Graphics()->QuadsBegin();
|
||||
|
@ -196,11 +196,11 @@ void CPlayers::RenderHookCollLine(
|
|||
do
|
||||
{
|
||||
OldPos = NewPos;
|
||||
NewPos = OldPos + ExDirection * m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookFireSpeed;
|
||||
NewPos = OldPos + ExDirection * m_pClient->m_aTuning[g_Config.m_ClDummy].m_HookFireSpeed;
|
||||
|
||||
if(distance(InitPos, NewPos) > m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength)
|
||||
if(distance(InitPos, NewPos) > m_pClient->m_aTuning[g_Config.m_ClDummy].m_HookLength)
|
||||
{
|
||||
NewPos = InitPos + normalize(NewPos - InitPos) * m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength;
|
||||
NewPos = InitPos + normalize(NewPos - InitPos) * m_pClient->m_aTuning[g_Config.m_ClDummy].m_HookLength;
|
||||
DoBreak = true;
|
||||
}
|
||||
|
||||
|
@ -321,19 +321,18 @@ void CPlayers::RenderHook(
|
|||
|
||||
// render chain
|
||||
++QuadOffset;
|
||||
static IGraphics::SRenderSpriteInfo s_HookChainRenderInfo[1024];
|
||||
static IGraphics::SRenderSpriteInfo s_aHookChainRenderInfo[1024];
|
||||
int HookChainCount = 0;
|
||||
for(float f = 24; f < d && HookChainCount < 1024; f += 24, ++HookChainCount)
|
||||
{
|
||||
vec2 p = HookPos + Dir * f;
|
||||
s_HookChainRenderInfo[HookChainCount].m_Pos[0] = p.x;
|
||||
s_HookChainRenderInfo[HookChainCount].m_Pos[1] = p.y;
|
||||
|
||||
s_HookChainRenderInfo[HookChainCount].m_Scale = 1;
|
||||
s_HookChainRenderInfo[HookChainCount].m_Rotation = angle(Dir) + pi;
|
||||
s_aHookChainRenderInfo[HookChainCount].m_Pos[0] = p.x;
|
||||
s_aHookChainRenderInfo[HookChainCount].m_Pos[1] = p.y;
|
||||
s_aHookChainRenderInfo[HookChainCount].m_Scale = 1;
|
||||
s_aHookChainRenderInfo[HookChainCount].m_Rotation = angle(Dir) + pi;
|
||||
}
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteHookChain);
|
||||
Graphics()->RenderQuadContainerAsSpriteMultiple(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookChainCount, s_HookChainRenderInfo);
|
||||
Graphics()->RenderQuadContainerAsSpriteMultiple(m_WeaponEmoteQuadContainerIndex, QuadOffset, HookChainCount, s_aHookChainRenderInfo);
|
||||
|
||||
Graphics()->QuadsSetRotation(0);
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
@ -390,7 +389,7 @@ void CPlayers::RenderPlayer(
|
|||
if(Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
// just use the direct input if it's the local player we are rendering
|
||||
Angle = angle(m_pClient->m_Controls.m_MousePos[g_Config.m_ClDummy]);
|
||||
Angle = angle(m_pClient->m_Controls.m_aMousePos[g_Config.m_ClDummy]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -548,8 +547,8 @@ void CPlayers::RenderPlayer(
|
|||
WeaponPosition = Position;
|
||||
float OffsetX = g_pData->m_Weapons.m_aId[CurrentWeapon].m_Muzzleoffsetx;
|
||||
WeaponPosition -= Dir * OffsetX;
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteWeaponsMuzzles[CurrentWeapon][IteX]);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponSpriteMuzzleQuadContainerIndex[CurrentWeapon], QuadOffset, WeaponPosition.x, WeaponPosition.y);
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aaSpriteWeaponsMuzzles[CurrentWeapon][IteX]);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_aWeaponSpriteMuzzleQuadContainerIndex[CurrentWeapon], QuadOffset, WeaponPosition.x, WeaponPosition.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -605,8 +604,8 @@ void CPlayers::RenderPlayer(
|
|||
|
||||
vec2 DirY(-Dir.y, Dir.x);
|
||||
vec2 MuzzlePos = WeaponPosition + Dir * g_pData->m_Weapons.m_aId[CurrentWeapon].m_Muzzleoffsetx + DirY * OffsetY;
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteWeaponsMuzzles[CurrentWeapon][IteX]);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_WeaponSpriteMuzzleQuadContainerIndex[CurrentWeapon], QuadOffset, MuzzlePos.x, MuzzlePos.y);
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_aaSpriteWeaponsMuzzles[CurrentWeapon][IteX]);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_aWeaponSpriteMuzzleQuadContainerIndex[CurrentWeapon], QuadOffset, MuzzlePos.x, MuzzlePos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -662,7 +661,7 @@ void CPlayers::RenderPlayer(
|
|||
if(ClientID < 0)
|
||||
return;
|
||||
|
||||
if(g_Config.m_ClAfkEmote && m_pClient->m_aClients[ClientID].m_Afk && !(Client()->DummyConnected() && ClientID == m_pClient->m_LocalIDs[!g_Config.m_ClDummy]))
|
||||
if(g_Config.m_ClAfkEmote && m_pClient->m_aClients[ClientID].m_Afk && !(Client()->DummyConnected() && ClientID == m_pClient->m_aLocalIDs[!g_Config.m_ClDummy]))
|
||||
{
|
||||
int CurEmoticon = (SPRITE_ZZZ - SPRITE_OOP);
|
||||
Graphics()->TextureSet(GameClient()->m_EmoticonsSkin.m_aSpriteEmoticons[CurEmoticon]);
|
||||
|
@ -864,7 +863,7 @@ void CPlayers::OnInit()
|
|||
|
||||
for(int i = 0; i < NUM_WEAPONS; ++i)
|
||||
{
|
||||
m_WeaponSpriteMuzzleQuadContainerIndex[i] = Graphics()->CreateQuadContainer(false);
|
||||
m_aWeaponSpriteMuzzleQuadContainerIndex[i] = Graphics()->CreateQuadContainer(false);
|
||||
for(int n = 0; n < g_pData->m_Weapons.m_aId[i].m_NumSpriteMuzzles; ++n)
|
||||
{
|
||||
if(g_pData->m_Weapons.m_aId[i].m_aSpriteMuzzles[n])
|
||||
|
@ -883,17 +882,17 @@ void CPlayers::OnInit()
|
|||
|
||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||
if(WEAPON_NINJA == i)
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], 160.f * ScaleX, 160.f * ScaleY);
|
||||
RenderTools()->QuadContainerAddSprite(m_aWeaponSpriteMuzzleQuadContainerIndex[i], 160.f * ScaleX, 160.f * ScaleY);
|
||||
else
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], SWidth, SHeight);
|
||||
RenderTools()->QuadContainerAddSprite(m_aWeaponSpriteMuzzleQuadContainerIndex[i], SWidth, SHeight);
|
||||
|
||||
Graphics()->QuadsSetSubset(0, 1, 1, 0);
|
||||
if(WEAPON_NINJA == i)
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], 160.f * ScaleX, 160.f * ScaleY);
|
||||
RenderTools()->QuadContainerAddSprite(m_aWeaponSpriteMuzzleQuadContainerIndex[i], 160.f * ScaleX, 160.f * ScaleY);
|
||||
else
|
||||
RenderTools()->QuadContainerAddSprite(m_WeaponSpriteMuzzleQuadContainerIndex[i], SWidth, SHeight);
|
||||
RenderTools()->QuadContainerAddSprite(m_aWeaponSpriteMuzzleQuadContainerIndex[i], SWidth, SHeight);
|
||||
}
|
||||
Graphics()->QuadContainerUpload(m_WeaponSpriteMuzzleQuadContainerIndex[i]);
|
||||
Graphics()->QuadContainerUpload(m_aWeaponSpriteMuzzleQuadContainerIndex[i]);
|
||||
}
|
||||
|
||||
Graphics()->QuadsSetSubset(0.f, 0.f, 1.f, 1.f);
|
||||
|
|
|
@ -39,7 +39,7 @@ class CPlayers : public CComponent
|
|||
bool IsPlayerInfoAvailable(int ClientID) const;
|
||||
|
||||
int m_WeaponEmoteQuadContainerIndex;
|
||||
int m_WeaponSpriteMuzzleQuadContainerIndex[NUM_WEAPONS];
|
||||
int m_aWeaponSpriteMuzzleQuadContainerIndex[NUM_WEAPONS];
|
||||
|
||||
public:
|
||||
virtual int Sizeof() const override { return sizeof(*this); }
|
||||
|
|
|
@ -112,7 +112,7 @@ void CScoreboard::RenderSpectators(float x, float y, float w, float h)
|
|||
Cursor.m_LineWidth = w - 20.0f;
|
||||
Cursor.m_MaxLines = 4;
|
||||
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_paInfoByName)
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_apInfoByName)
|
||||
{
|
||||
if(!pInfo || pInfo->m_Team != TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
@ -219,9 +219,9 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
else
|
||||
{
|
||||
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW &&
|
||||
m_pClient->m_Snap.m_paPlayerInfos[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID])
|
||||
m_pClient->m_Snap.m_apPlayerInfos[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID])
|
||||
{
|
||||
int Score = m_pClient->m_Snap.m_paPlayerInfos[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID]->m_Score;
|
||||
int Score = m_pClient->m_Snap.m_apPlayerInfos[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID]->m_Score;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Score);
|
||||
}
|
||||
else if(m_pClient->m_Snap.m_pLocalInfo)
|
||||
|
@ -329,7 +329,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
// make sure that we render the correct team
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_paInfoByDDTeamScore[i];
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_apInfoByDDTeamScore[i];
|
||||
if(!pInfo || pInfo->m_Team != Team)
|
||||
continue;
|
||||
|
||||
|
@ -341,7 +341,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
|
||||
for(int j = i + 1; j < MAX_CLIENTS; j++)
|
||||
{
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_paInfoByDDTeamScore[j];
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_apInfoByDDTeamScore[j];
|
||||
|
||||
if(!pInfo2 || pInfo2->m_Team != Team)
|
||||
continue;
|
||||
|
@ -354,7 +354,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
{
|
||||
for(int j = i - 1; j >= 0; j--)
|
||||
{
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_paInfoByDDTeamScore[j];
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_apInfoByDDTeamScore[j];
|
||||
|
||||
if(!pInfo2 || pInfo2->m_Team != Team)
|
||||
continue;
|
||||
|
@ -492,7 +492,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
|
||||
// clan
|
||||
if(str_comp(m_pClient->m_aClients[pInfo->m_ClientID].m_aClan,
|
||||
m_pClient->m_aClients[GameClient()->m_LocalIDs[g_Config.m_ClDummy]].m_aClan) == 0)
|
||||
m_pClient->m_aClients[GameClient()->m_aLocalIDs[g_Config.m_ClDummy]].m_aClan) == 0)
|
||||
{
|
||||
ColorRGBA Color = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClSameClanColor));
|
||||
TextRender()->TextColor(Color);
|
||||
|
@ -723,7 +723,7 @@ const char *CScoreboard::GetClanName(int Team)
|
|||
{
|
||||
int ClanPlayers = 0;
|
||||
const char *pClanName = 0;
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_paInfoByScore)
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_apInfoByScore)
|
||||
{
|
||||
if(!pInfo || pInfo->m_Team != Team)
|
||||
continue;
|
||||
|
|
|
@ -163,7 +163,7 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
Skin.m_OriginalSkin.m_HandsOutline = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_HAND_OUTLINE]);
|
||||
|
||||
for(int i = 0; i < 6; ++i)
|
||||
Skin.m_OriginalSkin.m_Eyes[i] = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_EYE_NORMAL + i]);
|
||||
Skin.m_OriginalSkin.m_aEyes[i] = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_EYE_NORMAL + i]);
|
||||
|
||||
int FeetGridPixelsWidth = (Info.m_Width / g_pData->m_aSprites[SPRITE_TEE_FOOT].m_pSet->m_Gridx);
|
||||
int FeetGridPixelsHeight = (Info.m_Height / g_pData->m_aSprites[SPRITE_TEE_FOOT].m_pSet->m_Gridy);
|
||||
|
@ -193,7 +193,7 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
int BodyHeight = g_pData->m_aSprites[SPRITE_TEE_BODY].m_H * (Info.m_Height / g_pData->m_aSprites[SPRITE_TEE_BODY].m_pSet->m_Gridy); // body height
|
||||
if(BodyWidth > Info.m_Width || BodyHeight > Info.m_Height)
|
||||
return 0;
|
||||
unsigned char *d = (unsigned char *)Info.m_pData;
|
||||
unsigned char *pData = (unsigned char *)Info.m_pData;
|
||||
const int PixelStep = 4;
|
||||
int Pitch = Info.m_Width * PixelStep;
|
||||
|
||||
|
@ -203,12 +203,12 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
for(int y = 0; y < BodyHeight; y++)
|
||||
for(int x = 0; x < BodyWidth; x++)
|
||||
{
|
||||
uint8_t AlphaValue = d[y * Pitch + x * PixelStep + 3];
|
||||
uint8_t AlphaValue = pData[y * Pitch + x * PixelStep + 3];
|
||||
if(AlphaValue > 128)
|
||||
{
|
||||
aColors[0] += d[y * Pitch + x * PixelStep + 0];
|
||||
aColors[1] += d[y * Pitch + x * PixelStep + 1];
|
||||
aColors[2] += d[y * Pitch + x * PixelStep + 2];
|
||||
aColors[0] += pData[y * Pitch + x * PixelStep + 0];
|
||||
aColors[1] += pData[y * Pitch + x * PixelStep + 1];
|
||||
aColors[2] += pData[y * Pitch + x * PixelStep + 2];
|
||||
}
|
||||
}
|
||||
if(aColors[0] != 0 && aColors[1] != 0 && aColors[2] != 0)
|
||||
|
@ -217,27 +217,27 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
Skin.m_BloodColor = ColorRGBA(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
CheckMetrics(Skin.m_Metrics.m_Body, d, Pitch, 0, 0, BodyWidth, BodyHeight);
|
||||
CheckMetrics(Skin.m_Metrics.m_Body, pData, Pitch, 0, 0, BodyWidth, BodyHeight);
|
||||
|
||||
// body outline metrics
|
||||
CheckMetrics(Skin.m_Metrics.m_Body, d, Pitch, BodyOutlineOffsetX, BodyOutlineOffsetY, BodyOutlineWidth, BodyOutlineHeight);
|
||||
CheckMetrics(Skin.m_Metrics.m_Body, pData, Pitch, BodyOutlineOffsetX, BodyOutlineOffsetY, BodyOutlineWidth, BodyOutlineHeight);
|
||||
|
||||
// get feet size
|
||||
CheckMetrics(Skin.m_Metrics.m_Feet, d, Pitch, FeetOffsetX, FeetOffsetY, FeetWidth, FeetHeight);
|
||||
CheckMetrics(Skin.m_Metrics.m_Feet, pData, Pitch, FeetOffsetX, FeetOffsetY, FeetWidth, FeetHeight);
|
||||
|
||||
// get feet outline size
|
||||
CheckMetrics(Skin.m_Metrics.m_Feet, d, Pitch, FeetOutlineOffsetX, FeetOutlineOffsetY, FeetOutlineWidth, FeetOutlineHeight);
|
||||
CheckMetrics(Skin.m_Metrics.m_Feet, pData, Pitch, FeetOutlineOffsetX, FeetOutlineOffsetY, FeetOutlineWidth, FeetOutlineHeight);
|
||||
|
||||
// make the texture gray scale
|
||||
for(int i = 0; i < Info.m_Width * Info.m_Height; i++)
|
||||
{
|
||||
int v = (d[i * PixelStep] + d[i * PixelStep + 1] + d[i * PixelStep + 2]) / 3;
|
||||
d[i * PixelStep] = v;
|
||||
d[i * PixelStep + 1] = v;
|
||||
d[i * PixelStep + 2] = v;
|
||||
int v = (pData[i * PixelStep] + pData[i * PixelStep + 1] + pData[i * PixelStep + 2]) / 3;
|
||||
pData[i * PixelStep] = v;
|
||||
pData[i * PixelStep + 1] = v;
|
||||
pData[i * PixelStep + 2] = v;
|
||||
}
|
||||
|
||||
int Freq[256] = {0};
|
||||
int aFreq[256] = {0};
|
||||
int OrgWeight = 0;
|
||||
int NewWeight = 192;
|
||||
|
||||
|
@ -245,13 +245,13 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
for(int y = 0; y < BodyHeight; y++)
|
||||
for(int x = 0; x < BodyWidth; x++)
|
||||
{
|
||||
if(d[y * Pitch + x * PixelStep + 3] > 128)
|
||||
Freq[d[y * Pitch + x * PixelStep]]++;
|
||||
if(pData[y * Pitch + x * PixelStep + 3] > 128)
|
||||
aFreq[pData[y * Pitch + x * PixelStep]]++;
|
||||
}
|
||||
|
||||
for(int i = 1; i < 256; i++)
|
||||
{
|
||||
if(Freq[OrgWeight] < Freq[i])
|
||||
if(aFreq[OrgWeight] < aFreq[i])
|
||||
OrgWeight = i;
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
for(int y = 0; y < BodyHeight; y++)
|
||||
for(int x = 0; x < BodyWidth; x++)
|
||||
{
|
||||
int v = d[y * Pitch + x * PixelStep];
|
||||
int v = pData[y * Pitch + x * PixelStep];
|
||||
if(v <= OrgWeight && OrgWeight == 0)
|
||||
v = 0;
|
||||
else if(v <= OrgWeight)
|
||||
|
@ -270,9 +270,9 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
v = NewWeight;
|
||||
else
|
||||
v = (int)(((v - OrgWeight) / (float)InvOrgWeight) * InvNewWeight + NewWeight);
|
||||
d[y * Pitch + x * PixelStep] = v;
|
||||
d[y * Pitch + x * PixelStep + 1] = v;
|
||||
d[y * Pitch + x * PixelStep + 2] = v;
|
||||
pData[y * Pitch + x * PixelStep] = v;
|
||||
pData[y * Pitch + x * PixelStep + 1] = v;
|
||||
pData[y * Pitch + x * PixelStep + 2] = v;
|
||||
}
|
||||
|
||||
Skin.m_ColorableSkin.m_Body = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_BODY]);
|
||||
|
@ -283,7 +283,7 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
Skin.m_ColorableSkin.m_HandsOutline = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_HAND_OUTLINE]);
|
||||
|
||||
for(int i = 0; i < 6; ++i)
|
||||
Skin.m_ColorableSkin.m_Eyes[i] = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_EYE_NORMAL + i]);
|
||||
Skin.m_ColorableSkin.m_aEyes[i] = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_EYE_NORMAL + i]);
|
||||
|
||||
Graphics()->FreePNG(&Info);
|
||||
|
||||
|
@ -302,17 +302,17 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
|
|||
|
||||
void CSkins::OnInit()
|
||||
{
|
||||
m_EventSkinPrefix[0] = '\0';
|
||||
m_aEventSkinPrefix[0] = '\0';
|
||||
|
||||
if(g_Config.m_Events)
|
||||
{
|
||||
time_t rawtime;
|
||||
struct tm *timeinfo;
|
||||
std::time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
if(timeinfo->tm_mon == 11 && timeinfo->tm_mday >= 24 && timeinfo->tm_mday <= 26)
|
||||
time_t RawTime;
|
||||
struct tm *pTimeInfo;
|
||||
std::time(&RawTime);
|
||||
pTimeInfo = localtime(&RawTime);
|
||||
if(pTimeInfo->tm_mon == 11 && pTimeInfo->tm_mday >= 24 && pTimeInfo->tm_mday <= 26)
|
||||
{ // Christmas
|
||||
str_copy(m_EventSkinPrefix, "santa", sizeof(m_EventSkinPrefix));
|
||||
str_copy(m_aEventSkinPrefix, "santa", sizeof(m_aEventSkinPrefix));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ void CSkins::Refresh(TSkinLoadedCBFunc &&SkinLoadedFunc)
|
|||
Graphics()->UnloadTexture(&Skin.m_OriginalSkin.m_FeetOutline);
|
||||
Graphics()->UnloadTexture(&Skin.m_OriginalSkin.m_Hands);
|
||||
Graphics()->UnloadTexture(&Skin.m_OriginalSkin.m_HandsOutline);
|
||||
for(auto &Eye : Skin.m_OriginalSkin.m_Eyes)
|
||||
for(auto &Eye : Skin.m_OriginalSkin.m_aEyes)
|
||||
Graphics()->UnloadTexture(&Eye);
|
||||
|
||||
Graphics()->UnloadTexture(&Skin.m_ColorableSkin.m_Body);
|
||||
|
@ -341,7 +341,7 @@ void CSkins::Refresh(TSkinLoadedCBFunc &&SkinLoadedFunc)
|
|||
Graphics()->UnloadTexture(&Skin.m_ColorableSkin.m_FeetOutline);
|
||||
Graphics()->UnloadTexture(&Skin.m_ColorableSkin.m_Hands);
|
||||
Graphics()->UnloadTexture(&Skin.m_ColorableSkin.m_HandsOutline);
|
||||
for(auto &Eye : Skin.m_ColorableSkin.m_Eyes)
|
||||
for(auto &Eye : Skin.m_ColorableSkin.m_aEyes)
|
||||
Graphics()->UnloadTexture(&Eye);
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ const CSkin *CSkins::Get(int Index)
|
|||
|
||||
int CSkins::Find(const char *pName)
|
||||
{
|
||||
const char *pSkinPrefix = m_EventSkinPrefix[0] ? m_EventSkinPrefix : g_Config.m_ClSkinPrefix;
|
||||
const char *pSkinPrefix = m_aEventSkinPrefix[0] ? m_aEventSkinPrefix : g_Config.m_ClSkinPrefix;
|
||||
if(g_Config.m_ClVanillaSkinsOnly && !IsVanillaSkin(pName))
|
||||
{
|
||||
return -1;
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
private:
|
||||
std::vector<CSkin> m_vSkins;
|
||||
std::vector<CDownloadSkin> m_vDownloadSkins;
|
||||
char m_EventSkinPrefix[24];
|
||||
char m_aEventSkinPrefix[24];
|
||||
|
||||
bool LoadSkinPNG(CImageInfo &Info, const char *pName, const char *pPath, int DirType);
|
||||
int LoadSkin(const char *pName, const char *pPath, int DirType);
|
||||
|
|
|
@ -27,7 +27,7 @@ bool CSpectator::CanChangeSpectator()
|
|||
void CSpectator::SpectateNext(bool Reverse)
|
||||
{
|
||||
int CurIndex = -1;
|
||||
const CNetObj_PlayerInfo **paPlayerInfos = m_pClient->m_Snap.m_paInfoByDDTeamName;
|
||||
const CNetObj_PlayerInfo **paPlayerInfos = m_pClient->m_Snap.m_apInfoByDDTeamName;
|
||||
|
||||
// m_SpectatorID may be uninitialized if m_Active is false
|
||||
if(m_pClient->m_Snap.m_SpecInfo.m_Active)
|
||||
|
@ -135,7 +135,7 @@ void CSpectator::ConSpectateClosest(IConsole::IResult *pResult, void *pUserData)
|
|||
int ClosestDistance = INT_MAX;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(i == SpectatorID || !Snap.m_paPlayerInfos[i] || Snap.m_paPlayerInfos[i]->m_Team == TEAM_SPECTATORS || (SpectatorID == SPEC_FREEVIEW && i == Snap.m_LocalClientID))
|
||||
if(i == SpectatorID || !Snap.m_apPlayerInfos[i] || Snap.m_apPlayerInfos[i]->m_Team == TEAM_SPECTATORS || (SpectatorID == SPEC_FREEVIEW && i == Snap.m_LocalClientID))
|
||||
continue;
|
||||
const CNetObj_Character &MaybeClosestCharacter = Snap.m_aCharacters[i].m_Cur;
|
||||
int Distance = distance(CurPosition, vec2(MaybeClosestCharacter.m_X, MaybeClosestCharacter.m_Y));
|
||||
|
@ -218,7 +218,7 @@ void CSpectator::OnRender()
|
|||
float BoxMove = -10.0f;
|
||||
float BoxOffset = 0.0f;
|
||||
|
||||
for(auto &pInfo : m_pClient->m_Snap.m_paInfoByDDTeamName)
|
||||
for(auto &pInfo : m_pClient->m_Snap.m_apInfoByDDTeamName)
|
||||
{
|
||||
if(!pInfo || pInfo->m_Team == TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
@ -302,7 +302,7 @@ void CSpectator::OnRender()
|
|||
|
||||
for(int i = 0, Count = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(!m_pClient->m_Snap.m_paInfoByDDTeamName[i] || m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_Team == TEAM_SPECTATORS)
|
||||
if(!m_pClient->m_Snap.m_apInfoByDDTeamName[i] || m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_Team == TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
||||
++Count;
|
||||
|
@ -313,13 +313,13 @@ void CSpectator::OnRender()
|
|||
y = StartY;
|
||||
}
|
||||
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_paInfoByDDTeamName[i];
|
||||
const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_apInfoByDDTeamName[i];
|
||||
int DDTeam = m_pClient->m_Teams.Team(pInfo->m_ClientID);
|
||||
int NextDDTeam = 0;
|
||||
|
||||
for(int j = i + 1; j < MAX_CLIENTS; j++)
|
||||
{
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_paInfoByDDTeamName[j];
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_apInfoByDDTeamName[j];
|
||||
|
||||
if(!pInfo2 || pInfo2->m_Team == TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
@ -332,7 +332,7 @@ void CSpectator::OnRender()
|
|||
{
|
||||
for(int j = i - 1; j >= 0; j--)
|
||||
{
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_paInfoByDDTeamName[j];
|
||||
const CNetObj_PlayerInfo *pInfo2 = m_pClient->m_Snap.m_apInfoByDDTeamName[j];
|
||||
|
||||
if(!pInfo2 || pInfo2->m_Team == TEAM_SPECTATORS)
|
||||
continue;
|
||||
|
@ -363,7 +363,7 @@ void CSpectator::OnRender()
|
|||
|
||||
OldDDTeam = DDTeam;
|
||||
|
||||
if((Client()->State() == IClient::STATE_DEMOPLAYBACK && m_pClient->m_DemoSpecID == m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID) || (Client()->State() != IClient::STATE_DEMOPLAYBACK && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID == m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID))
|
||||
if((Client()->State() == IClient::STATE_DEMOPLAYBACK && m_pClient->m_DemoSpecID == m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID) || (Client()->State() != IClient::STATE_DEMOPLAYBACK && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID == m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID))
|
||||
{
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->QuadsBegin();
|
||||
|
@ -376,12 +376,12 @@ void CSpectator::OnRender()
|
|||
if(m_SelectorMouse.x >= x - 10.0f && m_SelectorMouse.x < x + 260.0f &&
|
||||
m_SelectorMouse.y >= y - (LineHeight / 6.0f) && m_SelectorMouse.y < y + (LineHeight * 5.0f / 6.0f))
|
||||
{
|
||||
m_SelectedSpectatorID = m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID;
|
||||
m_SelectedSpectatorID = m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID;
|
||||
Selected = true;
|
||||
}
|
||||
float TeeAlpha;
|
||||
if(Client()->State() == IClient::STATE_DEMOPLAYBACK &&
|
||||
!m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID].m_Active)
|
||||
!m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID].m_Active)
|
||||
{
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 0.25f);
|
||||
TeeAlpha = 0.5f;
|
||||
|
@ -391,14 +391,14 @@ void CSpectator::OnRender()
|
|||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Selected ? 1.0f : 0.5f);
|
||||
TeeAlpha = 1.0f;
|
||||
}
|
||||
TextRender()->Text(0, Width / 2.0f + x + 50.0f, Height / 2.0f + y + BoxMove + (LineHeight - FontSize) / 2.f, FontSize, m_pClient->m_aClients[m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID].m_aName, 220.0f);
|
||||
TextRender()->Text(0, Width / 2.0f + x + 50.0f, Height / 2.0f + y + BoxMove + (LineHeight - FontSize) / 2.f, FontSize, m_pClient->m_aClients[m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID].m_aName, 220.0f);
|
||||
|
||||
// flag
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_FLAGS &&
|
||||
m_pClient->m_Snap.m_pGameDataObj && (m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierRed == m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID || m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue == m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID))
|
||||
m_pClient->m_Snap.m_pGameDataObj && (m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierRed == m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID || m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue == m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID))
|
||||
{
|
||||
Graphics()->BlendNormal();
|
||||
if(m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue == m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID)
|
||||
if(m_pClient->m_Snap.m_pGameDataObj->m_FlagCarrierBlue == m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID)
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteFlagBlue);
|
||||
else
|
||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteFlagRed);
|
||||
|
@ -412,7 +412,7 @@ void CSpectator::OnRender()
|
|||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID].m_RenderInfo;
|
||||
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID].m_RenderInfo;
|
||||
TeeInfo.m_Size *= TeeSizeMod;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
|
@ -422,7 +422,7 @@ void CSpectator::OnRender()
|
|||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos, TeeAlpha);
|
||||
|
||||
if(m_pClient->m_aClients[m_pClient->m_Snap.m_paInfoByDDTeamName[i]->m_ClientID].m_Friend)
|
||||
if(m_pClient->m_aClients[m_pClient->m_Snap.m_apInfoByDDTeamName[i]->m_ClientID].m_Friend)
|
||||
{
|
||||
ColorRGBA rgb = color_cast<ColorRGBA>(ColorHSLA(g_Config.m_ClMessageFriendColor));
|
||||
TextRender()->TextColor(rgb.WithAlpha(1.f));
|
||||
|
|
|
@ -136,7 +136,7 @@ void CStatboard::RenderGlobalStats()
|
|||
int NumPlayers = 0;
|
||||
|
||||
// sort red or dm players by score
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_paInfoByScore)
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_apInfoByScore)
|
||||
{
|
||||
if(!pInfo || !m_pClient->m_aStats[pInfo->m_ClientID].IsActive() || m_pClient->m_aClients[pInfo->m_ClientID].m_Team != TEAM_RED)
|
||||
continue;
|
||||
|
@ -147,7 +147,7 @@ void CStatboard::RenderGlobalStats()
|
|||
// sort blue players by score after
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS)
|
||||
{
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_paInfoByScore)
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_apInfoByScore)
|
||||
{
|
||||
if(!pInfo || !m_pClient->m_aStats[pInfo->m_ClientID].IsActive() || m_pClient->m_aClients[pInfo->m_ClientID].m_Team != TEAM_BLUE)
|
||||
continue;
|
||||
|
@ -454,7 +454,7 @@ void CStatboard::FormatStats(char *pDest, size_t DestSize)
|
|||
int NumPlayers = 0;
|
||||
|
||||
// sort red or dm players by score
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_paInfoByScore)
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_apInfoByScore)
|
||||
{
|
||||
if(!pInfo || !m_pClient->m_aStats[pInfo->m_ClientID].IsActive() || m_pClient->m_aClients[pInfo->m_ClientID].m_Team != TEAM_RED)
|
||||
continue;
|
||||
|
@ -465,7 +465,7 @@ void CStatboard::FormatStats(char *pDest, size_t DestSize)
|
|||
// sort blue players by score after
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS)
|
||||
{
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_paInfoByScore)
|
||||
for(const auto *pInfo : m_pClient->m_Snap.m_apInfoByScore)
|
||||
{
|
||||
if(!pInfo || !m_pClient->m_aStats[pInfo->m_ClientID].IsActive() || m_pClient->m_aClients[pInfo->m_ClientID].m_Team != TEAM_BLUE)
|
||||
continue;
|
||||
|
|
|
@ -27,9 +27,9 @@ void CVoting::ConVote(IConsole::IResult *pResult, void *pUserData)
|
|||
void CVoting::Callvote(const char *pType, const char *pValue, const char *pReason)
|
||||
{
|
||||
CNetMsg_Cl_CallVote Msg = {0};
|
||||
Msg.m_Type = pType;
|
||||
Msg.m_Value = pValue;
|
||||
Msg.m_Reason = pReason;
|
||||
Msg.m_pType = pType;
|
||||
Msg.m_pValue = pValue;
|
||||
Msg.m_pReason = pReason;
|
||||
Client()->SendPackMsgActive(&Msg, MSGFLAG_VITAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -306,12 +306,12 @@ void CGameClient::OnInit()
|
|||
|
||||
m_ServerMode = SERVERMODE_PURE;
|
||||
|
||||
m_DDRaceMsgSent[0] = false;
|
||||
m_DDRaceMsgSent[1] = false;
|
||||
m_ShowOthers[0] = SHOW_OTHERS_NOT_SET;
|
||||
m_ShowOthers[1] = SHOW_OTHERS_NOT_SET;
|
||||
m_SwitchStateTeam[0] = -1;
|
||||
m_SwitchStateTeam[1] = -1;
|
||||
m_aDDRaceMsgSent[0] = false;
|
||||
m_aDDRaceMsgSent[1] = false;
|
||||
m_aShowOthers[0] = SHOW_OTHERS_NOT_SET;
|
||||
m_aShowOthers[1] = SHOW_OTHERS_NOT_SET;
|
||||
m_aSwitchStateTeam[0] = -1;
|
||||
m_aSwitchStateTeam[1] = -1;
|
||||
|
||||
m_LastZoom = .0;
|
||||
m_LastScreenAspect = .0;
|
||||
|
@ -405,11 +405,11 @@ void CGameClient::OnDummySwap()
|
|||
{
|
||||
int PlayerOrDummy = (g_Config.m_ClDummyResetOnSwitch == 2) ? g_Config.m_ClDummy : (!g_Config.m_ClDummy);
|
||||
m_Controls.ResetInput(PlayerOrDummy);
|
||||
m_Controls.m_InputData[PlayerOrDummy].m_Hook = 0;
|
||||
m_Controls.m_aInputData[PlayerOrDummy].m_Hook = 0;
|
||||
}
|
||||
int tmp = m_DummyInput.m_Fire;
|
||||
m_DummyInput = m_Controls.m_InputData[!g_Config.m_ClDummy];
|
||||
m_Controls.m_InputData[g_Config.m_ClDummy].m_Fire = tmp;
|
||||
m_DummyInput = m_Controls.m_aInputData[!g_Config.m_ClDummy];
|
||||
m_Controls.m_aInputData[g_Config.m_ClDummy].m_Fire = tmp;
|
||||
m_IsDummySwapping = 1;
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ int CGameClient::OnSnapInput(int *pData, bool Dummy, bool Force)
|
|||
}
|
||||
|
||||
vec2 MainPos = m_LocalCharacterPos;
|
||||
vec2 DummyPos = m_aClients[m_LocalIDs[!g_Config.m_ClDummy]].m_Predicted.m_Pos;
|
||||
vec2 DummyPos = m_aClients[m_aLocalIDs[!g_Config.m_ClDummy]].m_Predicted.m_Pos;
|
||||
vec2 Dir = MainPos - DummyPos;
|
||||
m_HammerInput.m_TargetX = (int)(Dir.x);
|
||||
m_HammerInput.m_TargetY = (int)(Dir.y);
|
||||
|
@ -520,17 +520,17 @@ void CGameClient::OnConnected()
|
|||
|
||||
void CGameClient::OnReset()
|
||||
{
|
||||
m_LastNewPredictedTick[0] = -1;
|
||||
m_LastNewPredictedTick[1] = -1;
|
||||
m_aLastNewPredictedTick[0] = -1;
|
||||
m_aLastNewPredictedTick[1] = -1;
|
||||
|
||||
m_LocalTuneZone[0] = 0;
|
||||
m_LocalTuneZone[1] = 0;
|
||||
m_aLocalTuneZone[0] = 0;
|
||||
m_aLocalTuneZone[1] = 0;
|
||||
|
||||
m_ExpectingTuningForZone[0] = -1;
|
||||
m_ExpectingTuningForZone[1] = -1;
|
||||
m_aExpectingTuningForZone[0] = -1;
|
||||
m_aExpectingTuningForZone[1] = -1;
|
||||
|
||||
m_ReceivedTuning[0] = false;
|
||||
m_ReceivedTuning[1] = false;
|
||||
m_aReceivedTuning[0] = false;
|
||||
m_aReceivedTuning[1] = false;
|
||||
|
||||
InvalidateSnapshot();
|
||||
|
||||
|
@ -541,18 +541,18 @@ void CGameClient::OnReset()
|
|||
pComponent->OnReset();
|
||||
|
||||
m_DemoSpecID = SPEC_FOLLOW;
|
||||
m_FlagDropTick[TEAM_RED] = 0;
|
||||
m_FlagDropTick[TEAM_BLUE] = 0;
|
||||
m_aFlagDropTick[TEAM_RED] = 0;
|
||||
m_aFlagDropTick[TEAM_BLUE] = 0;
|
||||
m_LastRoundStartTick = -1;
|
||||
m_LastFlagCarrierRed = -4;
|
||||
m_LastFlagCarrierBlue = -4;
|
||||
m_Tuning[g_Config.m_ClDummy] = CTuningParams();
|
||||
m_aTuning[g_Config.m_ClDummy] = CTuningParams();
|
||||
|
||||
m_Teams.Reset();
|
||||
m_DDRaceMsgSent[0] = false;
|
||||
m_DDRaceMsgSent[1] = false;
|
||||
m_ShowOthers[0] = SHOW_OTHERS_NOT_SET;
|
||||
m_ShowOthers[1] = SHOW_OTHERS_NOT_SET;
|
||||
m_aDDRaceMsgSent[0] = false;
|
||||
m_aDDRaceMsgSent[1] = false;
|
||||
m_aShowOthers[0] = SHOW_OTHERS_NOT_SET;
|
||||
m_aShowOthers[1] = SHOW_OTHERS_NOT_SET;
|
||||
|
||||
m_LastZoom = .0;
|
||||
m_LastScreenAspect = .0;
|
||||
|
@ -650,52 +650,52 @@ void CGameClient::OnRender()
|
|||
// resend player and dummy info if it was filtered by server
|
||||
if(Client()->State() == IClient::STATE_ONLINE && !m_Menus.IsActive())
|
||||
{
|
||||
if(m_CheckInfo[0] == 0)
|
||||
if(m_aCheckInfo[0] == 0)
|
||||
{
|
||||
if(
|
||||
str_comp(m_aClients[m_LocalIDs[0]].m_aName, Client()->PlayerName()) ||
|
||||
str_comp(m_aClients[m_LocalIDs[0]].m_aClan, g_Config.m_PlayerClan) ||
|
||||
m_aClients[m_LocalIDs[0]].m_Country != g_Config.m_PlayerCountry ||
|
||||
str_comp(m_aClients[m_LocalIDs[0]].m_aSkinName, g_Config.m_ClPlayerSkin) ||
|
||||
m_aClients[m_LocalIDs[0]].m_UseCustomColor != g_Config.m_ClPlayerUseCustomColor ||
|
||||
m_aClients[m_LocalIDs[0]].m_ColorBody != (int)g_Config.m_ClPlayerColorBody ||
|
||||
m_aClients[m_LocalIDs[0]].m_ColorFeet != (int)g_Config.m_ClPlayerColorFeet)
|
||||
str_comp(m_aClients[m_aLocalIDs[0]].m_aName, Client()->PlayerName()) ||
|
||||
str_comp(m_aClients[m_aLocalIDs[0]].m_aClan, g_Config.m_PlayerClan) ||
|
||||
m_aClients[m_aLocalIDs[0]].m_Country != g_Config.m_PlayerCountry ||
|
||||
str_comp(m_aClients[m_aLocalIDs[0]].m_aSkinName, g_Config.m_ClPlayerSkin) ||
|
||||
m_aClients[m_aLocalIDs[0]].m_UseCustomColor != g_Config.m_ClPlayerUseCustomColor ||
|
||||
m_aClients[m_aLocalIDs[0]].m_ColorBody != (int)g_Config.m_ClPlayerColorBody ||
|
||||
m_aClients[m_aLocalIDs[0]].m_ColorFeet != (int)g_Config.m_ClPlayerColorFeet)
|
||||
SendInfo(false);
|
||||
else
|
||||
m_CheckInfo[0] = -1;
|
||||
m_aCheckInfo[0] = -1;
|
||||
}
|
||||
|
||||
if(m_CheckInfo[0] > 0)
|
||||
m_CheckInfo[0]--;
|
||||
if(m_aCheckInfo[0] > 0)
|
||||
m_aCheckInfo[0]--;
|
||||
|
||||
if(Client()->DummyConnected())
|
||||
{
|
||||
if(m_CheckInfo[1] == 0)
|
||||
if(m_aCheckInfo[1] == 0)
|
||||
{
|
||||
if(
|
||||
str_comp(m_aClients[m_LocalIDs[1]].m_aName, Client()->DummyName()) ||
|
||||
str_comp(m_aClients[m_LocalIDs[1]].m_aClan, g_Config.m_ClDummyClan) ||
|
||||
m_aClients[m_LocalIDs[1]].m_Country != g_Config.m_ClDummyCountry ||
|
||||
str_comp(m_aClients[m_LocalIDs[1]].m_aSkinName, g_Config.m_ClDummySkin) ||
|
||||
m_aClients[m_LocalIDs[1]].m_UseCustomColor != g_Config.m_ClDummyUseCustomColor ||
|
||||
m_aClients[m_LocalIDs[1]].m_ColorBody != (int)g_Config.m_ClDummyColorBody ||
|
||||
m_aClients[m_LocalIDs[1]].m_ColorFeet != (int)g_Config.m_ClDummyColorFeet)
|
||||
str_comp(m_aClients[m_aLocalIDs[1]].m_aName, Client()->DummyName()) ||
|
||||
str_comp(m_aClients[m_aLocalIDs[1]].m_aClan, g_Config.m_ClDummyClan) ||
|
||||
m_aClients[m_aLocalIDs[1]].m_Country != g_Config.m_ClDummyCountry ||
|
||||
str_comp(m_aClients[m_aLocalIDs[1]].m_aSkinName, g_Config.m_ClDummySkin) ||
|
||||
m_aClients[m_aLocalIDs[1]].m_UseCustomColor != g_Config.m_ClDummyUseCustomColor ||
|
||||
m_aClients[m_aLocalIDs[1]].m_ColorBody != (int)g_Config.m_ClDummyColorBody ||
|
||||
m_aClients[m_aLocalIDs[1]].m_ColorFeet != (int)g_Config.m_ClDummyColorFeet)
|
||||
SendDummyInfo(false);
|
||||
else
|
||||
m_CheckInfo[1] = -1;
|
||||
m_aCheckInfo[1] = -1;
|
||||
}
|
||||
|
||||
if(m_CheckInfo[1] > 0)
|
||||
m_CheckInfo[1]--;
|
||||
if(m_aCheckInfo[1] > 0)
|
||||
m_aCheckInfo[1]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameClient::OnDummyDisconnect()
|
||||
{
|
||||
m_DDRaceMsgSent[1] = false;
|
||||
m_ShowOthers[1] = SHOW_OTHERS_NOT_SET;
|
||||
m_LastNewPredictedTick[1] = -1;
|
||||
m_aDDRaceMsgSent[1] = false;
|
||||
m_aShowOthers[1] = SHOW_OTHERS_NOT_SET;
|
||||
m_aLastNewPredictedTick[1] = -1;
|
||||
m_PredictedDummyID = -1;
|
||||
}
|
||||
|
||||
|
@ -734,9 +734,9 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dumm
|
|||
|
||||
m_ServerMode = SERVERMODE_PURE;
|
||||
|
||||
m_ReceivedTuning[Conn] = true;
|
||||
m_aReceivedTuning[Conn] = true;
|
||||
// apply new tuning
|
||||
m_Tuning[Conn] = NewTuning;
|
||||
m_aTuning[Conn] = NewTuning;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -751,11 +751,11 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dumm
|
|||
|
||||
if(Dummy)
|
||||
{
|
||||
if(MsgId == NETMSGTYPE_SV_CHAT && m_LocalIDs[0] >= 0 && m_LocalIDs[1] >= 0)
|
||||
if(MsgId == NETMSGTYPE_SV_CHAT && m_aLocalIDs[0] >= 0 && m_aLocalIDs[1] >= 0)
|
||||
{
|
||||
CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg;
|
||||
|
||||
if((pMsg->m_Team == 1 && (m_aClients[m_LocalIDs[0]].m_Team != m_aClients[m_LocalIDs[1]].m_Team || m_Teams.Team(m_LocalIDs[0]) != m_Teams.Team(m_LocalIDs[1]))) || pMsg->m_Team > 1)
|
||||
if((pMsg->m_Team == 1 && (m_aClients[m_aLocalIDs[0]].m_Team != m_aClients[m_aLocalIDs[1]].m_Team || m_Teams.Team(m_aLocalIDs[0]) != m_Teams.Team(m_aLocalIDs[1]))) || pMsg->m_Team > 1)
|
||||
{
|
||||
m_Chat.OnMessage(MsgId, pRawMsg);
|
||||
}
|
||||
|
@ -931,39 +931,39 @@ void CGameClient::ProcessEvents()
|
|||
|
||||
if(Item.m_Type == NETEVENTTYPE_DAMAGEIND)
|
||||
{
|
||||
CNetEvent_DamageInd *ev = (CNetEvent_DamageInd *)pData;
|
||||
m_Effects.DamageIndicator(vec2(ev->m_X, ev->m_Y), direction(ev->m_Angle / 256.0f));
|
||||
CNetEvent_DamageInd *pEvent = (CNetEvent_DamageInd *)pData;
|
||||
m_Effects.DamageIndicator(vec2(pEvent->m_X, pEvent->m_Y), direction(pEvent->m_Angle / 256.0f));
|
||||
}
|
||||
else if(Item.m_Type == NETEVENTTYPE_EXPLOSION)
|
||||
{
|
||||
CNetEvent_Explosion *ev = (CNetEvent_Explosion *)pData;
|
||||
m_Effects.Explosion(vec2(ev->m_X, ev->m_Y));
|
||||
CNetEvent_Explosion *pEvent = (CNetEvent_Explosion *)pData;
|
||||
m_Effects.Explosion(vec2(pEvent->m_X, pEvent->m_Y));
|
||||
}
|
||||
else if(Item.m_Type == NETEVENTTYPE_HAMMERHIT)
|
||||
{
|
||||
CNetEvent_HammerHit *ev = (CNetEvent_HammerHit *)pData;
|
||||
m_Effects.HammerHit(vec2(ev->m_X, ev->m_Y));
|
||||
CNetEvent_HammerHit *pEvent = (CNetEvent_HammerHit *)pData;
|
||||
m_Effects.HammerHit(vec2(pEvent->m_X, pEvent->m_Y));
|
||||
}
|
||||
else if(Item.m_Type == NETEVENTTYPE_SPAWN)
|
||||
{
|
||||
CNetEvent_Spawn *ev = (CNetEvent_Spawn *)pData;
|
||||
m_Effects.PlayerSpawn(vec2(ev->m_X, ev->m_Y));
|
||||
CNetEvent_Spawn *pEvent = (CNetEvent_Spawn *)pData;
|
||||
m_Effects.PlayerSpawn(vec2(pEvent->m_X, pEvent->m_Y));
|
||||
}
|
||||
else if(Item.m_Type == NETEVENTTYPE_DEATH)
|
||||
{
|
||||
CNetEvent_Death *ev = (CNetEvent_Death *)pData;
|
||||
m_Effects.PlayerDeath(vec2(ev->m_X, ev->m_Y), ev->m_ClientID);
|
||||
CNetEvent_Death *pEvent = (CNetEvent_Death *)pData;
|
||||
m_Effects.PlayerDeath(vec2(pEvent->m_X, pEvent->m_Y), pEvent->m_ClientID);
|
||||
}
|
||||
else if(Item.m_Type == NETEVENTTYPE_SOUNDWORLD)
|
||||
{
|
||||
CNetEvent_SoundWorld *ev = (CNetEvent_SoundWorld *)pData;
|
||||
CNetEvent_SoundWorld *pEvent = (CNetEvent_SoundWorld *)pData;
|
||||
if(!Config()->m_SndGame)
|
||||
continue;
|
||||
|
||||
if(m_GameInfo.m_RaceSounds && ((ev->m_SoundID == SOUND_GUN_FIRE && !g_Config.m_SndGun) || (ev->m_SoundID == SOUND_PLAYER_PAIN_LONG && !g_Config.m_SndLongPain)))
|
||||
if(m_GameInfo.m_RaceSounds && ((pEvent->m_SoundID == SOUND_GUN_FIRE && !g_Config.m_SndGun) || (pEvent->m_SoundID == SOUND_PLAYER_PAIN_LONG && !g_Config.m_SndLongPain)))
|
||||
continue;
|
||||
|
||||
m_Sounds.PlayAt(CSounds::CHN_WORLD, ev->m_SoundID, 1.0f, vec2(ev->m_X, ev->m_Y));
|
||||
m_Sounds.PlayAt(CSounds::CHN_WORLD, pEvent->m_SoundID, 1.0f, vec2(pEvent->m_X, pEvent->m_Y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1175,7 +1175,7 @@ void CGameClient::OnNewSnapshot()
|
|||
|
||||
bool FoundGameInfoEx = false;
|
||||
bool GotSwitchStateTeam = false;
|
||||
m_SwitchStateTeam[g_Config.m_ClDummy] = -1;
|
||||
m_aSwitchStateTeam[g_Config.m_ClDummy] = -1;
|
||||
|
||||
for(auto &Client : m_aClients)
|
||||
{
|
||||
|
@ -1242,7 +1242,7 @@ void CGameClient::OnNewSnapshot()
|
|||
{
|
||||
m_aClients[pInfo->m_ClientID].m_Team = pInfo->m_Team;
|
||||
m_aClients[pInfo->m_ClientID].m_Active = true;
|
||||
m_Snap.m_paPlayerInfos[pInfo->m_ClientID] = pInfo;
|
||||
m_Snap.m_apPlayerInfos[pInfo->m_ClientID] = pInfo;
|
||||
m_Snap.m_NumPlayers++;
|
||||
|
||||
if(pInfo->m_Local)
|
||||
|
@ -1423,18 +1423,18 @@ void CGameClient::OnNewSnapshot()
|
|||
m_Snap.m_GameDataSnapID = Item.m_ID;
|
||||
if(m_Snap.m_pGameDataObj->m_FlagCarrierRed == FLAG_TAKEN)
|
||||
{
|
||||
if(m_FlagDropTick[TEAM_RED] == 0)
|
||||
m_FlagDropTick[TEAM_RED] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
if(m_aFlagDropTick[TEAM_RED] == 0)
|
||||
m_aFlagDropTick[TEAM_RED] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
else if(m_FlagDropTick[TEAM_RED] != 0)
|
||||
m_FlagDropTick[TEAM_RED] = 0;
|
||||
else if(m_aFlagDropTick[TEAM_RED] != 0)
|
||||
m_aFlagDropTick[TEAM_RED] = 0;
|
||||
if(m_Snap.m_pGameDataObj->m_FlagCarrierBlue == FLAG_TAKEN)
|
||||
{
|
||||
if(m_FlagDropTick[TEAM_BLUE] == 0)
|
||||
m_FlagDropTick[TEAM_BLUE] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
if(m_aFlagDropTick[TEAM_BLUE] == 0)
|
||||
m_aFlagDropTick[TEAM_BLUE] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
else if(m_FlagDropTick[TEAM_BLUE] != 0)
|
||||
m_FlagDropTick[TEAM_BLUE] = 0;
|
||||
else if(m_aFlagDropTick[TEAM_BLUE] != 0)
|
||||
m_aFlagDropTick[TEAM_BLUE] = 0;
|
||||
if(m_LastFlagCarrierRed == FLAG_ATSTAND && m_Snap.m_pGameDataObj->m_FlagCarrierRed >= 0)
|
||||
OnFlagGrab(TEAM_RED);
|
||||
else if(m_LastFlagCarrierBlue == FLAG_ATSTAND && m_Snap.m_pGameDataObj->m_FlagCarrierBlue >= 0)
|
||||
|
@ -1444,7 +1444,7 @@ void CGameClient::OnNewSnapshot()
|
|||
m_LastFlagCarrierBlue = m_Snap.m_pGameDataObj->m_FlagCarrierBlue;
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_FLAG)
|
||||
m_Snap.m_paFlags[Item.m_ID % 2] = (const CNetObj_Flag *)pData;
|
||||
m_Snap.m_apFlags[Item.m_ID % 2] = (const CNetObj_Flag *)pData;
|
||||
else if(Item.m_Type == NETOBJTYPE_SWITCHSTATE)
|
||||
{
|
||||
if(Item.m_DataSize < 36)
|
||||
|
@ -1463,7 +1463,7 @@ void CGameClient::OnNewSnapshot()
|
|||
|
||||
for(int j = 0; j < (int)Switchers().size(); j++)
|
||||
{
|
||||
Switchers()[j].m_Status[Team] = (pSwitchStateData->m_aStatus[j / 32] >> (j % 32)) & 1;
|
||||
Switchers()[j].m_aStatus[Team] = (pSwitchStateData->m_aStatus[j / 32] >> (j % 32)) & 1;
|
||||
}
|
||||
|
||||
if(Item.m_DataSize >= 68)
|
||||
|
@ -1475,7 +1475,7 @@ void CGameClient::OnNewSnapshot()
|
|||
int EndTick = pSwitchStateData->m_aEndTicks[j];
|
||||
if(EndTick > 0 && in_range(SwitchNumber, 0, (int)Switchers().size()))
|
||||
{
|
||||
Switchers()[SwitchNumber].m_EndTick[Team] = EndTick;
|
||||
Switchers()[SwitchNumber].m_aEndTick[Team] = EndTick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1483,16 +1483,16 @@ void CGameClient::OnNewSnapshot()
|
|||
// update switch types
|
||||
for(auto &Switcher : Switchers())
|
||||
{
|
||||
if(Switcher.m_Status[Team])
|
||||
Switcher.m_Type[Team] = Switcher.m_EndTick[Team] ? TILE_SWITCHTIMEDOPEN : TILE_SWITCHOPEN;
|
||||
if(Switcher.m_aStatus[Team])
|
||||
Switcher.m_aType[Team] = Switcher.m_aEndTick[Team] ? TILE_SWITCHTIMEDOPEN : TILE_SWITCHOPEN;
|
||||
else
|
||||
Switcher.m_Type[Team] = Switcher.m_EndTick[Team] ? TILE_SWITCHTIMEDCLOSE : TILE_SWITCHCLOSE;
|
||||
Switcher.m_aType[Team] = Switcher.m_aEndTick[Team] ? TILE_SWITCHTIMEDCLOSE : TILE_SWITCHCLOSE;
|
||||
}
|
||||
|
||||
if(!GotSwitchStateTeam)
|
||||
m_SwitchStateTeam[g_Config.m_ClDummy] = Team;
|
||||
m_aSwitchStateTeam[g_Config.m_ClDummy] = Team;
|
||||
else
|
||||
m_SwitchStateTeam[g_Config.m_ClDummy] = -1;
|
||||
m_aSwitchStateTeam[g_Config.m_ClDummy] = -1;
|
||||
GotSwitchStateTeam = true;
|
||||
}
|
||||
}
|
||||
|
@ -1508,15 +1508,15 @@ void CGameClient::OnNewSnapshot()
|
|||
// setup local pointers
|
||||
if(m_Snap.m_LocalClientID >= 0)
|
||||
{
|
||||
m_LocalIDs[g_Config.m_ClDummy] = m_Snap.m_LocalClientID;
|
||||
m_aLocalIDs[g_Config.m_ClDummy] = m_Snap.m_LocalClientID;
|
||||
|
||||
CSnapState::CCharacterInfo *c = &m_Snap.m_aCharacters[m_Snap.m_LocalClientID];
|
||||
if(c->m_Active)
|
||||
CSnapState::CCharacterInfo *pChr = &m_Snap.m_aCharacters[m_Snap.m_LocalClientID];
|
||||
if(pChr->m_Active)
|
||||
{
|
||||
if(!m_Snap.m_SpecInfo.m_Active)
|
||||
{
|
||||
m_Snap.m_pLocalCharacter = &c->m_Cur;
|
||||
m_Snap.m_pLocalPrevCharacter = &c->m_Prev;
|
||||
m_Snap.m_pLocalCharacter = &pChr->m_Cur;
|
||||
m_Snap.m_pLocalPrevCharacter = &pChr->m_Prev;
|
||||
m_LocalCharacterPos = vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y);
|
||||
}
|
||||
}
|
||||
|
@ -1542,7 +1542,7 @@ void CGameClient::OnNewSnapshot()
|
|||
// clear out unneeded client data
|
||||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(!m_Snap.m_paPlayerInfos[i] && m_aClients[i].m_Active)
|
||||
if(!m_Snap.m_apPlayerInfos[i] && m_aClients[i].m_Active)
|
||||
{
|
||||
m_aClients[i].Reset();
|
||||
m_aStats[i].Reset();
|
||||
|
@ -1552,15 +1552,15 @@ void CGameClient::OnNewSnapshot()
|
|||
for(int i = 0; i < MAX_CLIENTS; ++i)
|
||||
{
|
||||
// update friend state
|
||||
m_aClients[i].m_Friend = !(i == m_Snap.m_LocalClientID || !m_Snap.m_paPlayerInfos[i] || !Friends()->IsFriend(m_aClients[i].m_aName, m_aClients[i].m_aClan, true));
|
||||
m_aClients[i].m_Friend = !(i == m_Snap.m_LocalClientID || !m_Snap.m_apPlayerInfos[i] || !Friends()->IsFriend(m_aClients[i].m_aName, m_aClients[i].m_aClan, true));
|
||||
|
||||
// update foe state
|
||||
m_aClients[i].m_Foe = !(i == m_Snap.m_LocalClientID || !m_Snap.m_paPlayerInfos[i] || !Foes()->IsFriend(m_aClients[i].m_aName, m_aClients[i].m_aClan, true));
|
||||
m_aClients[i].m_Foe = !(i == m_Snap.m_LocalClientID || !m_Snap.m_apPlayerInfos[i] || !Foes()->IsFriend(m_aClients[i].m_aName, m_aClients[i].m_aClan, true));
|
||||
}
|
||||
|
||||
// sort player infos by name
|
||||
mem_copy(m_Snap.m_paInfoByName, m_Snap.m_paPlayerInfos, sizeof(m_Snap.m_paInfoByName));
|
||||
std::stable_sort(m_Snap.m_paInfoByName, m_Snap.m_paInfoByName + MAX_CLIENTS,
|
||||
mem_copy(m_Snap.m_apInfoByName, m_Snap.m_apPlayerInfos, sizeof(m_Snap.m_apInfoByName));
|
||||
std::stable_sort(m_Snap.m_apInfoByName, m_Snap.m_apInfoByName + MAX_CLIENTS,
|
||||
[this](const CNetObj_PlayerInfo *p1, const CNetObj_PlayerInfo *p2) -> bool {
|
||||
if(!p2)
|
||||
return static_cast<bool>(p1);
|
||||
|
@ -1572,8 +1572,8 @@ void CGameClient::OnNewSnapshot()
|
|||
bool TimeScore = m_GameInfo.m_TimeScore;
|
||||
|
||||
// sort player infos by score
|
||||
mem_copy(m_Snap.m_paInfoByScore, m_Snap.m_paInfoByName, sizeof(m_Snap.m_paInfoByScore));
|
||||
std::stable_sort(m_Snap.m_paInfoByScore, m_Snap.m_paInfoByScore + MAX_CLIENTS,
|
||||
mem_copy(m_Snap.m_apInfoByScore, m_Snap.m_apInfoByName, sizeof(m_Snap.m_apInfoByScore));
|
||||
std::stable_sort(m_Snap.m_apInfoByScore, m_Snap.m_apInfoByScore + MAX_CLIENTS,
|
||||
[TimeScore](const CNetObj_PlayerInfo *p1, const CNetObj_PlayerInfo *p2) -> bool {
|
||||
if(!p2)
|
||||
return static_cast<bool>(p1);
|
||||
|
@ -1589,8 +1589,8 @@ void CGameClient::OnNewSnapshot()
|
|||
{
|
||||
for(int i = 0; i < MAX_CLIENTS && Index < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(m_Snap.m_paInfoByScore[i] && m_Teams.Team(m_Snap.m_paInfoByScore[i]->m_ClientID) == Team)
|
||||
m_Snap.m_paInfoByDDTeamScore[Index++] = m_Snap.m_paInfoByScore[i];
|
||||
if(m_Snap.m_apInfoByScore[i] && m_Teams.Team(m_Snap.m_apInfoByScore[i]->m_ClientID) == Team)
|
||||
m_Snap.m_apInfoByDDTeamScore[Index++] = m_Snap.m_apInfoByScore[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1600,8 +1600,8 @@ void CGameClient::OnNewSnapshot()
|
|||
{
|
||||
for(int i = 0; i < MAX_CLIENTS && Index < MAX_CLIENTS; ++i)
|
||||
{
|
||||
if(m_Snap.m_paInfoByName[i] && m_Teams.Team(m_Snap.m_paInfoByName[i]->m_ClientID) == Team)
|
||||
m_Snap.m_paInfoByDDTeamName[Index++] = m_Snap.m_paInfoByName[i];
|
||||
if(m_Snap.m_apInfoByName[i] && m_Teams.Team(m_Snap.m_apInfoByName[i]->m_ClientID) == Team)
|
||||
m_Snap.m_apInfoByDDTeamName[Index++] = m_Snap.m_apInfoByName[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1612,7 +1612,7 @@ void CGameClient::OnNewSnapshot()
|
|||
{
|
||||
if(str_comp(CurrentServerInfo.m_aGameType, "DM") != 0 && str_comp(CurrentServerInfo.m_aGameType, "TDM") != 0 && str_comp(CurrentServerInfo.m_aGameType, "CTF") != 0)
|
||||
m_ServerMode = SERVERMODE_MOD;
|
||||
else if(mem_comp(&StandardTuning, &m_Tuning[g_Config.m_ClDummy], 33) == 0)
|
||||
else if(mem_comp(&StandardTuning, &m_aTuning[g_Config.m_ClDummy], 33) == 0)
|
||||
m_ServerMode = SERVERMODE_PURE;
|
||||
else
|
||||
m_ServerMode = SERVERMODE_PUREMOD;
|
||||
|
@ -1626,18 +1626,18 @@ void CGameClient::OnNewSnapshot()
|
|||
AnyRecording = true;
|
||||
break;
|
||||
}
|
||||
if(AnyRecording && mem_comp(&StandardTuning, &m_Tuning[g_Config.m_ClDummy], sizeof(CTuningParams)) != 0)
|
||||
if(AnyRecording && mem_comp(&StandardTuning, &m_aTuning[g_Config.m_ClDummy], sizeof(CTuningParams)) != 0)
|
||||
{
|
||||
CMsgPacker Msg(NETMSGTYPE_SV_TUNEPARAMS);
|
||||
int *pParams = (int *)&m_Tuning[g_Config.m_ClDummy];
|
||||
for(unsigned i = 0; i < sizeof(m_Tuning[0]) / sizeof(int); i++)
|
||||
int *pParams = (int *)&m_aTuning[g_Config.m_ClDummy];
|
||||
for(unsigned i = 0; i < sizeof(m_aTuning[0]) / sizeof(int); i++)
|
||||
Msg.AddInt(pParams[i]);
|
||||
Client()->SendMsgActive(&Msg, MSGFLAG_RECORD | MSGFLAG_NOSEND);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
if(m_DDRaceMsgSent[i] || !m_Snap.m_pLocalInfo)
|
||||
if(m_aDDRaceMsgSent[i] || !m_Snap.m_pLocalInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1648,10 +1648,10 @@ void CGameClient::OnNewSnapshot()
|
|||
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNETLEGACY, false);
|
||||
Msg.AddInt(CLIENT_VERSIONNR);
|
||||
Client()->SendMsg(i, &Msg, MSGFLAG_VITAL);
|
||||
m_DDRaceMsgSent[i] = true;
|
||||
m_aDDRaceMsgSent[i] = true;
|
||||
}
|
||||
|
||||
if(m_ShowOthers[g_Config.m_ClDummy] == SHOW_OTHERS_NOT_SET || (m_ShowOthers[g_Config.m_ClDummy] != SHOW_OTHERS_NOT_SET && m_ShowOthers[g_Config.m_ClDummy] != g_Config.m_ClShowOthers))
|
||||
if(m_aShowOthers[g_Config.m_ClDummy] == SHOW_OTHERS_NOT_SET || (m_aShowOthers[g_Config.m_ClDummy] != SHOW_OTHERS_NOT_SET && m_aShowOthers[g_Config.m_ClDummy] != g_Config.m_ClShowOthers))
|
||||
{
|
||||
{
|
||||
CNetMsg_Cl_ShowOthers Msg;
|
||||
|
@ -1660,7 +1660,7 @@ void CGameClient::OnNewSnapshot()
|
|||
}
|
||||
|
||||
// update state
|
||||
m_ShowOthers[g_Config.m_ClDummy] = g_Config.m_ClShowOthers;
|
||||
m_aShowOthers[g_Config.m_ClDummy] = g_Config.m_ClShowOthers;
|
||||
}
|
||||
|
||||
float ZoomToSend = m_Camera.m_Zoom;
|
||||
|
@ -1822,14 +1822,14 @@ void CGameClient::OnPredict()
|
|||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
if(CCharacter *pChar = m_PredictedWorld.GetCharacterByID(i))
|
||||
{
|
||||
m_aClients[i].m_PredPos[Tick % 200] = pChar->Core()->m_Pos;
|
||||
m_aClients[i].m_PredTick[Tick % 200] = Tick;
|
||||
m_aClients[i].m_aPredPos[Tick % 200] = pChar->Core()->m_Pos;
|
||||
m_aClients[i].m_aPredTick[Tick % 200] = Tick;
|
||||
}
|
||||
|
||||
// check if we want to trigger effects
|
||||
if(Tick > m_LastNewPredictedTick[Dummy])
|
||||
if(Tick > m_aLastNewPredictedTick[Dummy])
|
||||
{
|
||||
m_LastNewPredictedTick[Dummy] = Tick;
|
||||
m_aLastNewPredictedTick[Dummy] = Tick;
|
||||
m_NewPredictedTick = true;
|
||||
vec2 Pos = pLocalChar->Core()->m_Pos;
|
||||
int Events = pLocalChar->Core()->m_TriggeredEvents;
|
||||
|
@ -1848,9 +1848,9 @@ void CGameClient::OnPredict()
|
|||
}
|
||||
|
||||
// check if we want to trigger predicted airjump for dummy
|
||||
if(AntiPingPlayers() && pDummyChar && Tick > m_LastNewPredictedTick[!Dummy])
|
||||
if(AntiPingPlayers() && pDummyChar && Tick > m_aLastNewPredictedTick[!Dummy])
|
||||
{
|
||||
m_LastNewPredictedTick[!Dummy] = Tick;
|
||||
m_aLastNewPredictedTick[!Dummy] = Tick;
|
||||
vec2 Pos = pDummyChar->Core()->m_Pos;
|
||||
int Events = pDummyChar->Core()->m_TriggeredEvents;
|
||||
if(g_Config.m_ClPredict)
|
||||
|
@ -1885,34 +1885,34 @@ void CGameClient::OnPredict()
|
|||
vec2 RenderDiff = PredPos - aBeforeRender[i];
|
||||
vec2 PredDiff = PredPos - CurPos;
|
||||
|
||||
float MixAmount[2];
|
||||
float aMixAmount[2];
|
||||
for(int j = 0; j < 2; j++)
|
||||
{
|
||||
MixAmount[j] = 1.0f;
|
||||
aMixAmount[j] = 1.0f;
|
||||
if(fabs(PredErr[j]) > 0.05f)
|
||||
{
|
||||
MixAmount[j] = 0.0f;
|
||||
aMixAmount[j] = 0.0f;
|
||||
if(fabs(RenderDiff[j]) > 0.01f)
|
||||
{
|
||||
MixAmount[j] = 1.f - clamp(RenderDiff[j] / PredDiff[j], 0.f, 1.f);
|
||||
MixAmount[j] = 1.f - powf(1.f - MixAmount[j], 1 / 1.2f);
|
||||
aMixAmount[j] = 1.f - clamp(RenderDiff[j] / PredDiff[j], 0.f, 1.f);
|
||||
aMixAmount[j] = 1.f - powf(1.f - aMixAmount[j], 1 / 1.2f);
|
||||
}
|
||||
}
|
||||
int64_t TimePassed = time_get() - m_aClients[i].m_SmoothStart[j];
|
||||
int64_t TimePassed = time_get() - m_aClients[i].m_aSmoothStart[j];
|
||||
if(in_range(TimePassed, (int64_t)0, Len - 1))
|
||||
MixAmount[j] = minimum(MixAmount[j], (float)(TimePassed / (double)Len));
|
||||
aMixAmount[j] = minimum(aMixAmount[j], (float)(TimePassed / (double)Len));
|
||||
}
|
||||
for(int j = 0; j < 2; j++)
|
||||
if(fabs(RenderDiff[j]) < 0.01f && fabs(PredDiff[j]) < 0.01f && fabs(m_aClients[i].m_PrevPredicted.m_Pos[j] - m_aClients[i].m_Predicted.m_Pos[j]) < 0.01f && MixAmount[j] > MixAmount[j ^ 1])
|
||||
MixAmount[j] = MixAmount[j ^ 1];
|
||||
if(fabs(RenderDiff[j]) < 0.01f && fabs(PredDiff[j]) < 0.01f && fabs(m_aClients[i].m_PrevPredicted.m_Pos[j] - m_aClients[i].m_Predicted.m_Pos[j]) < 0.01f && aMixAmount[j] > aMixAmount[j ^ 1])
|
||||
aMixAmount[j] = aMixAmount[j ^ 1];
|
||||
for(int j = 0; j < 2; j++)
|
||||
{
|
||||
int64_t Remaining = minimum((1.f - MixAmount[j]) * Len, minimum(time_freq() * 0.700f, (1.f - MixAmount[j ^ 1]) * Len + time_freq() * 0.300f)); // don't smooth for longer than 700ms, or more than 300ms longer along one axis than the other axis
|
||||
int64_t Remaining = minimum((1.f - aMixAmount[j]) * Len, minimum(time_freq() * 0.700f, (1.f - aMixAmount[j ^ 1]) * Len + time_freq() * 0.300f)); // don't smooth for longer than 700ms, or more than 300ms longer along one axis than the other axis
|
||||
int64_t Start = time_get() - (Len - Remaining);
|
||||
if(!in_range(Start + Len, m_aClients[i].m_SmoothStart[j], m_aClients[i].m_SmoothStart[j] + Len))
|
||||
if(!in_range(Start + Len, m_aClients[i].m_aSmoothStart[j], m_aClients[i].m_aSmoothStart[j] + Len))
|
||||
{
|
||||
m_aClients[i].m_SmoothStart[j] = Start;
|
||||
m_aClients[i].m_SmoothLen[j] = Len;
|
||||
m_aClients[i].m_aSmoothStart[j] = Start;
|
||||
m_aClients[i].m_aSmoothLen[j] = Len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1994,11 +1994,11 @@ void CGameClient::CClientData::UpdateRenderInfo(bool IsTeamPlay)
|
|||
if(IsTeamPlay)
|
||||
{
|
||||
m_RenderInfo.m_CustomColoredSkin = true;
|
||||
const int TeamColors[2] = {65461, 10223541};
|
||||
const int aTeamColors[2] = {65461, 10223541};
|
||||
if(m_Team >= TEAM_RED && m_Team <= TEAM_BLUE)
|
||||
{
|
||||
m_RenderInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSLA(TeamColors[m_Team]));
|
||||
m_RenderInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSLA(TeamColors[m_Team]));
|
||||
m_RenderInfo.m_ColorBody = color_cast<ColorRGBA>(ColorHSLA(aTeamColors[m_Team]));
|
||||
m_RenderInfo.m_ColorFeet = color_cast<ColorRGBA>(ColorHSLA(aTeamColors[m_Team]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2058,7 +2058,7 @@ void CGameClient::CClientData::Reset()
|
|||
m_SpecChar = vec2(0, 0);
|
||||
m_SpecCharPresent = false;
|
||||
|
||||
mem_zero(m_SwitchStates, sizeof(m_SwitchStates));
|
||||
mem_zero(m_aSwitchStates, sizeof(m_aSwitchStates));
|
||||
|
||||
UpdateRenderInfo(false);
|
||||
}
|
||||
|
@ -2088,7 +2088,7 @@ void CGameClient::SendInfo(bool Start)
|
|||
CMsgPacker Packer(Msg.MsgID(), false);
|
||||
Msg.Pack(&Packer);
|
||||
Client()->SendMsg(IClient::CONN_MAIN, &Packer, MSGFLAG_VITAL);
|
||||
m_CheckInfo[0] = -1;
|
||||
m_aCheckInfo[0] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2103,7 +2103,7 @@ void CGameClient::SendInfo(bool Start)
|
|||
CMsgPacker Packer(Msg.MsgID(), false);
|
||||
Msg.Pack(&Packer);
|
||||
Client()->SendMsg(IClient::CONN_MAIN, &Packer, MSGFLAG_VITAL);
|
||||
m_CheckInfo[0] = Client()->GameTickSpeed();
|
||||
m_aCheckInfo[0] = Client()->GameTickSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2122,7 +2122,7 @@ void CGameClient::SendDummyInfo(bool Start)
|
|||
CMsgPacker Packer(Msg.MsgID(), false);
|
||||
Msg.Pack(&Packer);
|
||||
Client()->SendMsg(IClient::CONN_DUMMY, &Packer, MSGFLAG_VITAL);
|
||||
m_CheckInfo[1] = -1;
|
||||
m_aCheckInfo[1] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2137,7 +2137,7 @@ void CGameClient::SendDummyInfo(bool Start)
|
|||
CMsgPacker Packer(Msg.MsgID(), false);
|
||||
Msg.Pack(&Packer);
|
||||
Client()->SendMsg(IClient::CONN_DUMMY, &Packer, MSGFLAG_VITAL);
|
||||
m_CheckInfo[1] = Client()->GameTickSpeed();
|
||||
m_aCheckInfo[1] = Client()->GameTickSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2266,7 +2266,7 @@ void CGameClient::UpdatePrediction()
|
|||
|
||||
// always update default tune zone, even without character
|
||||
if(!m_GameWorld.m_WorldConfig.m_UseTuneZones)
|
||||
m_GameWorld.TuningList()[0] = m_Tuning[g_Config.m_ClDummy];
|
||||
m_GameWorld.TuningList()[0] = m_aTuning[g_Config.m_ClDummy];
|
||||
|
||||
if(!m_Snap.m_pLocalCharacter)
|
||||
{
|
||||
|
@ -2277,67 +2277,67 @@ void CGameClient::UpdatePrediction()
|
|||
|
||||
if(m_Snap.m_pLocalCharacter->m_AmmoCount > 0 && m_Snap.m_pLocalCharacter->m_Weapon != WEAPON_NINJA)
|
||||
m_GameWorld.m_WorldConfig.m_InfiniteAmmo = false;
|
||||
m_GameWorld.m_WorldConfig.m_IsSolo = !m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData && !m_Tuning[g_Config.m_ClDummy].m_PlayerCollision && !m_Tuning[g_Config.m_ClDummy].m_PlayerHooking;
|
||||
m_GameWorld.m_WorldConfig.m_IsSolo = !m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData && !m_aTuning[g_Config.m_ClDummy].m_PlayerCollision && !m_aTuning[g_Config.m_ClDummy].m_PlayerHooking;
|
||||
|
||||
// update the tuning/tunezone at the local character position with the latest tunings received before the new snapshot
|
||||
vec2 LocalCharPos = vec2(m_Snap.m_pLocalCharacter->m_X, m_Snap.m_pLocalCharacter->m_Y);
|
||||
m_GameWorld.m_Core.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
|
||||
m_GameWorld.m_Core.m_aTuning[g_Config.m_ClDummy] = m_aTuning[g_Config.m_ClDummy];
|
||||
|
||||
int TuneZone = 0;
|
||||
if(m_GameWorld.m_WorldConfig.m_UseTuneZones)
|
||||
{
|
||||
TuneZone = Collision()->IsTune(Collision()->GetMapIndex(LocalCharPos));
|
||||
|
||||
if(TuneZone != m_LocalTuneZone[g_Config.m_ClDummy])
|
||||
if(TuneZone != m_aLocalTuneZone[g_Config.m_ClDummy])
|
||||
{
|
||||
// our tunezone changed, expecting tuning message
|
||||
m_LocalTuneZone[g_Config.m_ClDummy] = m_ExpectingTuningForZone[g_Config.m_ClDummy] = TuneZone;
|
||||
m_ExpectingTuningSince[g_Config.m_ClDummy] = 0;
|
||||
m_aLocalTuneZone[g_Config.m_ClDummy] = m_aExpectingTuningForZone[g_Config.m_ClDummy] = TuneZone;
|
||||
m_aExpectingTuningSince[g_Config.m_ClDummy] = 0;
|
||||
}
|
||||
|
||||
if(m_ExpectingTuningForZone[g_Config.m_ClDummy] >= 0)
|
||||
if(m_aExpectingTuningForZone[g_Config.m_ClDummy] >= 0)
|
||||
{
|
||||
if(m_ReceivedTuning[g_Config.m_ClDummy])
|
||||
if(m_aReceivedTuning[g_Config.m_ClDummy])
|
||||
{
|
||||
dbg_msg("tunezone", "got tuning for zone %d", m_ExpectingTuningForZone[g_Config.m_ClDummy]);
|
||||
m_GameWorld.TuningList()[m_ExpectingTuningForZone[g_Config.m_ClDummy]] = m_Tuning[g_Config.m_ClDummy];
|
||||
m_ReceivedTuning[g_Config.m_ClDummy] = false;
|
||||
m_ExpectingTuningForZone[g_Config.m_ClDummy] = -1;
|
||||
dbg_msg("tunezone", "got tuning for zone %d", m_aExpectingTuningForZone[g_Config.m_ClDummy]);
|
||||
m_GameWorld.TuningList()[m_aExpectingTuningForZone[g_Config.m_ClDummy]] = m_aTuning[g_Config.m_ClDummy];
|
||||
m_aReceivedTuning[g_Config.m_ClDummy] = false;
|
||||
m_aExpectingTuningForZone[g_Config.m_ClDummy] = -1;
|
||||
}
|
||||
else if(m_ExpectingTuningSince[g_Config.m_ClDummy] >= 5)
|
||||
else if(m_aExpectingTuningSince[g_Config.m_ClDummy] >= 5)
|
||||
{
|
||||
// if we are expecting tuning for more than 10 snaps (less than a quarter of a second)
|
||||
// it is probably dropped or it was received out of order
|
||||
// or applied to another tunezone.
|
||||
// we need to fallback to current tuning to fix ourselves.
|
||||
m_ExpectingTuningForZone[g_Config.m_ClDummy] = -1;
|
||||
m_ExpectingTuningSince[g_Config.m_ClDummy] = 0;
|
||||
m_ReceivedTuning[g_Config.m_ClDummy] = false;
|
||||
m_aExpectingTuningForZone[g_Config.m_ClDummy] = -1;
|
||||
m_aExpectingTuningSince[g_Config.m_ClDummy] = 0;
|
||||
m_aReceivedTuning[g_Config.m_ClDummy] = false;
|
||||
dbg_msg("tunezone", "the tuning was missed");
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we are expecting tuning and have not received one yet.
|
||||
// do not update any tuning, so we don't apply it to the wrong tunezone.
|
||||
dbg_msg("tunezone", "waiting for tuning for zone %d", m_ExpectingTuningForZone[g_Config.m_ClDummy]);
|
||||
m_ExpectingTuningSince[g_Config.m_ClDummy]++;
|
||||
dbg_msg("tunezone", "waiting for tuning for zone %d", m_aExpectingTuningForZone[g_Config.m_ClDummy]);
|
||||
m_aExpectingTuningSince[g_Config.m_ClDummy]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we have processed what we need, and the tuning is still wrong due to out of order messege
|
||||
// fix our tuning by using the current one
|
||||
m_GameWorld.TuningList()[TuneZone] = m_Tuning[g_Config.m_ClDummy];
|
||||
m_ExpectingTuningSince[g_Config.m_ClDummy] = 0;
|
||||
m_ReceivedTuning[g_Config.m_ClDummy] = false;
|
||||
m_GameWorld.TuningList()[TuneZone] = m_aTuning[g_Config.m_ClDummy];
|
||||
m_aExpectingTuningSince[g_Config.m_ClDummy] = 0;
|
||||
m_aReceivedTuning[g_Config.m_ClDummy] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// if ddnetcharacter is available, ignore server-wide tunings for hook and collision
|
||||
if(m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData)
|
||||
{
|
||||
m_GameWorld.m_Core.m_Tuning[g_Config.m_ClDummy].m_PlayerCollision = 1;
|
||||
m_GameWorld.m_Core.m_Tuning[g_Config.m_ClDummy].m_PlayerHooking = 1;
|
||||
m_GameWorld.m_Core.m_aTuning[g_Config.m_ClDummy].m_PlayerCollision = 1;
|
||||
m_GameWorld.m_Core.m_aTuning[g_Config.m_ClDummy].m_PlayerHooking = 1;
|
||||
}
|
||||
|
||||
CCharacter *pLocalChar = m_GameWorld.GetCharacterByID(m_Snap.m_LocalClientID);
|
||||
|
@ -2346,7 +2346,7 @@ void CGameClient::UpdatePrediction()
|
|||
pDummyChar = m_GameWorld.GetCharacterByID(m_PredictedDummyID);
|
||||
|
||||
// update strong and weak hook
|
||||
if(pLocalChar && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_Tuning[g_Config.m_ClDummy].m_PlayerCollision || m_Tuning[g_Config.m_ClDummy].m_PlayerHooking))
|
||||
if(pLocalChar && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_aTuning[g_Config.m_ClDummy].m_PlayerCollision || m_aTuning[g_Config.m_ClDummy].m_PlayerHooking))
|
||||
{
|
||||
if(m_Snap.m_aCharacters[m_Snap.m_LocalClientID].m_HasExtendedData)
|
||||
{
|
||||
|
@ -2398,8 +2398,8 @@ void CGameClient::UpdatePrediction()
|
|||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
|
||||
{
|
||||
m_aClients[i].m_PredPos[Tick % 200] = pChar->Core()->m_Pos;
|
||||
m_aClients[i].m_PredTick[Tick % 200] = Tick;
|
||||
m_aClients[i].m_aPredPos[Tick % 200] = pChar->Core()->m_Pos;
|
||||
m_aClients[i].m_aPredTick[Tick % 200] = Tick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2418,8 +2418,8 @@ void CGameClient::UpdatePrediction()
|
|||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
|
||||
{
|
||||
m_aClients[i].m_PredPos[Client()->GameTick(g_Config.m_ClDummy) % 200] = pChar->Core()->m_Pos;
|
||||
m_aClients[i].m_PredTick[Client()->GameTick(g_Config.m_ClDummy) % 200] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
m_aClients[i].m_aPredPos[Client()->GameTick(g_Config.m_ClDummy) % 200] = pChar->Core()->m_Pos;
|
||||
m_aClients[i].m_aPredTick[Client()->GameTick(g_Config.m_ClDummy) % 200] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
|
||||
// update the local gameworld with the new snapshot
|
||||
|
@ -2500,7 +2500,7 @@ void CGameClient::UpdateRenderedCharacters()
|
|||
|
||||
void CGameClient::DetectStrongHook()
|
||||
{
|
||||
static int s_LastUpdateTick[MAX_CLIENTS] = {0};
|
||||
static int s_aLastUpdateTick[MAX_CLIENTS] = {0};
|
||||
// attempt to detect strong/weak between players
|
||||
for(int FromPlayer = 0; FromPlayer < MAX_CLIENTS; FromPlayer++)
|
||||
{
|
||||
|
@ -2509,7 +2509,7 @@ void CGameClient::DetectStrongHook()
|
|||
int ToPlayer = m_Snap.m_aCharacters[FromPlayer].m_Prev.m_HookedPlayer;
|
||||
if(ToPlayer < 0 || ToPlayer >= MAX_CLIENTS || !m_Snap.m_aCharacters[ToPlayer].m_Active || ToPlayer != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_HookedPlayer)
|
||||
continue;
|
||||
if(abs(minimum(s_LastUpdateTick[ToPlayer], s_LastUpdateTick[FromPlayer]) - Client()->GameTick(g_Config.m_ClDummy)) < SERVER_TICK_SPEED / 4)
|
||||
if(abs(minimum(s_aLastUpdateTick[ToPlayer], s_aLastUpdateTick[FromPlayer]) - Client()->GameTick(g_Config.m_ClDummy)) < SERVER_TICK_SPEED / 4)
|
||||
continue;
|
||||
if(m_Snap.m_aCharacters[FromPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[FromPlayer].m_Cur.m_Direction || m_Snap.m_aCharacters[ToPlayer].m_Prev.m_Direction != m_Snap.m_aCharacters[ToPlayer].m_Cur.m_Direction)
|
||||
continue;
|
||||
|
@ -2519,14 +2519,14 @@ void CGameClient::DetectStrongHook()
|
|||
if(!pFromCharWorld || !pToCharWorld)
|
||||
continue;
|
||||
|
||||
s_LastUpdateTick[ToPlayer] = s_LastUpdateTick[FromPlayer] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
s_aLastUpdateTick[ToPlayer] = s_aLastUpdateTick[FromPlayer] = Client()->GameTick(g_Config.m_ClDummy);
|
||||
|
||||
float PredictErr[2];
|
||||
float aPredictErr[2];
|
||||
CCharacterCore ToCharCur;
|
||||
ToCharCur.Read(&m_Snap.m_aCharacters[ToPlayer].m_Cur);
|
||||
|
||||
CWorldCore World;
|
||||
World.m_Tuning[g_Config.m_ClDummy] = m_Tuning[g_Config.m_ClDummy];
|
||||
World.m_aTuning[g_Config.m_ClDummy] = m_aTuning[g_Config.m_ClDummy];
|
||||
|
||||
for(int dir = 0; dir < 2; dir++)
|
||||
{
|
||||
|
@ -2557,11 +2557,11 @@ void CGameClient::DetectStrongHook()
|
|||
ToChar.Move();
|
||||
ToChar.Quantize();
|
||||
}
|
||||
PredictErr[dir] = distance(ToChar.m_Vel, ToCharCur.m_Vel);
|
||||
aPredictErr[dir] = distance(ToChar.m_Vel, ToCharCur.m_Vel);
|
||||
}
|
||||
const float LOW = 0.0001f;
|
||||
const float HIGH = 0.07f;
|
||||
if(PredictErr[1] < LOW && PredictErr[0] > HIGH)
|
||||
if(aPredictErr[1] < LOW && aPredictErr[0] > HIGH)
|
||||
{
|
||||
if(m_CharOrder.HasStrongAgainst(ToPlayer, FromPlayer))
|
||||
{
|
||||
|
@ -2571,7 +2571,7 @@ void CGameClient::DetectStrongHook()
|
|||
m_CharOrder.GiveStrong(FromPlayer);
|
||||
}
|
||||
}
|
||||
else if(PredictErr[0] < LOW && PredictErr[1] > HIGH)
|
||||
else if(aPredictErr[0] < LOW && aPredictErr[1] > HIGH)
|
||||
{
|
||||
if(m_CharOrder.HasStrongAgainst(FromPlayer, ToPlayer))
|
||||
{
|
||||
|
@ -2590,16 +2590,16 @@ vec2 CGameClient::GetSmoothPos(int ClientID)
|
|||
int64_t Now = time_get();
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
int64_t Len = clamp(m_aClients[ClientID].m_SmoothLen[i], (int64_t)1, time_freq());
|
||||
int64_t TimePassed = Now - m_aClients[ClientID].m_SmoothStart[i];
|
||||
int64_t Len = clamp(m_aClients[ClientID].m_aSmoothLen[i], (int64_t)1, time_freq());
|
||||
int64_t TimePassed = Now - m_aClients[ClientID].m_aSmoothStart[i];
|
||||
if(in_range(TimePassed, (int64_t)0, Len - 1))
|
||||
{
|
||||
float MixAmount = 1.f - powf(1.f - TimePassed / (float)Len, 1.2f);
|
||||
int SmoothTick;
|
||||
float SmoothIntra;
|
||||
Client()->GetSmoothTick(&SmoothTick, &SmoothIntra, MixAmount);
|
||||
if(SmoothTick > 0 && m_aClients[ClientID].m_PredTick[(SmoothTick - 1) % 200] >= Client()->PrevGameTick(g_Config.m_ClDummy) && m_aClients[ClientID].m_PredTick[SmoothTick % 200] <= Client()->PredGameTick(g_Config.m_ClDummy))
|
||||
Pos[i] = mix(m_aClients[ClientID].m_PredPos[(SmoothTick - 1) % 200][i], m_aClients[ClientID].m_PredPos[SmoothTick % 200][i], SmoothIntra);
|
||||
if(SmoothTick > 0 && m_aClients[ClientID].m_aPredTick[(SmoothTick - 1) % 200] >= Client()->PrevGameTick(g_Config.m_ClDummy) && m_aClients[ClientID].m_aPredTick[SmoothTick % 200] <= Client()->PredGameTick(g_Config.m_ClDummy))
|
||||
Pos[i] = mix(m_aClients[ClientID].m_aPredPos[(SmoothTick - 1) % 200][i], m_aClients[ClientID].m_aPredPos[SmoothTick % 200][i], SmoothIntra);
|
||||
}
|
||||
}
|
||||
return Pos;
|
||||
|
@ -2635,8 +2635,8 @@ bool CGameClient::IsOtherTeam(int ClientID)
|
|||
|
||||
int CGameClient::SwitchStateTeam()
|
||||
{
|
||||
if(m_SwitchStateTeam[g_Config.m_ClDummy] >= 0)
|
||||
return m_SwitchStateTeam[g_Config.m_ClDummy];
|
||||
if(m_aSwitchStateTeam[g_Config.m_ClDummy] >= 0)
|
||||
return m_aSwitchStateTeam[g_Config.m_ClDummy];
|
||||
else if(m_Snap.m_LocalClientID < 0)
|
||||
return 0;
|
||||
else if(m_Snap.m_SpecInfo.m_Active && m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW)
|
||||
|
@ -2710,11 +2710,11 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
|
|||
|
||||
for(int i = 0; i < 3; ++i)
|
||||
{
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpriteWeaponGunMuzzles[i]);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpriteWeaponShotgunMuzzles[i]);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_SpriteWeaponNinjaMuzzles[i]);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_aSpriteWeaponGunMuzzles[i]);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_aSpriteWeaponShotgunMuzzles[i]);
|
||||
Graphics()->UnloadTexture(&m_GameSkin.m_aaSpriteWeaponNinjaMuzzles[i]);
|
||||
|
||||
for(auto &SpriteWeaponsMuzzle : m_GameSkin.m_SpriteWeaponsMuzzles)
|
||||
for(auto &SpriteWeaponsMuzzle : m_GameSkin.m_aaSpriteWeaponsMuzzles)
|
||||
{
|
||||
SpriteWeaponsMuzzle[i] = IGraphics::CTextureHandle();
|
||||
}
|
||||
|
@ -2852,13 +2852,13 @@ void CGameClient::LoadGameSkin(const char *pPath, bool AsDir)
|
|||
// muzzles
|
||||
for(int i = 0; i < 3; ++i)
|
||||
{
|
||||
m_GameSkin.m_SpriteWeaponGunMuzzles[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_WEAPON_GUN_MUZZLE1 + i]);
|
||||
m_GameSkin.m_SpriteWeaponShotgunMuzzles[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_WEAPON_SHOTGUN_MUZZLE1 + i]);
|
||||
m_GameSkin.m_SpriteWeaponNinjaMuzzles[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_WEAPON_NINJA_MUZZLE1 + i]);
|
||||
m_GameSkin.m_aSpriteWeaponGunMuzzles[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_WEAPON_GUN_MUZZLE1 + i]);
|
||||
m_GameSkin.m_aSpriteWeaponShotgunMuzzles[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_WEAPON_SHOTGUN_MUZZLE1 + i]);
|
||||
m_GameSkin.m_aaSpriteWeaponNinjaMuzzles[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_WEAPON_NINJA_MUZZLE1 + i]);
|
||||
|
||||
m_GameSkin.m_SpriteWeaponsMuzzles[1][i] = m_GameSkin.m_SpriteWeaponGunMuzzles[i];
|
||||
m_GameSkin.m_SpriteWeaponsMuzzles[2][i] = m_GameSkin.m_SpriteWeaponShotgunMuzzles[i];
|
||||
m_GameSkin.m_SpriteWeaponsMuzzles[5][i] = m_GameSkin.m_SpriteWeaponNinjaMuzzles[i];
|
||||
m_GameSkin.m_aaSpriteWeaponsMuzzles[1][i] = m_GameSkin.m_aSpriteWeaponGunMuzzles[i];
|
||||
m_GameSkin.m_aaSpriteWeaponsMuzzles[2][i] = m_GameSkin.m_aSpriteWeaponShotgunMuzzles[i];
|
||||
m_GameSkin.m_aaSpriteWeaponsMuzzles[5][i] = m_GameSkin.m_aaSpriteWeaponNinjaMuzzles[i];
|
||||
}
|
||||
|
||||
// pickups
|
||||
|
@ -3266,10 +3266,10 @@ void CGameClient::DummyResetInput()
|
|||
m_DummyInput.m_Fire++;
|
||||
|
||||
m_Controls.ResetInput(!g_Config.m_ClDummy);
|
||||
m_Controls.m_InputData[!g_Config.m_ClDummy].m_Hook = 0;
|
||||
m_Controls.m_InputData[!g_Config.m_ClDummy].m_Fire = m_DummyInput.m_Fire;
|
||||
m_Controls.m_aInputData[!g_Config.m_ClDummy].m_Hook = 0;
|
||||
m_Controls.m_aInputData[!g_Config.m_ClDummy].m_Fire = m_DummyInput.m_Fire;
|
||||
|
||||
m_DummyInput = m_Controls.m_InputData[!g_Config.m_ClDummy];
|
||||
m_DummyInput = m_Controls.m_aInputData[!g_Config.m_ClDummy];
|
||||
}
|
||||
|
||||
bool CGameClient::CanDisplayWarning()
|
||||
|
|
|
@ -181,14 +181,14 @@ private:
|
|||
void UpdatePositions();
|
||||
|
||||
int m_PredictedTick;
|
||||
int m_LastNewPredictedTick[NUM_DUMMIES];
|
||||
int m_aLastNewPredictedTick[NUM_DUMMIES];
|
||||
|
||||
int m_LastRoundStartTick;
|
||||
|
||||
int m_LastFlagCarrierRed;
|
||||
int m_LastFlagCarrierBlue;
|
||||
|
||||
int m_CheckInfo[NUM_DUMMIES];
|
||||
int m_aCheckInfo[NUM_DUMMIES];
|
||||
|
||||
char m_aDDNetVersionStr[64];
|
||||
|
||||
|
@ -241,10 +241,10 @@ public:
|
|||
bool m_SuppressEvents;
|
||||
bool m_NewTick;
|
||||
bool m_NewPredictedTick;
|
||||
int m_FlagDropTick[2];
|
||||
int m_aFlagDropTick[2];
|
||||
|
||||
// TODO: move this
|
||||
CTuningParams m_Tuning[NUM_DUMMIES];
|
||||
CTuningParams m_aTuning[NUM_DUMMIES];
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -271,16 +271,16 @@ public:
|
|||
const CNetObj_PlayerInfo *m_pLocalInfo;
|
||||
const CNetObj_SpectatorInfo *m_pSpectatorInfo;
|
||||
const CNetObj_SpectatorInfo *m_pPrevSpectatorInfo;
|
||||
const CNetObj_Flag *m_paFlags[2];
|
||||
const CNetObj_Flag *m_apFlags[2];
|
||||
const CNetObj_GameInfo *m_pGameInfoObj;
|
||||
const CNetObj_GameData *m_pGameDataObj;
|
||||
int m_GameDataSnapID;
|
||||
|
||||
const CNetObj_PlayerInfo *m_paPlayerInfos[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_paInfoByScore[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_paInfoByName[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_paInfoByDDTeamScore[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_paInfoByDDTeamName[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_apPlayerInfos[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_apInfoByScore[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_apInfoByName[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_apInfoByDDTeamScore[MAX_CLIENTS];
|
||||
const CNetObj_PlayerInfo *m_apInfoByDDTeamName[MAX_CLIENTS];
|
||||
|
||||
int m_LocalClientID;
|
||||
int m_NumPlayers;
|
||||
|
@ -317,10 +317,10 @@ public:
|
|||
};
|
||||
|
||||
CSnapState m_Snap;
|
||||
int m_LocalTuneZone[2];
|
||||
bool m_ReceivedTuning[2];
|
||||
int m_ExpectingTuningForZone[2];
|
||||
int m_ExpectingTuningSince[2];
|
||||
int m_aLocalTuneZone[NUM_DUMMIES];
|
||||
bool m_aReceivedTuning[NUM_DUMMIES];
|
||||
int m_aExpectingTuningForZone[NUM_DUMMIES];
|
||||
int m_aExpectingTuningSince[NUM_DUMMIES];
|
||||
|
||||
// client data
|
||||
struct CClientData
|
||||
|
@ -375,7 +375,7 @@ public:
|
|||
bool m_Spec;
|
||||
|
||||
// Editor allows 256 switches for now.
|
||||
bool m_SwitchStates[256];
|
||||
bool m_aSwitchStates[256];
|
||||
|
||||
CNetObj_Character m_Snapped;
|
||||
CNetObj_Character m_Evolved;
|
||||
|
@ -389,10 +389,10 @@ public:
|
|||
vec2 m_RenderPos;
|
||||
bool m_IsPredicted;
|
||||
bool m_IsPredictedLocal;
|
||||
int64_t m_SmoothStart[2];
|
||||
int64_t m_SmoothLen[2];
|
||||
vec2 m_PredPos[200];
|
||||
int m_PredTick[200];
|
||||
int64_t m_aSmoothStart[2];
|
||||
int64_t m_aSmoothLen[2];
|
||||
vec2 m_aPredPos[200];
|
||||
int m_aPredTick[200];
|
||||
bool m_SpecCharPresent;
|
||||
vec2 m_SpecChar;
|
||||
};
|
||||
|
@ -488,7 +488,7 @@ public:
|
|||
|
||||
// DDRace
|
||||
|
||||
int m_LocalIDs[NUM_DUMMIES];
|
||||
int m_aLocalIDs[NUM_DUMMIES];
|
||||
CNetObj_PlayerInput m_DummyInput;
|
||||
CNetObj_PlayerInput m_HammerInput;
|
||||
unsigned int m_DummyFire;
|
||||
|
@ -502,7 +502,7 @@ public:
|
|||
|
||||
bool IsTeamPlay() { return m_Snap.m_pGameInfoObj && m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS; }
|
||||
|
||||
bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_Tuning[g_Config.m_ClDummy].m_PlayerCollision || m_Tuning[g_Config.m_ClDummy].m_PlayerHooking); }
|
||||
bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_aTuning[g_Config.m_ClDummy].m_PlayerCollision || m_aTuning[g_Config.m_ClDummy].m_PlayerHooking); }
|
||||
bool AntiPingGrenade() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingGrenade && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }
|
||||
bool AntiPingWeapons() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingWeapons && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }
|
||||
bool AntiPingGunfire() { return AntiPingGrenade() && AntiPingWeapons() && g_Config.m_ClAntiPingGunfire; }
|
||||
|
@ -581,11 +581,11 @@ public:
|
|||
IGraphics::CTextureHandle m_aSpriteWeaponProjectiles[6];
|
||||
|
||||
// muzzles
|
||||
IGraphics::CTextureHandle m_SpriteWeaponGunMuzzles[3];
|
||||
IGraphics::CTextureHandle m_SpriteWeaponShotgunMuzzles[3];
|
||||
IGraphics::CTextureHandle m_SpriteWeaponNinjaMuzzles[3];
|
||||
IGraphics::CTextureHandle m_aSpriteWeaponGunMuzzles[3];
|
||||
IGraphics::CTextureHandle m_aSpriteWeaponShotgunMuzzles[3];
|
||||
IGraphics::CTextureHandle m_aaSpriteWeaponNinjaMuzzles[3];
|
||||
|
||||
IGraphics::CTextureHandle m_SpriteWeaponsMuzzles[6][3];
|
||||
IGraphics::CTextureHandle m_aaSpriteWeaponsMuzzles[6][3];
|
||||
|
||||
// pickups
|
||||
IGraphics::CTextureHandle m_SpritePickupHealth;
|
||||
|
@ -698,8 +698,8 @@ private:
|
|||
std::vector<CSnapEntities> m_vSnapEntities;
|
||||
void SnapCollectEntities();
|
||||
|
||||
bool m_DDRaceMsgSent[NUM_DUMMIES];
|
||||
int m_ShowOthers[NUM_DUMMIES];
|
||||
bool m_aDDRaceMsgSent[NUM_DUMMIES];
|
||||
int m_aShowOthers[NUM_DUMMIES];
|
||||
|
||||
void UpdatePrediction();
|
||||
void UpdateRenderedCharacters();
|
||||
|
@ -709,7 +709,7 @@ private:
|
|||
int m_PredictedDummyID;
|
||||
int m_IsDummySwapping;
|
||||
CCharOrder m_CharOrder;
|
||||
int m_SwitchStateTeam[NUM_DUMMIES];
|
||||
int m_aSwitchStateTeam[NUM_DUMMIES];
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -130,11 +130,11 @@ void CCharacter::HandleNinja()
|
|||
|
||||
// check if we Hit anything along the way
|
||||
{
|
||||
CCharacter *aEnts[MAX_CLIENTS];
|
||||
CCharacter *apEnts[MAX_CLIENTS];
|
||||
vec2 Dir = m_Pos - OldPos;
|
||||
float Radius = m_ProximityRadius * 2.0f;
|
||||
vec2 Center = OldPos + Dir * 0.5f;
|
||||
int Num = GameWorld()->FindEntities(Center, Radius, (CEntity **)aEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
||||
int Num = GameWorld()->FindEntities(Center, Radius, (CEntity **)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
||||
|
||||
// check that we're not in solo part
|
||||
if(TeamsCore()->GetSolo(GetCID()))
|
||||
|
@ -142,37 +142,37 @@ void CCharacter::HandleNinja()
|
|||
|
||||
for(int i = 0; i < Num; ++i)
|
||||
{
|
||||
if(aEnts[i] == this)
|
||||
if(apEnts[i] == this)
|
||||
continue;
|
||||
|
||||
// Don't hit players in other teams
|
||||
if(Team() != aEnts[i]->Team())
|
||||
if(Team() != apEnts[i]->Team())
|
||||
continue;
|
||||
|
||||
// Don't hit players in solo parts
|
||||
if(TeamsCore()->GetSolo(aEnts[i]->GetCID()))
|
||||
if(TeamsCore()->GetSolo(apEnts[i]->GetCID()))
|
||||
return;
|
||||
|
||||
// make sure we haven't Hit this object before
|
||||
bool bAlreadyHit = false;
|
||||
for(int j = 0; j < m_NumObjectsHit; j++)
|
||||
{
|
||||
if(m_aHitObjects[j] == aEnts[i]->GetCID())
|
||||
if(m_aHitObjects[j] == apEnts[i]->GetCID())
|
||||
bAlreadyHit = true;
|
||||
}
|
||||
if(bAlreadyHit)
|
||||
continue;
|
||||
|
||||
// check so we are sufficiently close
|
||||
if(distance(aEnts[i]->m_Pos, m_Pos) > (m_ProximityRadius * 2.0f))
|
||||
if(distance(apEnts[i]->m_Pos, m_Pos) > (m_ProximityRadius * 2.0f))
|
||||
continue;
|
||||
|
||||
// Hit a player, give them damage and stuffs...
|
||||
// set his velocity to fast upward (for now)
|
||||
if(m_NumObjectsHit < 10)
|
||||
m_aHitObjects[m_NumObjectsHit++] = aEnts[i]->GetCID();
|
||||
m_aHitObjects[m_NumObjectsHit++] = apEnts[i]->GetCID();
|
||||
|
||||
CCharacter *pChar = GameWorld()->GetCharacterByID(aEnts[i]->GetCID());
|
||||
CCharacter *pChar = GameWorld()->GetCharacterByID(apEnts[i]->GetCID());
|
||||
if(pChar)
|
||||
pChar->TakeDamage(vec2(0, -10.0f), g_pData->m_Weapons.m_Ninja.m_pBase->m_Damage, GetCID(), WEAPON_NINJA);
|
||||
}
|
||||
|
@ -386,9 +386,9 @@ void CCharacter::FireWeapon()
|
|||
int ShotSpread = 2;
|
||||
for(int i = -ShotSpread; i <= ShotSpread; ++i)
|
||||
{
|
||||
float Spreading[] = {-0.185f, -0.070f, 0, 0.070f, 0.185f};
|
||||
float aSpreading[] = {-0.185f, -0.070f, 0, 0.070f, 0.185f};
|
||||
float a = angle(Direction);
|
||||
a += Spreading[i + 2];
|
||||
a += aSpreading[i + 2];
|
||||
float v = 1 - (absolute(i) / (float)ShotSpread);
|
||||
float Speed = mix((float)Tuning()->m_ShotgunSpeeddiff, 1.0f, v);
|
||||
new CProjectile(
|
||||
|
@ -672,7 +672,7 @@ bool CCharacter::IsSwitchActiveCb(int Number, void *pUser)
|
|||
{
|
||||
CCharacter *pThis = (CCharacter *)pUser;
|
||||
auto &aSwitchers = pThis->Switchers();
|
||||
return !aSwitchers.empty() && pThis->Team() != TEAM_SUPER && aSwitchers[Number].m_Status[pThis->Team()];
|
||||
return !aSwitchers.empty() && pThis->Team() != TEAM_SUPER && aSwitchers[Number].m_aStatus[pThis->Team()];
|
||||
}
|
||||
|
||||
void CCharacter::HandleTiles(int Index)
|
||||
|
@ -702,47 +702,47 @@ void CCharacter::HandleTiles(int Index)
|
|||
// handle switch tiles
|
||||
if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHOPEN && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHOPEN;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_LastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()] = true;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aEndTick[Team()] = 0;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aType[Team()] = TILE_SWITCHOPEN;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aLastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDOPEN && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = true;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = GameWorld()->GameTick() + 1 + Collision()->GetSwitchDelay(MapIndex) * GameWorld()->GameTickSpeed();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDOPEN;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_LastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()] = true;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aEndTick[Team()] = GameWorld()->GameTick() + 1 + Collision()->GetSwitchDelay(MapIndex) * GameWorld()->GameTickSpeed();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aType[Team()] = TILE_SWITCHTIMEDOPEN;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aLastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHTIMEDCLOSE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = GameWorld()->GameTick() + 1 + Collision()->GetSwitchDelay(MapIndex) * GameWorld()->GameTickSpeed();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHTIMEDCLOSE;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_LastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()] = false;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aEndTick[Team()] = GameWorld()->GameTick() + 1 + Collision()->GetSwitchDelay(MapIndex) * GameWorld()->GameTickSpeed();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aType[Team()] = TILE_SWITCHTIMEDCLOSE;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aLastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_SWITCHCLOSE && Team() != TEAM_SUPER && Collision()->GetSwitchNumber(MapIndex) > 0)
|
||||
{
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()] = false;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_EndTick[Team()] = 0;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Type[Team()] = TILE_SWITCHCLOSE;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_LastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()] = false;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aEndTick[Team()] = 0;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aType[Team()] = TILE_SWITCHCLOSE;
|
||||
Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aLastUpdateTick[Team()] = GameWorld()->GameTick();
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_FREEZE && Team() != TEAM_SUPER)
|
||||
{
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()])
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()])
|
||||
{
|
||||
Freeze(Collision()->GetSwitchDelay(MapIndex));
|
||||
}
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_DFREEZE && Team() != TEAM_SUPER)
|
||||
{
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()])
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()])
|
||||
m_DeepFreeze = true;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_DUNFREEZE && Team() != TEAM_SUPER)
|
||||
{
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()])
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()])
|
||||
m_DeepFreeze = false;
|
||||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_HIT_ENABLE && m_Hit & DISABLE_HIT_HAMMER && Collision()->GetSwitchDelay(MapIndex) == WEAPON_HAMMER)
|
||||
|
@ -798,7 +798,7 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_LFREEZE && Team() != TEAM_SUPER)
|
||||
{
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()])
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()])
|
||||
{
|
||||
m_LiveFreeze = true;
|
||||
m_Core.m_LiveFrozen = true;
|
||||
|
@ -806,7 +806,7 @@ void CCharacter::HandleTiles(int Index)
|
|||
}
|
||||
else if(Collision()->GetSwitchType(MapIndex) == TILE_LUNFREEZE && Team() != TEAM_SUPER)
|
||||
{
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_Status[Team()])
|
||||
if(Collision()->GetSwitchNumber(MapIndex) == 0 || Switchers()[Collision()->GetSwitchNumber(MapIndex)].m_aStatus[Team()])
|
||||
{
|
||||
m_LiveFreeze = false;
|
||||
m_Core.m_LiveFrozen = false;
|
||||
|
@ -941,7 +941,7 @@ void CCharacter::HandleTuneLayer()
|
|||
SetTuneZone(GameWorld()->m_WorldConfig.m_UseTuneZones ? Collision()->IsTune(CurrentIndex) : 0);
|
||||
|
||||
if(m_IsLocal)
|
||||
m_Core.m_pWorld->m_Tuning[g_Config.m_ClDummy] = *GetTuning(m_TuneZone); // throw tunings (from specific zone if in a tunezone) into gamecore if the character is local
|
||||
m_Core.m_pWorld->m_aTuning[g_Config.m_ClDummy] = *GetTuning(m_TuneZone); // throw tunings (from specific zone if in a tunezone) into gamecore if the character is local
|
||||
m_Core.m_Tuning = *GetTuning(m_TuneZone);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ void CPickup::Tick()
|
|||
{
|
||||
if(GameWorld()->m_WorldConfig.m_IsVanilla && distance(m_Pos, pChr->m_Pos) >= 20.0f * 2) // pickup distance is shorter on vanilla due to using ClosestEntity
|
||||
continue;
|
||||
if(m_Layer == LAYER_SWITCH && m_Number > 0 && m_Number < (int)Switchers().size() && !Switchers()[m_Number].m_Status[pChr->Team()])
|
||||
if(m_Layer == LAYER_SWITCH && m_Number > 0 && m_Number < (int)Switchers().size() && !Switchers()[m_Number].m_aStatus[pChr->Team()])
|
||||
continue;
|
||||
bool sound = false;
|
||||
// player picked us up, is someone was hooking us, let them go
|
||||
|
|
|
@ -110,7 +110,7 @@ void CProjectile::Tick()
|
|||
CCharacter *apEnts[MAX_CLIENTS];
|
||||
int Num = GameWorld()->FindEntities(CurPos, 1.0f, (CEntity **)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
||||
for(int i = 0; i < Num; ++i)
|
||||
if(apEnts[i] && (m_Layer != LAYER_SWITCH || (m_Layer == LAYER_SWITCH && m_Number > 0 && m_Number < (int)Switchers().size() && Switchers()[m_Number].m_Status[apEnts[i]->Team()])))
|
||||
if(apEnts[i] && (m_Layer != LAYER_SWITCH || (m_Layer == LAYER_SWITCH && m_Number > 0 && m_Number < (int)Switchers().size() && Switchers()[m_Number].m_aStatus[apEnts[i]->Team()])))
|
||||
apEnts[i]->Freeze();
|
||||
}
|
||||
if(Collide && m_Bouncing != 0)
|
||||
|
|
|
@ -211,17 +211,17 @@ void CGameWorld::Tick()
|
|||
{
|
||||
for(int j = 0; j < MAX_CLIENTS; ++j)
|
||||
{
|
||||
if(Switcher.m_EndTick[j] <= GameTick() && Switcher.m_Type[j] == TILE_SWITCHTIMEDOPEN)
|
||||
if(Switcher.m_aEndTick[j] <= GameTick() && Switcher.m_aType[j] == TILE_SWITCHTIMEDOPEN)
|
||||
{
|
||||
Switcher.m_Status[j] = false;
|
||||
Switcher.m_EndTick[j] = 0;
|
||||
Switcher.m_Type[j] = TILE_SWITCHCLOSE;
|
||||
Switcher.m_aStatus[j] = false;
|
||||
Switcher.m_aEndTick[j] = 0;
|
||||
Switcher.m_aType[j] = TILE_SWITCHCLOSE;
|
||||
}
|
||||
else if(Switcher.m_EndTick[j] <= GameTick() && Switcher.m_Type[j] == TILE_SWITCHTIMEDCLOSE)
|
||||
else if(Switcher.m_aEndTick[j] <= GameTick() && Switcher.m_aType[j] == TILE_SWITCHTIMEDCLOSE)
|
||||
{
|
||||
Switcher.m_Status[j] = true;
|
||||
Switcher.m_EndTick[j] = 0;
|
||||
Switcher.m_Type[j] = TILE_SWITCHOPEN;
|
||||
Switcher.m_aStatus[j] = true;
|
||||
Switcher.m_aEndTick[j] = 0;
|
||||
Switcher.m_aType[j] = TILE_SWITCHOPEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -296,19 +296,19 @@ void CGameWorld::ReleaseHooked(int ClientID)
|
|||
CCharacter *pChr = (CCharacter *)CGameWorld::FindFirst(CGameWorld::ENTTYPE_CHARACTER);
|
||||
for(; pChr; pChr = (CCharacter *)pChr->TypeNext())
|
||||
{
|
||||
CCharacterCore *Core = pChr->Core();
|
||||
if(Core->m_HookedPlayer == ClientID)
|
||||
CCharacterCore *pCore = pChr->Core();
|
||||
if(pCore->m_HookedPlayer == ClientID)
|
||||
{
|
||||
Core->SetHookedPlayer(-1);
|
||||
Core->m_HookState = HOOK_RETRACTED;
|
||||
Core->m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
|
||||
pCore->SetHookedPlayer(-1);
|
||||
pCore->m_HookState = HOOK_RETRACTED;
|
||||
pCore->m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CTuningParams *CGameWorld::Tuning()
|
||||
{
|
||||
return &m_Core.m_Tuning[g_Config.m_ClDummy];
|
||||
return &m_Core.m_aTuning[g_Config.m_ClDummy];
|
||||
}
|
||||
|
||||
CEntity *CGameWorld::GetEntity(int ID, int EntityType)
|
||||
|
@ -553,7 +553,7 @@ void CGameWorld::CopyWorld(CGameWorld *pFrom)
|
|||
m_WorldConfig = pFrom->m_WorldConfig;
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
m_Core.m_Tuning[i] = pFrom->m_Core.m_Tuning[i];
|
||||
m_Core.m_aTuning[i] = pFrom->m_Core.m_aTuning[i];
|
||||
}
|
||||
m_pTuningList = pFrom->m_pTuningList;
|
||||
m_Teams = pFrom->m_Teams;
|
||||
|
|
|
@ -712,7 +712,7 @@ void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote
|
|||
float EyeSeparation = (0.075f - 0.010f * absolute(Direction.x)) * BaseSize;
|
||||
vec2 Offset = vec2(Direction.x * 0.125f, -0.05f + Direction.y * 0.10f) * BaseSize;
|
||||
|
||||
Graphics()->TextureSet(pSkinTextures->m_Eyes[TeeEye]);
|
||||
Graphics()->TextureSet(pSkinTextures->m_aEyes[TeeEye]);
|
||||
Graphics()->RenderQuadContainerAsSprite(m_TeeQuadContainerIndex, QuadOffset + EyeQuadOffset, BodyPos.x - EyeSeparation + Offset.x, BodyPos.y + Offset.y, EyeScale / (64.f * 0.4f), h / (64.f * 0.4f));
|
||||
Graphics()->RenderQuadContainerAsSprite(m_TeeQuadContainerIndex, QuadOffset + EyeQuadOffset, BodyPos.x + EyeSeparation + Offset.x, BodyPos.y + Offset.y, -EyeScale / (64.f * 0.4f), h / (64.f * 0.4f));
|
||||
}
|
||||
|
@ -749,31 +749,31 @@ void CRenderTools::RenderTee(CAnimState *pAnim, CTeeRenderInfo *pInfo, int Emote
|
|||
Graphics()->QuadsSetRotation(0);
|
||||
}
|
||||
|
||||
void CRenderTools::CalcScreenParams(float Aspect, float Zoom, float *w, float *h)
|
||||
void CRenderTools::CalcScreenParams(float Aspect, float Zoom, float *pWidth, float *pHeight)
|
||||
{
|
||||
const float Amount = 1150 * 1000;
|
||||
const float WMax = 1500;
|
||||
const float HMax = 1050;
|
||||
|
||||
float f = sqrtf(Amount) / sqrtf(Aspect);
|
||||
*w = f * Aspect;
|
||||
*h = f;
|
||||
*pWidth = f * Aspect;
|
||||
*pHeight = f;
|
||||
|
||||
// limit the view
|
||||
if(*w > WMax)
|
||||
if(*pWidth > WMax)
|
||||
{
|
||||
*w = WMax;
|
||||
*h = *w / Aspect;
|
||||
*pWidth = WMax;
|
||||
*pHeight = *pWidth / Aspect;
|
||||
}
|
||||
|
||||
if(*h > HMax)
|
||||
if(*pHeight > HMax)
|
||||
{
|
||||
*h = HMax;
|
||||
*w = *h * Aspect;
|
||||
*pHeight = HMax;
|
||||
*pWidth = *pHeight * Aspect;
|
||||
}
|
||||
|
||||
*w *= Zoom;
|
||||
*h *= Zoom;
|
||||
*pWidth *= Zoom;
|
||||
*pHeight *= Zoom;
|
||||
}
|
||||
|
||||
void CRenderTools::MapScreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY,
|
||||
|
@ -791,8 +791,8 @@ void CRenderTools::MapScreenToWorld(float CenterX, float CenterY, float Parallax
|
|||
|
||||
void CRenderTools::MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup, float Zoom)
|
||||
{
|
||||
float Points[4];
|
||||
float aPoints[4];
|
||||
MapScreenToWorld(CenterX, CenterY, pGroup->m_ParallaxX, pGroup->m_ParallaxY,
|
||||
pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), Zoom, Points);
|
||||
Graphics()->MapScreen(Points[0], Points[1], Points[2], Points[3]);
|
||||
pGroup->m_OffsetX, pGroup->m_OffsetY, Graphics()->ScreenAspect(), Zoom, aPoints);
|
||||
Graphics()->MapScreen(aPoints[0], aPoints[1], aPoints[2], aPoints[3]);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
void RenderTileRectangle(int RectX, int RectY, int RectW, int RectH, unsigned char IndexIn, unsigned char IndexOut, float Scale, ColorRGBA Color, int RenderFlags, ENVELOPE_EVAL pfnEval, void *pUser, int ColorEnv, int ColorEnvOffset);
|
||||
|
||||
// helpers
|
||||
void CalcScreenParams(float Aspect, float Zoom, float *w, float *h);
|
||||
void CalcScreenParams(float Aspect, float Zoom, float *pWidth, float *pHeight);
|
||||
void MapScreenToWorld(float CenterX, float CenterY, float ParallaxX, float ParallaxY,
|
||||
float OffsetX, float OffsetY, float Aspect, float Zoom, float *pPoints);
|
||||
void MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup, float Zoom = 1.0f);
|
||||
|
|
|
@ -104,12 +104,12 @@ void CRenderTools::ForceRenderQuads(CQuad *pQuads, int NumQuads, int RenderFlags
|
|||
float Conv = 1 / 255.0f;
|
||||
for(int i = 0; i < NumQuads; i++)
|
||||
{
|
||||
CQuad *q = &pQuads[i];
|
||||
CQuad *pQuad = &pQuads[i];
|
||||
|
||||
ColorRGBA Color(1.f, 1.f, 1.f, 1.f);
|
||||
if(q->m_ColorEnv >= 0)
|
||||
if(pQuad->m_ColorEnv >= 0)
|
||||
{
|
||||
pfnEval(q->m_ColorEnvOffset, q->m_ColorEnv, Color, pUser);
|
||||
pfnEval(pQuad->m_ColorEnvOffset, pQuad->m_ColorEnv, Color, pUser);
|
||||
}
|
||||
|
||||
if(Color.a <= 0)
|
||||
|
@ -126,47 +126,47 @@ void CRenderTools::ForceRenderQuads(CQuad *pQuads, int NumQuads, int RenderFlags
|
|||
continue;
|
||||
|
||||
Graphics()->QuadsSetSubsetFree(
|
||||
fx2f(q->m_aTexcoords[0].x), fx2f(q->m_aTexcoords[0].y),
|
||||
fx2f(q->m_aTexcoords[1].x), fx2f(q->m_aTexcoords[1].y),
|
||||
fx2f(q->m_aTexcoords[2].x), fx2f(q->m_aTexcoords[2].y),
|
||||
fx2f(q->m_aTexcoords[3].x), fx2f(q->m_aTexcoords[3].y));
|
||||
fx2f(pQuad->m_aTexcoords[0].x), fx2f(pQuad->m_aTexcoords[0].y),
|
||||
fx2f(pQuad->m_aTexcoords[1].x), fx2f(pQuad->m_aTexcoords[1].y),
|
||||
fx2f(pQuad->m_aTexcoords[2].x), fx2f(pQuad->m_aTexcoords[2].y),
|
||||
fx2f(pQuad->m_aTexcoords[3].x), fx2f(pQuad->m_aTexcoords[3].y));
|
||||
|
||||
float OffsetX = 0;
|
||||
float OffsetY = 0;
|
||||
float Rot = 0;
|
||||
|
||||
// TODO: fix this
|
||||
if(q->m_PosEnv >= 0)
|
||||
if(pQuad->m_PosEnv >= 0)
|
||||
{
|
||||
ColorRGBA Channels;
|
||||
pfnEval(q->m_PosEnvOffset, q->m_PosEnv, Channels, pUser);
|
||||
pfnEval(pQuad->m_PosEnvOffset, pQuad->m_PosEnv, Channels, pUser);
|
||||
OffsetX = Channels.r;
|
||||
OffsetY = Channels.g;
|
||||
Rot = Channels.b / 360.0f * pi * 2;
|
||||
}
|
||||
|
||||
IGraphics::CColorVertex Array[4] = {
|
||||
IGraphics::CColorVertex(0, q->m_aColors[0].r * Conv * Color.r, q->m_aColors[0].g * Conv * Color.g, q->m_aColors[0].b * Conv * Color.b, q->m_aColors[0].a * Conv * Color.a * Alpha),
|
||||
IGraphics::CColorVertex(1, q->m_aColors[1].r * Conv * Color.r, q->m_aColors[1].g * Conv * Color.g, q->m_aColors[1].b * Conv * Color.b, q->m_aColors[1].a * Conv * Color.a * Alpha),
|
||||
IGraphics::CColorVertex(2, q->m_aColors[2].r * Conv * Color.r, q->m_aColors[2].g * Conv * Color.g, q->m_aColors[2].b * Conv * Color.b, q->m_aColors[2].a * Conv * Color.a * Alpha),
|
||||
IGraphics::CColorVertex(3, q->m_aColors[3].r * Conv * Color.r, q->m_aColors[3].g * Conv * Color.g, q->m_aColors[3].b * Conv * Color.b, q->m_aColors[3].a * Conv * Color.a * Alpha)};
|
||||
IGraphics::CColorVertex(0, pQuad->m_aColors[0].r * Conv * Color.r, pQuad->m_aColors[0].g * Conv * Color.g, pQuad->m_aColors[0].b * Conv * Color.b, pQuad->m_aColors[0].a * Conv * Color.a * Alpha),
|
||||
IGraphics::CColorVertex(1, pQuad->m_aColors[1].r * Conv * Color.r, pQuad->m_aColors[1].g * Conv * Color.g, pQuad->m_aColors[1].b * Conv * Color.b, pQuad->m_aColors[1].a * Conv * Color.a * Alpha),
|
||||
IGraphics::CColorVertex(2, pQuad->m_aColors[2].r * Conv * Color.r, pQuad->m_aColors[2].g * Conv * Color.g, pQuad->m_aColors[2].b * Conv * Color.b, pQuad->m_aColors[2].a * Conv * Color.a * Alpha),
|
||||
IGraphics::CColorVertex(3, pQuad->m_aColors[3].r * Conv * Color.r, pQuad->m_aColors[3].g * Conv * Color.g, pQuad->m_aColors[3].b * Conv * Color.b, pQuad->m_aColors[3].a * Conv * Color.a * Alpha)};
|
||||
Graphics()->SetColorVertex(Array, 4);
|
||||
|
||||
CPoint *pPoints = q->m_aPoints;
|
||||
CPoint *pPoints = pQuad->m_aPoints;
|
||||
|
||||
if(Rot != 0)
|
||||
{
|
||||
static CPoint aRotated[4];
|
||||
aRotated[0] = q->m_aPoints[0];
|
||||
aRotated[1] = q->m_aPoints[1];
|
||||
aRotated[2] = q->m_aPoints[2];
|
||||
aRotated[3] = q->m_aPoints[3];
|
||||
aRotated[0] = pQuad->m_aPoints[0];
|
||||
aRotated[1] = pQuad->m_aPoints[1];
|
||||
aRotated[2] = pQuad->m_aPoints[2];
|
||||
aRotated[3] = pQuad->m_aPoints[3];
|
||||
pPoints = aRotated;
|
||||
|
||||
Rotate(&q->m_aPoints[4], &aRotated[0], Rot);
|
||||
Rotate(&q->m_aPoints[4], &aRotated[1], Rot);
|
||||
Rotate(&q->m_aPoints[4], &aRotated[2], Rot);
|
||||
Rotate(&q->m_aPoints[4], &aRotated[3], Rot);
|
||||
Rotate(&pQuad->m_aPoints[4], &aRotated[0], Rot);
|
||||
Rotate(&pQuad->m_aPoints[4], &aRotated[1], Rot);
|
||||
Rotate(&pQuad->m_aPoints[4], &aRotated[2], Rot);
|
||||
Rotate(&pQuad->m_aPoints[4], &aRotated[3], Rot);
|
||||
}
|
||||
|
||||
IGraphics::CFreeformItem Freeform(
|
||||
|
|
|
@ -21,7 +21,7 @@ struct CSkin
|
|||
IGraphics::CTextureHandle m_Hands;
|
||||
IGraphics::CTextureHandle m_HandsOutline;
|
||||
|
||||
IGraphics::CTextureHandle m_Eyes[6];
|
||||
IGraphics::CTextureHandle m_aEyes[6];
|
||||
|
||||
void Reset()
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ struct CSkin
|
|||
m_FeetOutline = IGraphics::CTextureHandle();
|
||||
m_Hands = IGraphics::CTextureHandle();
|
||||
m_HandsOutline = IGraphics::CTextureHandle();
|
||||
for(auto &Eye : m_Eyes)
|
||||
for(auto &Eye : m_aEyes)
|
||||
Eye = IGraphics::CTextureHandle();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -718,15 +718,15 @@ int CCollision::IsTune(int Index) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CCollision::GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed) const
|
||||
void CCollision::GetSpeedup(int Index, vec2 *pDir, int *pForce, int *pMaxSpeed) const
|
||||
{
|
||||
if(Index < 0 || !m_pSpeedup)
|
||||
return;
|
||||
float Angle = m_pSpeedup[Index].m_Angle * (pi / 180.0f);
|
||||
*Force = m_pSpeedup[Index].m_Force;
|
||||
*Dir = vec2(cos(Angle), sin(Angle));
|
||||
if(MaxSpeed)
|
||||
*MaxSpeed = m_pSpeedup[Index].m_MaxSpeed;
|
||||
*pForce = m_pSpeedup[Index].m_Force;
|
||||
*pDir = vec2(cos(Angle), sin(Angle));
|
||||
if(pMaxSpeed)
|
||||
*pMaxSpeed = m_pSpeedup[Index].m_MaxSpeed;
|
||||
}
|
||||
|
||||
int CCollision::GetSwitchType(int Index) const
|
||||
|
@ -1131,7 +1131,7 @@ int CCollision::GetDTileFlags(int Index) const
|
|||
return m_pDoor[Index].m_Flags;
|
||||
}
|
||||
|
||||
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy)
|
||||
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *pOffsetX, int *pOffsetY)
|
||||
{
|
||||
float x = Pos0.x - Pos1.x;
|
||||
float y = Pos0.y - Pos1.y;
|
||||
|
@ -1139,26 +1139,26 @@ void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy)
|
|||
{
|
||||
if(x < 0)
|
||||
{
|
||||
*Ox = -32;
|
||||
*Oy = 0;
|
||||
*pOffsetX = -32;
|
||||
*pOffsetY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Ox = 32;
|
||||
*Oy = 0;
|
||||
*pOffsetX = 32;
|
||||
*pOffsetY = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(y < 0)
|
||||
{
|
||||
*Ox = 0;
|
||||
*Oy = -32;
|
||||
*pOffsetX = 0;
|
||||
*pOffsetY = -32;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Ox = 0;
|
||||
*Oy = 32;
|
||||
*pOffsetX = 0;
|
||||
*pOffsetY = 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
int IsTeleCheckpoint(int Index) const;
|
||||
int IsSpeedup(int Index) const;
|
||||
int IsTune(int Index) const;
|
||||
void GetSpeedup(int Index, vec2 *Dir, int *Force, int *MaxSpeed) const;
|
||||
void GetSpeedup(int Index, vec2 *pDir, int *pForce, int *pMaxSpeed) const;
|
||||
int GetSwitchType(int Index) const;
|
||||
int GetSwitchNumber(int Index) const;
|
||||
int GetSwitchDelay(int Index) const;
|
||||
|
@ -125,5 +125,5 @@ private:
|
|||
class CDoorTile *m_pDoor;
|
||||
};
|
||||
|
||||
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *Ox, int *Oy);
|
||||
void ThroughOffset(vec2 Pos0, vec2 Pos1, int *pOffsetX, int *pOffsetY);
|
||||
#endif
|
||||
|
|
|
@ -405,10 +405,10 @@ void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed,
|
|||
{
|
||||
for(int x = UpdateFromX; x < UpdateToX; x++)
|
||||
{
|
||||
CTile *in = &pLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
CTile *out = &pUpdateLayer->m_pTiles[(y - UpdateFromY) * pUpdateLayer->m_Width + x - UpdateFromX];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
CTile *pIn = &pLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
CTile *pOut = &pUpdateLayer->m_pTiles[(y - UpdateFromY) * pUpdateLayer->m_Width + x - UpdateFromX];
|
||||
pOut->m_Index = pIn->m_Index;
|
||||
pOut->m_Flags = pIn->m_Flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,10 +418,10 @@ void CAutoMapper::ProceedLocalized(CLayerTiles *pLayer, int ConfigID, int Seed,
|
|||
{
|
||||
for(int x = CommitFromX; x < CommitToX; x++)
|
||||
{
|
||||
CTile *in = &pUpdateLayer->m_pTiles[(y - UpdateFromY) * pUpdateLayer->m_Width + x - UpdateFromX];
|
||||
CTile *out = &pLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
CTile *pIn = &pUpdateLayer->m_pTiles[(y - UpdateFromY) * pUpdateLayer->m_Width + x - UpdateFromX];
|
||||
CTile *pOut = &pLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
pOut->m_Index = pIn->m_Index;
|
||||
pOut->m_Flags = pIn->m_Flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,10 +453,10 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID, int Seed, int SeedO
|
|||
{
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *in = &pLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
CTile *out = &pReadLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
CTile *pIn = &pLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
CTile *pOut = &pReadLayer->m_pTiles[y * pLayer->m_Width + x];
|
||||
pOut->m_Index = pIn->m_Index;
|
||||
pOut->m_Flags = pIn->m_Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,10 +197,10 @@ void CLayerGroup::Render()
|
|||
pGraphics->ClipDisable();
|
||||
}
|
||||
|
||||
void CLayerGroup::AddLayer(CLayer *l)
|
||||
void CLayerGroup::AddLayer(CLayer *pLayer)
|
||||
{
|
||||
m_pMap->m_Modified = true;
|
||||
m_vpLayers.push_back(l);
|
||||
m_vpLayers.push_back(pLayer);
|
||||
}
|
||||
|
||||
void CLayerGroup::DeleteLayer(int Index)
|
||||
|
@ -212,16 +212,16 @@ void CLayerGroup::DeleteLayer(int Index)
|
|||
m_pMap->m_Modified = true;
|
||||
}
|
||||
|
||||
void CLayerGroup::GetSize(float *w, float *h) const
|
||||
void CLayerGroup::GetSize(float *pWidth, float *pHeight) const
|
||||
{
|
||||
*w = 0;
|
||||
*h = 0;
|
||||
*pWidth = 0;
|
||||
*pHeight = 0;
|
||||
for(const auto &pLayer : m_vpLayers)
|
||||
{
|
||||
float lw, lh;
|
||||
pLayer->GetSize(&lw, &lh);
|
||||
*w = maximum(*w, lw);
|
||||
*h = maximum(*h, lh);
|
||||
*pWidth = maximum(*pWidth, lw);
|
||||
*pHeight = maximum(*pHeight, lh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,11 +279,11 @@ void CEditor::EnvelopeEval(int TimeOffsetMillis, int Env, ColorRGBA &Channels, v
|
|||
return;
|
||||
}
|
||||
|
||||
CEnvelope *e = pThis->m_Map.m_vpEnvelopes[Env];
|
||||
CEnvelope *pEnv = pThis->m_Map.m_vpEnvelopes[Env];
|
||||
float t = pThis->m_AnimateTime;
|
||||
t *= pThis->m_AnimateSpeed;
|
||||
t += (TimeOffsetMillis / 1000.0f);
|
||||
e->Eval(t, Channels);
|
||||
pEnv->Eval(t, Channels);
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
|
@ -521,18 +521,18 @@ void CEditor::RenderBackground(CUIRect View, IGraphics::CTextureHandle Texture,
|
|||
Graphics()->QuadsEnd();
|
||||
}
|
||||
|
||||
int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree, bool IsHex, int Corners, ColorRGBA *Color)
|
||||
int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, int Current, int Min, int Max, int Step, float Scale, const char *pToolTip, bool IsDegree, bool IsHex, int Corners, ColorRGBA *pColor)
|
||||
{
|
||||
// logic
|
||||
static float s_Value;
|
||||
static char s_aNumStr[64];
|
||||
static bool s_TextMode = false;
|
||||
static void *s_LastTextpID = pID;
|
||||
static void *s_pLastTextpID = pID;
|
||||
const bool Inside = UI()->MouseInside(pRect);
|
||||
|
||||
if(UI()->MouseButton(1) && UI()->HotItem() == pID)
|
||||
{
|
||||
s_LastTextpID = pID;
|
||||
s_pLastTextpID = pID;
|
||||
s_TextMode = true;
|
||||
if(IsHex)
|
||||
str_format(s_aNumStr, sizeof(s_aNumStr), "%06X", Current);
|
||||
|
@ -550,7 +550,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
|||
}
|
||||
}
|
||||
|
||||
if(s_TextMode && s_LastTextpID == pID)
|
||||
if(s_TextMode && s_pLastTextpID == pID)
|
||||
{
|
||||
m_pTooltip = "Type your number";
|
||||
|
||||
|
@ -631,7 +631,7 @@ int CEditor::UiDoValueSelector(void *pID, CUIRect *pRect, const char *pLabel, in
|
|||
str_format(aBuf, sizeof(aBuf), "#%06X", Current);
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Current);
|
||||
RenderTools()->DrawUIRect(pRect, Color ? *Color : GetButtonColor(pID, 0), Corners, 5.0f);
|
||||
RenderTools()->DrawUIRect(pRect, pColor ? *pColor : GetButtonColor(pID, 0), Corners, 5.0f);
|
||||
UI()->DoLabel(pRect, aBuf, 10, TEXTALIGN_CENTER);
|
||||
}
|
||||
|
||||
|
@ -671,13 +671,13 @@ CLayer *CEditor::GetSelectedLayerType(int Index, int Type) const
|
|||
|
||||
std::vector<CQuad *> CEditor::GetSelectedQuads()
|
||||
{
|
||||
CLayerQuads *ql = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
CLayerQuads *pQuadLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
std::vector<CQuad *> vpQuads;
|
||||
if(!ql)
|
||||
if(!pQuadLayer)
|
||||
return vpQuads;
|
||||
vpQuads.resize(m_vSelectedQuads.size());
|
||||
for(int i = 0; i < (int)m_vSelectedQuads.size(); ++i)
|
||||
vpQuads[i] = &ql->m_vQuads[m_vSelectedQuads[i]];
|
||||
vpQuads[i] = &pQuadLayer->m_vQuads[m_vSelectedQuads[i]];
|
||||
return vpQuads;
|
||||
}
|
||||
|
||||
|
@ -1086,44 +1086,44 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
// do tele/tune/switch/speedup button
|
||||
{
|
||||
int (*pPopupFunc)(CEditor * peditor, CUIRect View, void *pContext) = nullptr;
|
||||
const char *aButtonName = nullptr;
|
||||
const char *pButtonName = nullptr;
|
||||
float Height = 0.0f;
|
||||
CLayerTiles *pS = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
if(pS)
|
||||
{
|
||||
if(pS == m_Map.m_pSwitchLayer)
|
||||
{
|
||||
aButtonName = "Switch";
|
||||
pButtonName = "Switch";
|
||||
pPopupFunc = PopupSwitch;
|
||||
Height = 36;
|
||||
}
|
||||
else if(pS == m_Map.m_pSpeedupLayer)
|
||||
{
|
||||
aButtonName = "Speedup";
|
||||
pButtonName = "Speedup";
|
||||
pPopupFunc = PopupSpeedup;
|
||||
Height = 53;
|
||||
}
|
||||
else if(pS == m_Map.m_pTuneLayer)
|
||||
{
|
||||
aButtonName = "Tune";
|
||||
pButtonName = "Tune";
|
||||
pPopupFunc = PopupTune;
|
||||
Height = 23;
|
||||
}
|
||||
else if(pS == m_Map.m_pTeleLayer)
|
||||
{
|
||||
aButtonName = "Tele";
|
||||
pButtonName = "Tele";
|
||||
pPopupFunc = PopupTele;
|
||||
Height = 23;
|
||||
}
|
||||
|
||||
if(aButtonName != nullptr)
|
||||
if(pButtonName != nullptr)
|
||||
{
|
||||
static char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), "[ctrl+a] %s", aButtonName);
|
||||
str_format(aBuf, sizeof(aBuf), "[ctrl+a] %s", pButtonName);
|
||||
|
||||
TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom);
|
||||
static int s_ModifierButton = 0;
|
||||
if(DoButton_Ex(&s_ModifierButton, aButtonName, 0, &Button, 0, aBuf, CUI::CORNER_ALL) || (ModPressed && Input()->KeyPress(KEY_A)))
|
||||
if(DoButton_Ex(&s_ModifierButton, pButtonName, 0, &Button, 0, aBuf, CUI::CORNER_ALL) || (ModPressed && Input()->KeyPress(KEY_A)))
|
||||
{
|
||||
static int s_ModifierPopupID = 0;
|
||||
if(!UiPopupExists(&s_ModifierPopupID))
|
||||
|
@ -1161,10 +1161,10 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
{
|
||||
CLayerGroup *pGroup = GetSelectedGroup();
|
||||
|
||||
float Mapping[4];
|
||||
pGroup->Mapping(Mapping);
|
||||
int x = Mapping[0] + (Mapping[2] - Mapping[0]) / 2;
|
||||
int y = Mapping[1] + (Mapping[3] - Mapping[1]) / 2;
|
||||
float aMapping[4];
|
||||
pGroup->Mapping(aMapping);
|
||||
int x = aMapping[0] + (aMapping[2] - aMapping[0]) / 2;
|
||||
int y = aMapping[1] + (aMapping[3] - aMapping[1]) / 2;
|
||||
if(Input()->KeyPress(KEY_Q) && ModPressed)
|
||||
{
|
||||
x += UI()->MouseWorldX() - (m_WorldOffsetX * pGroup->m_ParallaxX / 100) - pGroup->m_OffsetX;
|
||||
|
@ -2360,15 +2360,15 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
float y = -(View.y / Screen.h) * h;
|
||||
wx = x + w * mx / Screen.w;
|
||||
wy = y + h * my / Screen.h;
|
||||
CLayerTiles *t = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
if(t)
|
||||
CLayerTiles *pTileLayer = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES);
|
||||
if(pTileLayer)
|
||||
{
|
||||
Graphics()->MapScreen(x, y, x + w, y + h);
|
||||
m_TilesetPicker.m_Image = t->m_Image;
|
||||
m_TilesetPicker.m_Texture = t->m_Texture;
|
||||
m_TilesetPicker.m_Image = pTileLayer->m_Image;
|
||||
m_TilesetPicker.m_Texture = pTileLayer->m_Texture;
|
||||
if(m_BrushColorEnabled)
|
||||
{
|
||||
m_TilesetPicker.m_Color = t->m_Color;
|
||||
m_TilesetPicker.m_Color = pTileLayer->m_Color;
|
||||
m_TilesetPicker.m_Color.a = 255;
|
||||
}
|
||||
else
|
||||
|
@ -2376,12 +2376,12 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
m_TilesetPicker.m_Color = {255, 255, 255, 255};
|
||||
}
|
||||
|
||||
m_TilesetPicker.m_Game = t->m_Game;
|
||||
m_TilesetPicker.m_Tele = t->m_Tele;
|
||||
m_TilesetPicker.m_Speedup = t->m_Speedup;
|
||||
m_TilesetPicker.m_Front = t->m_Front;
|
||||
m_TilesetPicker.m_Switch = t->m_Switch;
|
||||
m_TilesetPicker.m_Tune = t->m_Tune;
|
||||
m_TilesetPicker.m_Game = pTileLayer->m_Game;
|
||||
m_TilesetPicker.m_Tele = pTileLayer->m_Tele;
|
||||
m_TilesetPicker.m_Speedup = pTileLayer->m_Speedup;
|
||||
m_TilesetPicker.m_Front = pTileLayer->m_Front;
|
||||
m_TilesetPicker.m_Switch = pTileLayer->m_Switch;
|
||||
m_TilesetPicker.m_Tune = pTileLayer->m_Tune;
|
||||
|
||||
m_TilesetPicker.Render(true);
|
||||
|
||||
|
@ -2390,10 +2390,10 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
}
|
||||
else
|
||||
{
|
||||
CLayerQuads *q = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(q)
|
||||
CLayerQuads *pQuadLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(pQuadLayer)
|
||||
{
|
||||
m_QuadsetPicker.m_Image = q->m_Image;
|
||||
m_QuadsetPicker.m_Image = pQuadLayer->m_Image;
|
||||
m_QuadsetPicker.m_vQuads[0].m_aPoints[0].x = f2fx(View.x);
|
||||
m_QuadsetPicker.m_vQuads[0].m_aPoints[0].y = f2fx(View.y);
|
||||
m_QuadsetPicker.m_vQuads[0].m_aPoints[1].x = f2fx((View.x + View.w));
|
||||
|
@ -2412,17 +2412,17 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
static int s_Operation = OP_NONE;
|
||||
|
||||
// draw layer borders
|
||||
CLayer *pEditLayers[128];
|
||||
CLayer *apEditLayers[128];
|
||||
size_t NumEditLayers = 0;
|
||||
|
||||
if(m_ShowPicker && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
pEditLayers[0] = &m_TilesetPicker;
|
||||
apEditLayers[0] = &m_TilesetPicker;
|
||||
NumEditLayers++;
|
||||
}
|
||||
else if(m_ShowPicker)
|
||||
{
|
||||
pEditLayers[0] = &m_QuadsetPicker;
|
||||
apEditLayers[0] = &m_QuadsetPicker;
|
||||
NumEditLayers++;
|
||||
}
|
||||
else
|
||||
|
@ -2431,37 +2431,37 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
int EditingType = -1;
|
||||
for(size_t i = 0; i < m_vSelectedLayers.size(); i++)
|
||||
{
|
||||
CLayer *Layer = GetSelectedLayer(i);
|
||||
if(Layer && (EditingType == -1 || Layer->m_Type == LAYERTYPE_TILES))
|
||||
CLayer *pLayer = GetSelectedLayer(i);
|
||||
if(pLayer && (EditingType == -1 || pLayer->m_Type == LAYERTYPE_TILES))
|
||||
{
|
||||
EditingType = Layer->m_Type;
|
||||
EditingType = pLayer->m_Type;
|
||||
if(EditingType == LAYERTYPE_TILES)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(size_t i = 0; i < m_vSelectedLayers.size() && NumEditLayers < 128; i++)
|
||||
{
|
||||
pEditLayers[NumEditLayers] = GetSelectedLayerType(i, EditingType);
|
||||
if(pEditLayers[NumEditLayers])
|
||||
apEditLayers[NumEditLayers] = GetSelectedLayerType(i, EditingType);
|
||||
if(apEditLayers[NumEditLayers])
|
||||
{
|
||||
NumEditLayers++;
|
||||
}
|
||||
}
|
||||
|
||||
CLayerGroup *g = GetSelectedGroup();
|
||||
if(g)
|
||||
CLayerGroup *pGroup = GetSelectedGroup();
|
||||
if(pGroup)
|
||||
{
|
||||
g->MapScreen();
|
||||
pGroup->MapScreen();
|
||||
|
||||
RenderGrid(g);
|
||||
RenderGrid(pGroup);
|
||||
|
||||
for(size_t i = 0; i < NumEditLayers; i++)
|
||||
{
|
||||
if(pEditLayers[i]->m_Type != LAYERTYPE_TILES)
|
||||
if(apEditLayers[i]->m_Type != LAYERTYPE_TILES)
|
||||
continue;
|
||||
|
||||
float w, h;
|
||||
pEditLayers[i]->GetSize(&w, &h);
|
||||
apEditLayers[i]->GetSize(&w, &h);
|
||||
|
||||
IGraphics::CLineItem Array[4] = {
|
||||
IGraphics::CLineItem(0, 0, w, 0),
|
||||
|
@ -2559,19 +2559,19 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
for(size_t k = 0; k < NumEditLayers; k++)
|
||||
{
|
||||
size_t BrushIndex = k % m_Brush.m_vpLayers.size();
|
||||
if(pEditLayers[k]->m_Type == m_Brush.m_vpLayers[BrushIndex]->m_Type)
|
||||
if(apEditLayers[k]->m_Type == m_Brush.m_vpLayers[BrushIndex]->m_Type)
|
||||
{
|
||||
if(pEditLayers[k]->m_Type == LAYERTYPE_TILES)
|
||||
if(apEditLayers[k]->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
CLayerTiles *l = (CLayerTiles *)pEditLayers[k];
|
||||
CLayerTiles *b = (CLayerTiles *)m_Brush.m_vpLayers[BrushIndex];
|
||||
CLayerTiles *pLayer = (CLayerTiles *)apEditLayers[k];
|
||||
CLayerTiles *pBrushLayer = (CLayerTiles *)m_Brush.m_vpLayers[BrushIndex];
|
||||
|
||||
if(l->m_Tele <= b->m_Tele && l->m_Speedup <= b->m_Speedup && l->m_Front <= b->m_Front && l->m_Game <= b->m_Game && l->m_Switch <= b->m_Switch && l->m_Tune <= b->m_Tune)
|
||||
l->BrushDraw(b, wx, wy);
|
||||
if(pLayer->m_Tele <= pBrushLayer->m_Tele && pLayer->m_Speedup <= pBrushLayer->m_Speedup && pLayer->m_Front <= pBrushLayer->m_Front && pLayer->m_Game <= pBrushLayer->m_Game && pLayer->m_Switch <= pBrushLayer->m_Switch && pLayer->m_Tune <= pBrushLayer->m_Tune)
|
||||
pLayer->BrushDraw(pBrushLayer, wx, wy);
|
||||
}
|
||||
else
|
||||
{
|
||||
pEditLayers[k]->BrushDraw(m_Brush.m_vpLayers[BrushIndex], wx, wy);
|
||||
apEditLayers[k]->BrushDraw(m_Brush.m_vpLayers[BrushIndex], wx, wy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2583,14 +2583,14 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
{
|
||||
if(Input()->KeyIsPressed(KEY_LSHIFT))
|
||||
{
|
||||
CLayerQuads *t = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(t)
|
||||
CLayerQuads *pQuadLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(pQuadLayer)
|
||||
{
|
||||
for(size_t i = 0; i < t->m_vQuads.size(); i++)
|
||||
for(size_t i = 0; i < pQuadLayer->m_vQuads.size(); i++)
|
||||
{
|
||||
CQuad *q = &t->m_vQuads[i];
|
||||
float px = fx2f(q->m_aPoints[4].x);
|
||||
float py = fx2f(q->m_aPoints[4].y);
|
||||
CQuad *pQuad = &pQuadLayer->m_vQuads[i];
|
||||
float px = fx2f(pQuad->m_aPoints[4].x);
|
||||
float py = fx2f(pQuad->m_aPoints[4].y);
|
||||
|
||||
if(px > r.x && px < r.x + r.w && py > r.y && py < r.y + r.h)
|
||||
if(!IsQuadSelected(i))
|
||||
|
@ -2608,7 +2608,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
// TODO: do all layers
|
||||
int Grabs = 0;
|
||||
for(size_t k = 0; k < NumEditLayers; k++)
|
||||
Grabs += pEditLayers[k]->BrushGrab(&m_Brush, r);
|
||||
Grabs += apEditLayers[k]->BrushGrab(&m_Brush, r);
|
||||
if(Grabs == 0)
|
||||
m_Brush.Clear();
|
||||
|
||||
|
@ -2623,7 +2623,7 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
{
|
||||
//editor.map.groups[selected_group]->mapscreen();
|
||||
for(size_t k = 0; k < NumEditLayers; k++)
|
||||
pEditLayers[k]->BrushSelecting(r);
|
||||
apEditLayers[k]->BrushSelecting(r);
|
||||
UI()->MapScreen();
|
||||
}
|
||||
}
|
||||
|
@ -2636,14 +2636,14 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
size_t BrushIndex = k;
|
||||
if(m_Brush.m_vpLayers.size() != NumEditLayers)
|
||||
BrushIndex = 0;
|
||||
pEditLayers[k]->FillSelection(m_Brush.IsEmpty(), m_Brush.m_vpLayers[BrushIndex], r);
|
||||
apEditLayers[k]->FillSelection(m_Brush.IsEmpty(), m_Brush.m_vpLayers[BrushIndex], r);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//editor.map.groups[selected_group]->mapscreen();
|
||||
for(size_t k = 0; k < NumEditLayers; k++)
|
||||
pEditLayers[k]->BrushSelecting(r);
|
||||
apEditLayers[k]->BrushSelecting(r);
|
||||
UI()->MapScreen();
|
||||
}
|
||||
}
|
||||
|
@ -2674,8 +2674,8 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
size_t BrushIndex = k;
|
||||
if(m_Brush.m_vpLayers.size() != NumEditLayers)
|
||||
BrushIndex = 0;
|
||||
if(pEditLayers[k]->m_Type == m_Brush.m_vpLayers[BrushIndex]->m_Type)
|
||||
pEditLayers[k]->BrushPlace(m_Brush.m_vpLayers[BrushIndex], wx, wy);
|
||||
if(apEditLayers[k]->m_Type == m_Brush.m_vpLayers[BrushIndex]->m_Type)
|
||||
apEditLayers[k]->BrushPlace(m_Brush.m_vpLayers[BrushIndex], wx, wy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2698,13 +2698,13 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
}
|
||||
}
|
||||
|
||||
CLayerGroup *g = GetSelectedGroup();
|
||||
if(!m_ShowPicker && g)
|
||||
CLayerGroup *pGroup = GetSelectedGroup();
|
||||
if(!m_ShowPicker && pGroup)
|
||||
{
|
||||
m_Brush.m_OffsetX += g->m_OffsetX;
|
||||
m_Brush.m_OffsetY += g->m_OffsetY;
|
||||
m_Brush.m_ParallaxX = g->m_ParallaxX;
|
||||
m_Brush.m_ParallaxY = g->m_ParallaxY;
|
||||
m_Brush.m_OffsetX += pGroup->m_OffsetX;
|
||||
m_Brush.m_OffsetY += pGroup->m_OffsetY;
|
||||
m_Brush.m_ParallaxX = pGroup->m_ParallaxX;
|
||||
m_Brush.m_ParallaxY = pGroup->m_ParallaxY;
|
||||
m_Brush.Render();
|
||||
float w, h;
|
||||
m_Brush.GetSize(&w, &h);
|
||||
|
@ -2728,15 +2728,15 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
if(!m_ShowPicker && m_Brush.IsEmpty())
|
||||
{
|
||||
// fetch layers
|
||||
CLayerGroup *g = GetSelectedGroup();
|
||||
if(g)
|
||||
g->MapScreen();
|
||||
CLayerGroup *pGroup = GetSelectedGroup();
|
||||
if(pGroup)
|
||||
pGroup->MapScreen();
|
||||
|
||||
for(size_t k = 0; k < NumEditLayers; k++)
|
||||
{
|
||||
if(pEditLayers[k]->m_Type == LAYERTYPE_QUADS)
|
||||
if(apEditLayers[k]->m_Type == LAYERTYPE_QUADS)
|
||||
{
|
||||
CLayerQuads *pLayer = (CLayerQuads *)pEditLayers[k];
|
||||
CLayerQuads *pLayer = (CLayerQuads *)apEditLayers[k];
|
||||
|
||||
if(!m_ShowEnvelopePreview)
|
||||
m_ShowEnvelopePreview = 2;
|
||||
|
@ -2758,9 +2758,9 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
}
|
||||
}
|
||||
|
||||
if(pEditLayers[k]->m_Type == LAYERTYPE_SOUNDS)
|
||||
if(apEditLayers[k]->m_Type == LAYERTYPE_SOUNDS)
|
||||
{
|
||||
CLayerSounds *pLayer = (CLayerSounds *)pEditLayers[k];
|
||||
CLayerSounds *pLayer = (CLayerSounds *)apEditLayers[k];
|
||||
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->QuadsBegin();
|
||||
|
@ -2824,8 +2824,8 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
|
||||
if(!m_ShowPicker && GetSelectedGroup() && GetSelectedGroup()->m_UseClipping)
|
||||
{
|
||||
CLayerGroup *g = m_Map.m_pGameGroup;
|
||||
g->MapScreen();
|
||||
CLayerGroup *pGameGroup = m_Map.m_pGameGroup;
|
||||
pGameGroup->MapScreen();
|
||||
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->LinesBegin();
|
||||
|
@ -2850,8 +2850,8 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
// render screen sizes
|
||||
if(m_ProofBorders && !m_ShowPicker)
|
||||
{
|
||||
CLayerGroup *g = m_Map.m_pGameGroup;
|
||||
g->MapScreen();
|
||||
CLayerGroup *pGameGroup = m_Map.m_pGameGroup;
|
||||
pGameGroup->MapScreen();
|
||||
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->LinesBegin();
|
||||
|
@ -3062,7 +3062,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
}
|
||||
else if(pProps[i].m_Type == PROPTYPE_COLOR)
|
||||
{
|
||||
static const char *s_paTexts[4] = {"R", "G", "B", "A"};
|
||||
static const char *s_apTexts[4] = {"R", "G", "B", "A"};
|
||||
static int s_aShift[] = {24, 16, 8, 0};
|
||||
int NewColor = 0;
|
||||
|
||||
|
@ -3077,7 +3077,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
for(int c = 0; c < 4; c++)
|
||||
{
|
||||
int v = (pProps[i].m_Value >> s_aShift[c]) & 0xff;
|
||||
NewColor |= UiDoValueSelector(((char *)&pIDs[i]) + c, &Shifter, s_paTexts[c], v, 0, 255, 1, 1.0f, "Use left mouse button to drag and change the color value. Hold shift to be more precise. Rightclick to edit as text.") << s_aShift[c];
|
||||
NewColor |= UiDoValueSelector(((char *)&pIDs[i]) + c, &Shifter, s_apTexts[c], v, 0, 255, 1, 1.0f, "Use left mouse button to drag and change the color value. Hold shift to be more precise. Rightclick to edit as text.") << s_aShift[c];
|
||||
|
||||
if(c != 3)
|
||||
{
|
||||
|
@ -4648,7 +4648,7 @@ void CEditor::RenderFileDialog()
|
|||
if(DoButton_Editor(&s_NewFolderButton, "New folder", 0, &Button, 0, nullptr))
|
||||
{
|
||||
m_aFileDialogNewFolderName[0] = 0;
|
||||
m_FileDialogErrString[0] = 0;
|
||||
m_aFileDialogErrString[0] = 0;
|
||||
static int s_NewFolderPopupID = 0;
|
||||
UiInvokePopupMenu(&s_NewFolderPopupID, 0, Width / 2.0f - 200.0f, Height / 2.0f - 100.0f, 400.0f, 200.0f, PopupNewFolder);
|
||||
UI()->SetActiveItem(nullptr);
|
||||
|
@ -5005,14 +5005,14 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
|
||||
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
|
||||
|
||||
static const char *s_paNames[4][4] = {
|
||||
static const char *s_aapNames[4][4] = {
|
||||
{"V", "", "", ""},
|
||||
{"", "", "", ""},
|
||||
{"X", "Y", "R", ""},
|
||||
{"R", "G", "B", "A"},
|
||||
};
|
||||
|
||||
const char *paDescriptions[4][4] = {
|
||||
static const char *s_aapDescriptions[4][4] = {
|
||||
{"Volume of the envelope", "", "", ""},
|
||||
{"", "", "", ""},
|
||||
{"X-axis of the envelope", "Y-axis of the envelope", "Rotation of the envelope", ""},
|
||||
|
@ -5026,7 +5026,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
{
|
||||
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
|
||||
|
||||
if(DoButton_Env(&s_aChannelButtons[i], s_paNames[pEnvelope->m_Channels - 1][i], s_ActiveChannels & Bit, &Button, paDescriptions[pEnvelope->m_Channels - 1][i], aColors[i]))
|
||||
if(DoButton_Env(&s_aChannelButtons[i], s_aapNames[pEnvelope->m_Channels - 1][i], s_ActiveChannels & Bit, &Button, s_aapDescriptions[pEnvelope->m_Channels - 1][i], aColors[i]))
|
||||
s_ActiveChannels ^= Bit;
|
||||
}
|
||||
|
||||
|
@ -5135,11 +5135,11 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
v.w = CurveBar.h;
|
||||
v.x -= v.w / 2;
|
||||
void *pID = &pEnvelope->m_vPoints[i].m_Curvetype;
|
||||
const char *paTypeName[] = {
|
||||
const char *apTypeName[] = {
|
||||
"N", "L", "S", "F", "M"};
|
||||
const char *pTypeName = "Invalid";
|
||||
if(0 <= pEnvelope->m_vPoints[i].m_Curvetype && pEnvelope->m_vPoints[i].m_Curvetype < (int)std::size(paTypeName))
|
||||
pTypeName = paTypeName[pEnvelope->m_vPoints[i].m_Curvetype];
|
||||
if(0 <= pEnvelope->m_vPoints[i].m_Curvetype && pEnvelope->m_vPoints[i].m_Curvetype < (int)std::size(apTypeName))
|
||||
pTypeName = apTypeName[pEnvelope->m_vPoints[i].m_Curvetype];
|
||||
if(DoButton_Editor(pID, pTypeName, 0, &v, 0, "Switch curve type"))
|
||||
pEnvelope->m_vPoints[i].m_Curvetype = (pEnvelope->m_vPoints[i].m_Curvetype + 1) % NUM_CURVETYPES;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue