35 changes: 35 additions & 0 deletions src/game/client/components/menus.cpp
Expand Up @@ -365,6 +365,31 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
pDisplayStr = aStars;
}

char aInputing[32] = {0};
if(UI()->HotItem() == pID && Input()->GetIMEState())
{
str_format(aInputing, sizeof(aInputing), pStr);
const char *Text = Input()->GetIMECandidate();
if (str_length(Text))
{
int NewTextLen = str_length(Text);
int CharsLeft = StrSize - str_length(aInputing) - 1;
int FillCharLen = min(NewTextLen, CharsLeft);
//Push Char Backward
for(int i = str_length(aInputing); i >= s_AtIndex ; i--)
aInputing[i+FillCharLen] = aInputing[i];
for(int i = 0; i < FillCharLen; i++)
{
if(Text[i] == '\n')
aInputing[s_AtIndex + i] = ' ';
else
aInputing[s_AtIndex + i] = Text[i];
}
//s_AtIndex = s_AtIndex+FillCharLen;
pDisplayStr = aInputing;
}
}

// check if the text has to be moved
if(UI()->LastActiveItem() == pID && !JustGotActive && (UpdateOffset || m_NumInputEvents))
{
Expand Down Expand Up @@ -399,6 +424,15 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
// render the cursor
if(UI()->LastActiveItem() == pID && !JustGotActive)
{
if (str_length(aInputing))
{
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex + Input()->GetEditingCursor());
Textbox = *pRect;
Textbox.VSplitLeft(2.0f, 0, &Textbox);
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1)/2);

UI()->DoLabel(&Textbox, "|", FontSize, -1);
}
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
Textbox = *pRect;
Textbox.VSplitLeft(2.0f, 0, &Textbox);
Expand Down Expand Up @@ -1617,6 +1651,7 @@ int CMenus::Render()

void CMenus::SetActive(bool Active)
{
Input()->SetIMEState(Active);
m_MenuActive = Active;
#if defined(__ANDROID__)
UI()->AndroidShowScreenKeys(!m_MenuActive && !m_pClient->m_pControls->m_UsingGamepad);
Expand Down
1 change: 1 addition & 0 deletions src/game/client/gameclient.cpp
Expand Up @@ -619,6 +619,7 @@ void CGameClient::OnDummyDisconnect()
m_DDRaceMsgSent[1] = false;
m_ShowOthers[1] = -1;
m_LastNewPredictedTick[1] = -1;
g_Config.m_ClDummyCopyMoves = 0;
}

void CGameClient::OnRelease()
Expand Down
21 changes: 21 additions & 0 deletions src/game/client/lineinput.cpp
Expand Up @@ -30,6 +30,27 @@ void CLineInput::Set(const char *pString)
}
}

void CLineInput::Editing(const char *pString, int Cursor)
{
str_copy(m_DisplayStr, m_Str, sizeof(m_DisplayStr));
char Texting[34];
str_format(Texting, sizeof(Texting), "[%s]", pString);
int NewTextLen = str_length(Texting);
int CharsLeft = (int)sizeof(m_DisplayStr) - str_length(m_DisplayStr) - 1;
int FillCharLen = NewTextLen < CharsLeft ? NewTextLen : CharsLeft;
for(int i = str_length(m_DisplayStr) - 1; i >= m_CursorPos ; i--)
m_DisplayStr[i+FillCharLen] = m_DisplayStr[i];
for(int i = 0; i < FillCharLen; i++)
{
if(Texting[i] == 28)
m_DisplayStr[m_CursorPos + i] = ' ';
else
m_DisplayStr[m_CursorPos + i] = Texting[i];
}
m_FakeLen = str_length(m_DisplayStr);
m_FakeCursorPos = m_CursorPos + Cursor + 1;
}

