From b12ae69feebc12d6962fcd14222a715bae4fe5c5 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Wed, 2 Jun 2010 03:55:08 +0800 Subject: [PATCH 1/8] fixed compile errors for osx --- src/engine/client/text.cpp | 2 +- src/engine/shared/datafile.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index b05d49f8d..57e1b43b5 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -52,7 +52,7 @@ struct CFontSizeData int m_FontSize; FT_Face *m_pFace; - unsigned m_aTextures[2]; + GLuint m_aTextures[2]; int m_TextureWidth; int m_TextureHeight; diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp index dcc32ef2e..e7905f811 100644 --- a/src/engine/shared/datafile.cpp +++ b/src/engine/shared/datafile.cpp @@ -154,7 +154,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename) } #if defined(CONF_ARCH_ENDIAN_BIG) - swap_endian(m_pDataFile->m_pData, sizeof(int), Header.Swaplen / sizeof(int)); + swap_endian(m_pDataFile->m_pData, sizeof(int), Header.m_Swaplen / sizeof(int)); #endif //if(DEBUG) @@ -476,7 +476,7 @@ int CDataFileWriter::AddDataSwapped(int Size, void *pData) int Index; mem_copy(pSwapped, pData, Size); swap_endian(&pSwapped, sizeof(int), Size/sizeof(int)); - Index = AddData(Size, Swapped); + Index = AddData(Size, pSwapped); mem_free(pSwapped); return Index; #else From b851bc8799027a3e6a6369ef31189f7a1d73bb5c Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Wed, 2 Jun 2010 03:59:04 +0800 Subject: [PATCH 2/8] fixed so that SDL_main is declared as a C function so linking gets done correctly --- src/engine/client/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 97adeeac7..613a81376 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1949,7 +1949,7 @@ static CClient m_Client; */ #if defined(CONF_PLATFORM_MACOSX) -int SDL_main(int argc, const char **argv) // ignore_convention +extern "C" int SDL_main(int argc, const char **argv) // ignore_convention #else int main(int argc, const char **argv) // ignore_convention #endif From 8e1712c744a6641dbe79f250719531c4036cbda9 Mon Sep 17 00:00:00 2001 From: xalduin Date: Wed, 2 Jun 2010 04:49:35 +0800 Subject: [PATCH 3/8] Sort by map name when opening map When opening a map, the list of map names is now sorted alphabetically. --- src/game/editor/ed_editor.cpp | 36 +++++++++++++++++------------------ src/game/editor/ed_editor.h | 2 ++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index 480a68277..b2b3e1ca8 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -1,7 +1,8 @@ // copyright (c) 2007 magnus auvinen, see licence.txt for more info #include - +#include +#include #include #include @@ -1885,21 +1886,21 @@ static char gs_FileDialogFileName[512] = {0}; static char gs_aFileDialogPath[512] = {0}; static char gs_aFileDialogCompleteFilename[512] = {0}; static int gs_FilesNum = 0; +static sorted_array gs_FileList; int g_FilesStartAt = 0; int g_FilesCur = 0; int g_FilesStopAt = 999; -struct CListDirInfo -{ - CUIRect *m_pRect; - CEditor *m_pEditor; -}; - static void EditorListdirCallback(const char *pName, int IsDir, void *pUser) { if(pName[0] == '.' || IsDir) // skip this shit! return; + gs_FileList.add(string(pName)); +} + +void CEditor::AddFileDialogEntry(const char *pName, CUIRect *pView) +{ if(g_FilesCur > gs_FilesNum) gs_FilesNum = g_FilesCur; @@ -1907,14 +1908,12 @@ static void EditorListdirCallback(const char *pName, int IsDir, void *pUser) if(g_FilesCur-1 < g_FilesStartAt || g_FilesCur > g_FilesStopAt) return; - CListDirInfo *pInfo = (CListDirInfo *)pUser; - CUIRect *pView = pInfo->m_pRect; CUIRect Button; pView->HSplitTop(15.0f, &Button, pView); pView->HSplitTop(2.0f, 0, pView); //char buf[512]; - if(pInfo->m_pEditor->DoButton_File((void*)(10+(int)Button.y), pName, 0, &Button, 0, 0)) + if(DoButton_File((void*)(10+(int)Button.y), pName, 0, &Button, 0, 0)) { str_copy(gs_FileDialogFileName, pName, sizeof(gs_FileDialogFileName)); @@ -1922,11 +1921,11 @@ static void EditorListdirCallback(const char *pName, int IsDir, void *pUser) str_append(gs_aFileDialogCompleteFilename, gs_aFileDialogPath, sizeof(gs_aFileDialogCompleteFilename)); str_append(gs_aFileDialogCompleteFilename, gs_FileDialogFileName, sizeof(gs_aFileDialogCompleteFilename)); - if(pInfo->m_pEditor->Input()->MouseDoubleClick()) + if(Input()->MouseDoubleClick()) { if(gs_pfnFileDialogFunc) - gs_pfnFileDialogFunc(gs_aFileDialogCompleteFilename, pInfo->m_pEditor); - pInfo->m_pEditor->m_Dialog = DIALOG_NONE; + gs_pfnFileDialogFunc(gs_aFileDialogCompleteFilename, this); + m_Dialog = DIALOG_NONE; } } } @@ -1997,13 +1996,12 @@ void CEditor::RenderFileDialog() // set clipping UI()->ClipEnable(&View); - // the list - CListDirInfo Info; - Info.m_pRect = &View; - Info.m_pEditor = this; - // TODO: lazy ass coding, should store the interface pointer somewere - Kernel()->RequestInterface()->ListDirectory(gs_FileDialogDirTypes, gs_aFileDialogPath, EditorListdirCallback, &Info); + Kernel()->RequestInterface()->ListDirectory(gs_FileDialogDirTypes, gs_aFileDialogPath, EditorListdirCallback, 0); + + for(int i = 0; i < gs_FileList.size(); i++) + AddFileDialogEntry(gs_FileList[i].cstr(), &View); + gs_FileList.clear(); // disable clipping again UI()->ClipDisable(); diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h index 1730fb0a3..d027c1622 100644 --- a/src/game/editor/ed_editor.h +++ b/src/game/editor/ed_editor.h @@ -606,6 +606,8 @@ public: void RenderMenubar(CUIRect Menubar); void RenderFileDialog(); + + void AddFileDialogEntry(const char *pName, CUIRect *pView); }; // make sure to inline this function From ad1ce014469acd56caab6c74d04474e029952193 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 3 Jun 2010 01:39:28 +0800 Subject: [PATCH 4/8] fixed shotbug (#80) --- src/game/client/components/controls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 0b4918b23..7b3f47160 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -19,7 +19,10 @@ void CControls::OnReset() { m_LastData.m_Direction = 0; m_LastData.m_Hook = 0; - m_LastData.m_Fire = 0; + // simulate releasing the fire button + if((m_LastData.m_Fire&1) != 0) + m_LastData.m_Fire++; + m_LastData.m_Fire &= INPUT_STATE_MASK; m_LastData.m_Jump = 0; m_InputData = m_LastData; From bed67b156c5c3c6cd1af33d652cc01b965e8a4c0 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 3 Jun 2010 02:27:53 +0800 Subject: [PATCH 5/8] added fix for portuguese translation by slinack --- data/languages/portuguese.txt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt index 3f811a6d3..64bf7e6c8 100644 --- a/data/languages/portuguese.txt +++ b/data/languages/portuguese.txt @@ -23,7 +23,7 @@ Are you sure that you want to quit? == Você tem certeza que deseja sair? As this is the first time you have launched the game, please enter your nickname below. It is recommended that you check your settings so you adjust them to your preferences before joining a server. -== Como esta é a primeira vez que você abriu o jogo, por favor, entre com seu apelido abaixo. É recomendado que você cheque suas configurações e então ajuste elaspara suas preferências antes de entrar em um servidor. +== Como esta é a primeira vez que você abriu o jogo, por favor, entre com seu apelido abaixo. É recomendado que você cheque suas configurações e então ajuste elas para suas preferências antes de entrar em um servidor. Blue team == Time azul @@ -113,7 +113,7 @@ Fire == Atirar Force vote -== Forçar votação +== Forçar Fullscreen == Tela cheia @@ -167,13 +167,13 @@ Internet == Internet Join blue -== Entre no az. +== Azul Join game == Entre no jogo Join red -== Entre no verm. +== Vermelho Jump == Pular @@ -218,7 +218,7 @@ Movement == Movimento Mute when not active -== Silenciar quando não ativo +== Silenciar quando inativo Name == Nome @@ -260,13 +260,13 @@ Pistol == Pistola Play -== Jogar +== Assistir Player == Jogador Players -== Jogador +== Jogadores Prev. weapon == Arma anterior @@ -320,7 +320,7 @@ Score board == Placar Score limit -== Pontuação máxima +== Placar máx. Scoreboard == Placar @@ -343,6 +343,9 @@ Settings Shotgun == Espingarda +Show chat +== Mostrar conversa + Show name plates == Mostrar apelidos @@ -389,7 +392,7 @@ The server is running a non-standard tuning on a pure game type. == O servidor está rodando uma modificação não padrão em um tipo de jogo puro. Time limit -== Limite de tempo +== Tempo máx. Try again == Tente novamente @@ -435,8 +438,6 @@ Your skin ##### needs translation #### -Show chat -== Show chat ##### old translations #### From 979f8d87651de60b88b885aac19ba235ce28c537 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Wed, 2 Jun 2010 17:46:07 +0800 Subject: [PATCH 6/8] cleaned up the configure.lua a little bit --- configure.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.lua b/configure.lua index 993ed51ab..3b36d484a 100644 --- a/configure.lua +++ b/configure.lua @@ -76,7 +76,7 @@ function NewConfig(on_configured_callback) local options_table = {} if not options_func then - print("auto configuration", options_func) + print("auto configuration") self:Config(filename) options_func = loadfile(filename) end From dd19074deba2df94592f454f4333fcbfe0f66893 Mon Sep 17 00:00:00 2001 From: NoxNebula Date: Wed, 2 Jun 2010 10:42:17 +0800 Subject: [PATCH 7/8] Admin-Kick-Protection Add IsAuthed(int ClientID); function. Add kickprotection for admins (Remote Console logged in players) Add Anti-Self-Kick (minor) --- src/engine/server.h | 2 ++ src/engine/server/server.cpp | 7 +++++++ src/engine/server/server.h | 1 + src/game/server/gamecontext.cpp | 13 +++++++++++++ 4 files changed, 23 insertions(+) diff --git a/src/engine/server.h b/src/engine/server.h index 52e6ec6a4..fa5d24981 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -49,6 +49,8 @@ public: virtual void *SnapNewItem(int Type, int Id, int Size) = 0; virtual void SnapSetStaticsize(int ItemType, int Size) = 0; + + virtual bool IsAuthed(int ClientID) = 0; }; class IGameServer : public IInterface diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 05e56a742..b5a01a99a 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -293,6 +293,13 @@ int CServer::Init() return 0; } +bool CServer::IsAuthed(int ClientID) +{ + if(m_aClients[ClientID].m_Authed) + return true; + return false; +} + int CServer::GetClientInfo(int ClientID, CClientInfo *pInfo) { dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "client_id is not valid"); diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 7d56bd333..895a4bd1e 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -138,6 +138,7 @@ public: int Init(); + bool IsAuthed(int ClientID); int GetClientInfo(int ClientID, CClientInfo *pInfo); void GetClientIP(int ClientID, char *pIPString, int Size); const char *ClientName(int ClientId); diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 795bb65fe..c04dd9457 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -647,6 +647,19 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId) SendChatTarget(ClientId, "Invalid client id to kick"); return; } + if(KickId == ClientId) + { + SendChatTarget(ClientId, "You cant kick yourself"); + return; + } + if(Server()->IsAuthed(KickId)) + { + SendChatTarget(ClientId, "You cant kick admins"); + char aBufKick[128]; + str_format(aBufKick, sizeof(aBufKick), "%s called for vote to kick you", Server()->ClientName(ClientId)); + SendChatTarget(KickId, aBufKick); + return; + } str_format(aChatmsg, sizeof(aChatmsg), "%s called for vote to kick '%s'", Server()->ClientName(ClientId), Server()->ClientName(KickId)); str_format(aDesc, sizeof(aDesc), "Kick '%s'", Server()->ClientName(KickId)); From c37335b115f69f8ab54403742640faff384d2747 Mon Sep 17 00:00:00 2001 From: SushiTee Date: Wed, 2 Jun 2010 21:33:19 +0200 Subject: [PATCH 8/8] shortened IsAuthed a bit --- src/engine/server/server.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index b5a01a99a..7380235dd 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -295,9 +295,7 @@ int CServer::Init() bool CServer::IsAuthed(int ClientID) { - if(m_aClients[ClientID].m_Authed) - return true; - return false; + return m_aClients[ClientID].m_Authed; } int CServer::GetClientInfo(int ClientID, CClientInfo *pInfo)