void CLineInput::Add(const char *pString)
{
if((int)sizeof(m_Str) - m_Len <= (int)str_length(pString))
Expand Down
11 changes: 8 additions & 3 deletions src/game/client/lineinput.h
Expand Up @@ -17,6 +17,10 @@ class CLineInput
int m_Len;
int m_CursorPos;
int m_NumChars;

char m_DisplayStr[MAX_SIZE+34];
int m_FakeLen;
int m_FakeCursorPos;
public:
static bool Manipulate(IInput::CEvent e, char *pStr, int StrMaxSize, int StrMaxChars, int *pStrLenPtr, int *pCursorPosPtr, int *pNumCharsPtr);

Expand All @@ -30,11 +34,12 @@ class CLineInput
CLineInput();
void Clear();
void ProcessInput(IInput::CEvent e);
void Editing(const char *pString, int Cursor);
void Set(const char *pString);
void Add(const char *pString);
const char *GetString() const { return m_Str; }
int GetLength() const { return m_Len; }
int GetCursorOffset() const { return m_CursorPos; }
const char *GetString(bool Editing = false) const { return Editing ? m_DisplayStr : m_Str; }
int GetLength(bool Editing = false) const { return Editing ? m_FakeLen : m_Len; }
int GetCursorOffset(bool Editing = false) const { return Editing ? m_FakeCursorPos : m_CursorPos; }
void SetCursorOffset(int Offset) { m_CursorPos = Offset > m_Len ? m_Len : Offset < 0 ? 0 : Offset; }
};

Expand Down
42 changes: 38 additions & 4 deletions src/game/editor/editor.cpp
Expand Up @@ -2564,6 +2564,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
Graphics()->TextureSet(-1);
Graphics()->LinesBegin();

// possible screen sizes (white border)
float aLastPoints[4];
float Start = 1.0f; //9.0f/16.0f;
float End = 16.0f/9.0f;
Expand Down Expand Up @@ -2606,7 +2607,7 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
mem_copy(aLastPoints, aPoints, sizeof(aPoints));
}

if(1)
// two screen sizes (green and red border)
{
Graphics()->SetColor(1,0,0,1);
for(int i = 0; i < 2; i++)
Expand Down Expand Up @@ -2634,8 +2635,16 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
Graphics()->SetColor(0,1,0,1);
}
}

Graphics()->LinesEnd();

// tee position (blue circle)
{
Graphics()->TextureSet(-1);
Graphics()->QuadsBegin();
Graphics()->SetColor(0,0,1,0.3f);
RenderTools()->DrawCircle(m_WorldOffsetX, m_WorldOffsetY, 20.0f, 32);
Graphics()->QuadsEnd();
}
}

if (!m_ShowPicker && m_ShowTileInfo && m_ShowEnvelopePreview != 0 && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_QUADS)
Expand Down Expand Up @@ -3809,10 +3818,10 @@ void CEditor::RenderFileDialog()
aPath[0] = 0;
str_format(aBuf, sizeof(aBuf), "Current path: %s", aPath);
UI()->DoLabel(&PathBox, aBuf, 10.0f, -1, -1);

// filebox

if(m_FileDialogStorageType == IStorage::TYPE_SAVE)
{
// filebox
static float s_FileBoxID = 0;
UI()->DoLabel(&FileBoxLabel, "Filename:", 10.0f, -1, -1);
if(DoEditBox(&s_FileBoxID, &FileBox, m_aFileDialogFileName, sizeof(m_aFileDialogFileName), 10.0f, &s_FileBoxID))
Expand All @@ -3824,6 +3833,29 @@ void CEditor::RenderFileDialog()
m_FilesSelectedIndex = -1;
}
}
else
{
//searchbox
FileBox.VSplitRight(250, &FileBox, 0);
CUIRect ClearBox;
FileBox.VSplitRight(15, &FileBox, &ClearBox);

static float s_SearchBoxID = 0;
UI()->DoLabel(&FileBoxLabel, "Search:", 10.0f, -1, -1);
DoEditBox(&s_SearchBoxID, &FileBox, m_aFileDialogSearchText, sizeof(m_aFileDialogSearchText), 10.0f, &s_SearchBoxID,false,CUI::CORNER_L);

// clearSearchbox button
{
static int s_ClearButton = 0;
RenderTools()->DrawUIRect(&ClearBox, vec4(1, 1, 1, 0.33f)*ButtonColorMul(&s_ClearButton), CUI::CORNER_R, 3.0f);
UI()->DoLabel(&ClearBox, "×", 10.0f, 0);
if (UI()->DoButtonLogic(&s_ClearButton, "×", 0, &ClearBox))
{
m_aFileDialogSearchText[0] = 0;
UI()->SetActiveItem(&s_SearchBoxID);
}
}
}

int Num = (int)(View.h/17.0f)+1;
static int ScrollBar = 0;
Expand Down Expand Up @@ -3936,6 +3968,7 @@ void CEditor::RenderFileDialog()
UI()->ClipEnable(&View);

for(int i = 0; i < m_FileList.size(); i++)
if (!m_aFileDialogSearchText[0] || str_find_nocase (m_FileList[i].m_aName, m_aFileDialogSearchText))
AddFileDialogEntry(i, &View);

// disable clipping again
Expand Down Expand Up @@ -4073,6 +4106,7 @@ void CEditor::InvokeFileDialog(int StorageType, int FileType, const char *pTitle
m_pfnFileDialogFunc = pfnFunc;
m_pFileDialogUser = pUser;
m_aFileDialogFileName[0] = 0;
m_aFileDialogSearchText[0] = 0;
m_aFileDialogCurrentFolder[0] = 0;
m_aFileDialogCurrentLink[0] = 0;
m_pFileDialogPath = m_aFileDialogCurrentFolder;
Expand Down
1 change: 1 addition & 0 deletions src/game/editor/editor.h
Expand Up @@ -810,6 +810,7 @@ class CEditor : public IEditor
char m_aFileDialogFileName[MAX_PATH_LENGTH];
char m_aFileDialogCurrentFolder[MAX_PATH_LENGTH];
char m_aFileDialogCurrentLink[MAX_PATH_LENGTH];
char m_aFileDialogSearchText[64];
char *m_pFileDialogPath;
bool m_aFileDialogActivate;
int m_FileDialogFileType;
Expand Down
4 changes: 3 additions & 1 deletion src/game/server/entities/laser.cpp
Expand Up @@ -56,8 +56,10 @@ bool CLaser::HitCharacter(vec2 From, vec2 To)

if(!g_Config.m_SvOldLaser)
Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength;
else
else if(pOwnerChar)
Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - pHit->Core()->m_Pos) * Strength;
else
Temp = pHit->Core()->m_Vel;
if(Temp.x > 0 && ((pHit->m_TileIndex == TILE_STOP && pHit->m_TileFlags == ROTATION_270) || (pHit->m_TileIndexL == TILE_STOP && pHit->m_TileFlagsL == ROTATION_270) || (pHit->m_TileIndexL == TILE_STOPS && (pHit->m_TileFlagsL == ROTATION_90 || pHit->m_TileFlagsL ==ROTATION_270)) || (pHit->m_TileIndexL == TILE_STOPA) || (pHit->m_TileFIndex == TILE_STOP && pHit->m_TileFFlags == ROTATION_270) || (pHit->m_TileFIndexL == TILE_STOP && pHit->m_TileFFlagsL == ROTATION_270) || (pHit->m_TileFIndexL == TILE_STOPS && (pHit->m_TileFFlagsL == ROTATION_90 || pHit->m_TileFFlagsL == ROTATION_270)) || (pHit->m_TileFIndexL == TILE_STOPA) || (pHit->m_TileSIndex == TILE_STOP && pHit->m_TileSFlags == ROTATION_270) || (pHit->m_TileSIndexL == TILE_STOP && pHit->m_TileSFlagsL == ROTATION_270) || (pHit->m_TileSIndexL == TILE_STOPS && (pHit->m_TileSFlagsL == ROTATION_90 || pHit->m_TileSFlagsL == ROTATION_270)) || (pHit->m_TileSIndexL == TILE_STOPA)))
Temp.x = 0;
if(Temp.x < 0 && ((pHit->m_TileIndex == TILE_STOP && pHit->m_TileFlags == ROTATION_90) || (pHit->m_TileIndexR == TILE_STOP && pHit->m_TileFlagsR == ROTATION_90) || (pHit->m_TileIndexR == TILE_STOPS && (pHit->m_TileFlagsR == ROTATION_90 || pHit->m_TileFlagsR == ROTATION_270)) || (pHit->m_TileIndexR == TILE_STOPA) || (pHit->m_TileFIndex == TILE_STOP && pHit->m_TileFFlags == ROTATION_90) || (pHit->m_TileFIndexR == TILE_STOP && pHit->m_TileFFlagsR == ROTATION_90) || (pHit->m_TileFIndexR == TILE_STOPS && (pHit->m_TileFFlagsR == ROTATION_90 || pHit->m_TileFFlagsR == ROTATION_270)) || (pHit->m_TileFIndexR == TILE_STOPA) || (pHit->m_TileSIndex == TILE_STOP && pHit->m_TileSFlags == ROTATION_90) || (pHit->m_TileSIndexR == TILE_STOP && pHit->m_TileSFlagsR == ROTATION_90) || (pHit->m_TileSIndexR == TILE_STOPS && (pHit->m_TileSFlagsR == ROTATION_90 || pHit->m_TileSFlagsR == ROTATION_270)) || (pHit->m_TileSIndexR == TILE_STOPA)))
Expand Down
16 changes: 8 additions & 8 deletions src/game/server/score/sql_score.cpp
Expand Up @@ -783,7 +783,7 @@ bool CSqlScore::ShowTeamRankThread(CSqlServer* pSqlServer, const CSqlData *pGame
try
{
// check sort methode
char aBuf[600];
char aBuf[2400];
char aNames[2300];
aNames[0] = '\0';

Expand All @@ -810,13 +810,13 @@ bool CSqlScore::ShowTeamRankThread(CSqlServer* pSqlServer, const CSqlData *pGame

for(int Row = 0; Row < Rows; Row++)
{
strcat(aNames, pSqlServer->GetResults()->getString("Name").c_str());
str_append(aNames, pSqlServer->GetResults()->getString("Name").c_str(), sizeof(aNames));
pSqlServer->GetResults()->next();

if (Row < Rows - 2)
strcat(aNames, ", ");
str_append(aNames, ", ", sizeof(aNames));
else if (Row < Rows - 1)
strcat(aNames, " & ");
str_append(aNames, " & ", sizeof(aNames));
}

pSqlServer->GetResults()->first();
Expand Down Expand Up @@ -927,7 +927,7 @@ bool CSqlScore::ShowTeamTop5Thread(CSqlServer* pSqlServer, const CSqlData *pGame
try
{
// check sort methode
char aBuf[512];
char aBuf[2400];

pSqlServer->executeSql("SET @prev := NULL;");
pSqlServer->executeSql("SET @previd := NULL;");
Expand Down Expand Up @@ -972,12 +972,12 @@ bool CSqlScore::ShowTeamTop5Thread(CSqlServer* pSqlServer, const CSqlData *pGame
pSqlServer->GetResults()->first();
for(int Row = 0; Row < Rows; Row++)
{
strcat(aNames, pSqlServer->GetResults()->getString("Name").c_str());
str_append(aNames, pSqlServer->GetResults()->getString("Name").c_str(), sizeof(aNames));

if (Row < aCuts[CutPos] - 1)
strcat(aNames, ", ");
str_append(aNames, ", ", sizeof(aNames));
else if (Row < aCuts[CutPos])
strcat(aNames, " & ");
str_append(aNames, " & ", sizeof(aNames));

Time = (float)pSqlServer->GetResults()->getDouble("Time");
Rank = (float)pSqlServer->GetResults()->getInt("rank");
Expand Down
6 changes: 3 additions & 3 deletions src/game/version.h
Expand Up @@ -3,8 +3,8 @@
#ifndef GAME_VERSION_H
#define GAME_VERSION_H
#include "generated/nethash.cpp"
#define GAME_VERSION "0.6.3, 10.2.1"
#define GAME_VERSION "0.6.3, 10.3"
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
static const char GAME_RELEASE_VERSION[8] = "10.2.1";
#define CLIENT_VERSIONNR 1002
static const char GAME_RELEASE_VERSION[8] = "10.3";
#define CLIENT_VERSIONNR 1003
#endif