From 38c26de47bd835061d1732851851804ed269dbdc Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 1 Aug 2017 21:55:49 +0200 Subject: [PATCH 01/10] Add `install`, `package` and `package_source` targets to CMake On Linux, `install` installs DDNet into the normal file system (root rights required). `package` tries to create an archive similar to today's release archives and `package_source` tries to create a source archive similar to today's source archives. --- .gitignore | 1 + CMakeLists.txt | 180 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 175 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index dbd3c74a1..8ffeb1ce2 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ DDNet-Server_d DDNet-Server_sql DDNet-Server_sql_d +/build CMakeCache.txt CMakeFiles Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c12b83be..e396a2fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,27 @@ cmake_minimum_required(VERSION 2.8) -project(DDNet) + +file(STRINGS src/game/version.h VERSION_LINE + LIMIT_COUNT 1 + REGEX GAME_RELEASE_VERSION +) + +if(VERSION_LINE MATCHES "\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\"") + set(VERSION_MAJOR ${CMAKE_MATCH_1}) + set(VERSION_MINOR ${CMAKE_MATCH_2}) + set(VERSION_PATCH ${CMAKE_MATCH_3}) +else() + message(FATAL_ERROR "Couldn't parse version from src/game/version.h") +endif() + +if(POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) + project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +else() + project(DDNet) + set(PROJECT_VERSION_MAJOR ${VERSION_MAJOR}) + set(PROJECT_VERSION_MINOR ${VERSION_MINOR}) + set(PROJECT_VERSION_PATCH ${VERSION_PATCH}) +endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) @@ -304,10 +326,13 @@ endif() ######################################################################## file(COPY data DESTINATION .) -file(COPY ${CURL_COPY_FILES} DESTINATION .) -file(COPY ${FREETYPE_COPY_FILES} DESTINATION .) -file(COPY ${OPUSFILE_COPY_FILES} DESTINATION .) -file(COPY ${SDL2_COPY_FILES} DESTINATION .) +set(COPY_FILES + ${CURL_COPY_FILES} + ${FREETYPE_COPY_FILES} + ${OPUSFILE_COPY_FILES} + ${SDL2_COPY_FILES} +) +file(COPY ${COPY_FILES} DESTINATION .) ######################################################################## # CODE GENERATION @@ -834,13 +859,17 @@ foreach(ABS_T ${TOOLS}) if(T MATCHES "\\.cpp$") string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}") set(EXTRA_TOOL_SRC) + set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) if(TOOL MATCHES "^(tileset_|dilate|map_extract|map_replace_image$)") list(APPEND EXTRA_TOOL_SRC ${DEP_PNG}) endif() if(TOOL MATCHES "^config_") list(APPEND EXTRA_TOOL_SRC "src/tools/config_common.h") endif() - add_executable(${TOOL} EXCLUDE_FROM_ALL + if(TOOL MATCHES "^(config_retrieve|config_store|dilate|map_diff|map_extract)$") + set(EXCLUDE_FROM_ALL) + endif() + add_executable(${TOOL} ${EXCLUDE_FROM_ALL} ${DEPS} src/tools/${TOOL}.cpp ${EXTRA_TOOL_SRC} @@ -887,6 +916,145 @@ if(GTEST_FOUND) ) endif() +######################################################################## +# INSTALLATION +######################################################################## + +function(escape_regex VAR STRING) + string(REGEX REPLACE "([][^$.+*?|()\\\\])" "\\\\\\1" ESCAPED "${STRING}") + set(${VAR} ${ESCAPED} PARENT_SCOPE) +endfunction() + +function(max_length VAR) + set(MAX_LENGTH 0) + foreach(str ${ARGN}) + string(LENGTH ${str} LENGTH) + if(LENGTH GREATER MAX_LENGTH) + set(MAX_LENGTH ${LENGTH}) + endif() + endforeach() + set(${VAR} ${MAX_LENGTH} PARENT_SCOPE) +endfunction() + +# Tries to generate a list of regex that matches everything except the given +# parameters. +function(regex_inverted VAR) + max_length(MAX_LENGTH ${ARGN}) + math(EXPR UPPER_BOUND "${MAX_LENGTH}-1") + + set(REMAINING ${ARGN}) + set(RESULT) + + foreach(i RANGE ${UPPER_BOUND}) + set(TEMP ${REMAINING}) + set(REMAINING) + foreach(str ${TEMP}) + string(LENGTH ${str} LENGTH) + if(i LESS LENGTH) + list(APPEND REMAINING ${str}) + endif() + endforeach() + + set(ADDITIONAL) + foreach(outer ${REMAINING}) + string(SUBSTRING ${outer} 0 ${i} OUTER_PREFIX) + set(CHARS "") + foreach(inner ${REMAINING}) + string(SUBSTRING ${inner} 0 ${i} INNER_PREFIX) + if(OUTER_PREFIX STREQUAL INNER_PREFIX) + string(SUBSTRING ${inner} ${i} 1 INNER_NEXT) + set(CHARS "${CHARS}${INNER_NEXT}") + endif() + endforeach() + escape_regex(OUTER_PREFIX_ESCAPED "${OUTER_PREFIX}") + + list(APPEND ADDITIONAL "${OUTER_PREFIX_ESCAPED}([^${CHARS}]|$)") + endforeach() + list(REMOVE_DUPLICATES ADDITIONAL) + list(APPEND RESULT ${ADDITIONAL}) + endforeach() + set(${VAR} ${RESULT} PARENT_SCOPE) +endfunction() + +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_VERBATIM_VARIABLES ON) +set(CPACK_GENERATOR TGZ TXZ) +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENTS_ALL portable) +set(CPACK_SOURCE_GENERATOR ZIP TGZ TBZ2 TXZ) +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) +set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) + +if(TARGET_OS AND TARGET_BITS) + if(TARGET_OS STREQUAL "windows") + set(CPACK_SYSTEM_NAME "win${TARGET_BITS}") + set(CPACK_GENERATOR ZIP) + elseif(TARGET_OS STREQUAL "linux") + # Assuming Intel here. + if(TARGET_BITS EQUAL 32) + set(CPACK_SYSTEM_NAME "linux_x86") + elseif(TARGET_BITS EQUAL 64) + set(CPACK_SYSTEM_NAME "linux_x86_64") + endif() + elseif(TARGET_OS STREQUAL "mac") + set(CPACK_SYSTEM_NAME "osx") + endif() +endif() + +set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}) +set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-src) +set(CPACK_SOURCE_FILES + CMakeLists.txt + README.md + autoexec_server.cfg + bam.lua + cmake/ + configure.lua + data/ + datasrc/ + ddnet-libs/ + license.txt + other/ + scripts/ + src/ + storage.cfg +) +set(CPACK_SOURCE_IGNORE_FILES + "\\.pyc$" + "/\\.git" + "/__pycache__/" +) + +regex_inverted(CPACK_SOURCE_FILES_INVERTED ${CPACK_SOURCE_FILES}) +escape_regex(PROJECT_SOURCE_DIR_ESCAPED ${PROJECT_SOURCE_DIR}) + +foreach(str ${CPACK_SOURCE_FILES_INVERTED}) + list(APPEND CPACK_SOURCE_IGNORE_FILES "${PROJECT_SOURCE_DIR_ESCAPED}/${str}") +endforeach() + +# Unset these variables, they might do something in the future of CPack. +unset(CPACK_SOURCE_FILES) +unset(CPACK_SOURCE_FILES_INVERTED) + +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ${PROJECT_NAME}) +install(TARGETS ${TARGET_CLIENT} ${TARGET_SERVER} DESTINATION bin) +install(DIRECTORY data DESTINATION share/DDNet) + +set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL) +install(TARGETS ${TARGET_CLIENT} ${TARGET_SERVER} ${EXTRA_ARGS}) +install(TARGETS config_retrieve config_store dilate map_diff map_extract ${EXTRA_ARGS} OPTIONAL) +install(DIRECTORY data ${EXTRA_ARGS}) +install(FILES license.txt storage.cfg autoexec_server.cfg ${EXTRA_ARGS}) +install(FILES ${COPY_FILES} ${EXTRA_ARGS}) +if(TARGET_OS STREQUAL "windows") + install(FILES other/config_directory.bat ${EXTRA_ARGS}) +endif() + +include(CPack) + ######################################################################## # COMPILER-SPECIFICS ######################################################################## From 45d944162a1dc7f04d20ae2ee542f14895fa15fb Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 5 Sep 2017 16:00:50 +0200 Subject: [PATCH 02/10] Add package targets independent of CPack This makes packaging compatible to CMake versions prior to CMake 3.6. --- .travis.yml | 1 + CMakeLists.txt | 98 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 87 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index e713d0316..e482024d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ script: - if [ "$TRAVIS_OS_NAME" != "osx" ]; then cmake -Werror=dev -DGTEST_LIBRARY=../gtest_build/libgtest.a -DGTEST_MAIN_LIBRARY=../gtest_build/libgtest_main.a ..; fi - make everything - if [ "$TRAVIS_OS_NAME" != "osx" ]; then make run_tests; fi +- make package_default env: global: - CFLAGS="-Wdeclaration-after-statement -Werror" diff --git a/CMakeLists.txt b/CMakeLists.txt index e396a2fb4..4c645fb44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -860,7 +860,7 @@ foreach(ABS_T ${TOOLS}) string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}") set(EXTRA_TOOL_SRC) set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) - if(TOOL MATCHES "^(tileset_|dilate|map_extract|map_replace_image$)") + if(TOOL MATCHES "^(tileset_.*|dilate|map_extract|map_replace_image)$") list(APPEND EXTRA_TOOL_SRC ${DEP_PNG}) endif() if(TOOL MATCHES "^config_") @@ -1035,24 +1035,98 @@ foreach(str ${CPACK_SOURCE_FILES_INVERTED}) list(APPEND CPACK_SOURCE_IGNORE_FILES "${PROJECT_SOURCE_DIR_ESCAPED}/${str}") endforeach() -# Unset these variables, they might do something in the future of CPack. -unset(CPACK_SOURCE_FILES) -unset(CPACK_SOURCE_FILES_INVERTED) - set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME ${PROJECT_NAME}) install(TARGETS ${TARGET_CLIENT} ${TARGET_SERVER} DESTINATION bin) install(DIRECTORY data DESTINATION share/DDNet) -set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL) -install(TARGETS ${TARGET_CLIENT} ${TARGET_SERVER} ${EXTRA_ARGS}) -install(TARGETS config_retrieve config_store dilate map_diff map_extract ${EXTRA_ARGS} OPTIONAL) -install(DIRECTORY data ${EXTRA_ARGS}) -install(FILES license.txt storage.cfg autoexec_server.cfg ${EXTRA_ARGS}) -install(FILES ${COPY_FILES} ${EXTRA_ARGS}) +set(CPACK_TARGETS + ${TARGET_CLIENT} + ${TARGET_SERVER} + config_retrieve + config_store + dilate + map_diff + map_extract +) +set(CPACK_DIRS data) +set(CPACK_FILES + license.txt + storage.cfg + autoexec_server.cfg + ${COPY_FILES} +) if(TARGET_OS STREQUAL "windows") - install(FILES other/config_directory.bat ${EXTRA_ARGS}) + list(APPEND CPACK_FILES other/config_directory.bat) endif() +function(array_add_prefix VAR PREFIX) # ... + set(RESULT) + foreach(element ${ARGN}) + list(APPEND RESULT "${PREFIX}${element}") + endforeach() + set(${VAR} ${RESULT} PARENT_SCOPE) +endfunction() + +if(CMAKE_VERSION VERSION_GREATER 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6) + set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable) + install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS}) + install(DIRECTORY ${CPACK_DIRS} ${EXTRA_ARGS}) + install(FILES ${CPACK_FILES} ${EXTRA_ARGS}) +else() + message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.") +endif() + +array_add_prefix(PACKAGE_FILES_SOURCE ${PROJECT_SOURCE_DIR}/ ${CPACK_FILES}) +set(COPY_DIRS_COMMAND) +foreach(dir ${CPACK_DIRS}) + list(APPEND COPY_DIRS_COMMAND COMMAND cmake -E copy_directory ${PROJECT_SOURCE_DIR}/${dir} ${CPACK_PACKAGE_FILE_NAME}/${dir}) +endforeach() +set(PACKAGE_TARGETS_EXPRESSIONS) +foreach(target ${CPACK_TARGETS}) + list(APPEND PACKAGE_TARGETS_EXPRESSIONS $) +endforeach() + +foreach(ext zip tar.gz tar.xz) + set(TAR_MODE c) + set(TAR_FORMAT paxr) + string(REPLACE . _ EXT_SLUG ${ext}) + if(ext STREQUAL zip) + set(TAR_FORMAT zip) + elseif(ext STREQUAL tar.gz) + set(TAR_MODE cz) + elseif(ext STREQUAL tar.xz) + set(TAR_MODE cJ) + endif() + add_custom_command(OUTPUT ${CPACK_PACKAGE_FILE_NAME}.${ext} + COMMAND cmake -E make_directory ${CPACK_PACKAGE_FILE_NAME} + COMMAND cmake -E copy ${PACKAGE_FILES_SOURCE} ${CPACK_PACKAGE_FILE_NAME}/ + ${COPY_DIRS_COMMAND} + COMMAND cmake -E copy ${PACKAGE_TARGETS_EXPRESSIONS} ${CPACK_PACKAGE_FILE_NAME}/ + COMMAND cmake -E tar ${TAR_MODE} ${CPACK_PACKAGE_FILE_NAME}.${ext} --format=${TAR_FORMAT} -- ${CPACK_PACKAGE_FILE_NAME}/ + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + ) + add_custom_target(package_${EXT_SLUG} DEPENDS ${CPACK_PACKAGE_FILE_NAME}.${ext}) +endforeach() + +set(PACKAGE_DEFAULT tar_xz) +if(TARGET_OS STREQUAL "windows") + set(PACKAGE_DEFAULT zip) +endif() +add_custom_target(package_default DEPENDS package_${PACKAGE_DEFAULT}) + +add_custom_target(package_all DEPENDS + package_tar_gz + package_tar_xz + package_zip +) + +# Unset these variables, they might do something in the future of CPack. +unset(CPACK_SOURCE_FILES) +unset(CPACK_SOURCE_FILES_INVERTED) +unset(CPACK_TARGETS) +unset(CPACK_DIRS) +unset(CPACK_FILES) + include(CPack) ######################################################################## From 8b2e31620f81170424dbb25343660975f63733d2 Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 5 Sep 2017 21:42:09 +0200 Subject: [PATCH 03/10] Compatibility with older CMake Copy each file individually, only pass --type parameter for creating zips. --- CMakeLists.txt | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c645fb44..34097c05c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1059,14 +1059,6 @@ if(TARGET_OS STREQUAL "windows") list(APPEND CPACK_FILES other/config_directory.bat) endif() -function(array_add_prefix VAR PREFIX) # ... - set(RESULT) - foreach(element ${ARGN}) - list(APPEND RESULT "${PREFIX}${element}") - endforeach() - set(${VAR} ${RESULT} PARENT_SCOPE) -endfunction() - if(CMAKE_VERSION VERSION_GREATER 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6) set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable) install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS}) @@ -1076,22 +1068,25 @@ else() message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.") endif() -array_add_prefix(PACKAGE_FILES_SOURCE ${PROJECT_SOURCE_DIR}/ ${CPACK_FILES}) -set(COPY_DIRS_COMMAND) -foreach(dir ${CPACK_DIRS}) - list(APPEND COPY_DIRS_COMMAND COMMAND cmake -E copy_directory ${PROJECT_SOURCE_DIR}/${dir} ${CPACK_PACKAGE_FILE_NAME}/${dir}) +set(COPY_FILE_COMMANDS) +set(COPY_DIR_COMMANDS) +set(COPY_TARGET_COMMANDS) +foreach(file ${CPACK_FILES}) + list(APPEND COPY_FILE_COMMANDS COMMAND cmake -E copy ${PROJECT_SOURCE_DIR}/${file} ${CPACK_PACKAGE_FILE_NAME}/) +endforeach() +foreach(dir ${CPACK_DIRS}) + list(APPEND COPY_DIR_COMMAND COMMAND cmake -E copy_directory ${PROJECT_SOURCE_DIR}/${dir} ${CPACK_PACKAGE_FILE_NAME}/${dir}) endforeach() -set(PACKAGE_TARGETS_EXPRESSIONS) foreach(target ${CPACK_TARGETS}) - list(APPEND PACKAGE_TARGETS_EXPRESSIONS $) + list(APPEND COPY_TARGET_COMMANDS COMMAND cmake -E copy $ ${CPACK_PACKAGE_FILE_NAME}/) endforeach() foreach(ext zip tar.gz tar.xz) set(TAR_MODE c) - set(TAR_FORMAT paxr) + set(TAR_EXTRA_ARGS) string(REPLACE . _ EXT_SLUG ${ext}) if(ext STREQUAL zip) - set(TAR_FORMAT zip) + set(TAR_EXTRA_ARGS --format=zip) elseif(ext STREQUAL tar.gz) set(TAR_MODE cz) elseif(ext STREQUAL tar.xz) @@ -1099,10 +1094,10 @@ foreach(ext zip tar.gz tar.xz) endif() add_custom_command(OUTPUT ${CPACK_PACKAGE_FILE_NAME}.${ext} COMMAND cmake -E make_directory ${CPACK_PACKAGE_FILE_NAME} - COMMAND cmake -E copy ${PACKAGE_FILES_SOURCE} ${CPACK_PACKAGE_FILE_NAME}/ - ${COPY_DIRS_COMMAND} - COMMAND cmake -E copy ${PACKAGE_TARGETS_EXPRESSIONS} ${CPACK_PACKAGE_FILE_NAME}/ - COMMAND cmake -E tar ${TAR_MODE} ${CPACK_PACKAGE_FILE_NAME}.${ext} --format=${TAR_FORMAT} -- ${CPACK_PACKAGE_FILE_NAME}/ + ${COPY_FILE_COMMANDS} + ${COPY_DIR_COMMANDS} + ${COPY_TARGET_COMMANDS} + COMMAND cmake -E tar ${TAR_MODE} ${CPACK_PACKAGE_FILE_NAME}.${ext} ${TAR_EXTRA_ARGS} -- ${CPACK_PACKAGE_FILE_NAME}/ WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) add_custom_target(package_${EXT_SLUG} DEPENDS ${CPACK_PACKAGE_FILE_NAME}.${ext}) From c93189b61a1c4a4d88053f17949686cd5d11baa3 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Wed, 6 Sep 2017 09:56:53 -0300 Subject: [PATCH 04/10] Update Brazilian Portuguese translation --- data/languages/brazilian_portuguese.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/data/languages/brazilian_portuguese.txt b/data/languages/brazilian_portuguese.txt index 9a15a4daa..6704607d6 100644 --- a/data/languages/brazilian_portuguese.txt +++ b/data/languages/brazilian_portuguese.txt @@ -13,6 +13,7 @@ # HeroiAmarelo 2012-08-01 15:50:18 # Rafael Fontenelle 2014-11-21 13:31:06 # Rafael Fontenelle 2016-12-12 13:31:06 +# Rafael Fontenelle 2017-09-06 09:51:00 ##### /authors ##### ##### translated strings ##### @@ -387,7 +388,7 @@ Rename demo == Renomear demo Reset filter -== Resetar filtro +== Redefinir filtro Respawn == Reaparecer @@ -986,22 +987,20 @@ Name plates size Grabs == Pega -##### generated by copy_fix.py, please translate this ##### - Hi o/ -== +== Olá o/ Automatically create statboard csv -== +== Criar csv de statboard automaticamente Enable long pain sound (used when shooting in freeze) -== +== Habilita som de dor longa (usado ao atirar em congelamento) Spree -== +== Sequência Max CSVs -== +== CSVs máx Friend -== +== Amigo From c2c453bd4511e0668bfd9beb1869d017cbde2778 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 7 Sep 2017 20:51:46 +0200 Subject: [PATCH 05/10] Make sending name to info.ddnet.tw optional, show dialog at start and some minor fixes --- src/engine/client/client.cpp | 14 +++++++++---- src/engine/shared/config_variables.h | 5 +++-- src/game/client/components/menus.cpp | 20 ++++++++++++++----- src/game/client/components/menus_browser.cpp | 15 ++++++++++++-- src/game/client/components/menus_settings.cpp | 5 ++++- src/game/variables.h | 4 ++-- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index df0a1d6f7..9d9b3df58 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2690,7 +2690,8 @@ void CClient::Run() // loads the existing ddnet-info.json file if it exists LoadDDNetInfo(); // but still request the new one from server - RequestDDNetInfo(); + if(g_Config.m_ClShowWelcome) + RequestDDNetInfo(); bool LastD = false; bool LastQ = false; @@ -3622,10 +3623,15 @@ bool CClient::RaceRecordIsRecording() void CClient::RequestDDNetInfo() { char aUrl[256]; - char aEscaped[128]; + str_copy(aUrl, "https://info.ddnet.tw/info", sizeof(aUrl)); - Fetcher()->Escape(aEscaped, sizeof(aEscaped), g_Config.m_PlayerName); - str_format(aUrl, sizeof(aUrl), "https://info.ddnet.tw/info?name=%s", aEscaped); + if(g_Config.m_BrIndicateFinished) + { + char aEscaped[128]; + Fetcher()->Escape(aEscaped, sizeof(aEscaped), g_Config.m_PlayerName); + str_append(aUrl, "?name=", sizeof(aUrl)); + str_append(aUrl, aEscaped, sizeof(aUrl)); + } m_pDDNetInfoTask = new CFetchTask(true, /*UseDDNetCA*/ true); Fetcher()->QueueAdd(m_pDDNetInfoTask, aUrl, "ddnet-info.json.tmp", IStorage::TYPE_SAVE); diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 42799c174..d37c553a8 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -42,7 +42,7 @@ MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use f MACRO_CONFIG_INT(InpGrab, inp_grab, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method") #endif -MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string") +MACRO_CONFIG_STR(BrFilterString, br_filter_string, 25, "Novice", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser filtering string") MACRO_CONFIG_STR(BrExcludeString, br_exclude_string, 25, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Server browser exclusion string") MACRO_CONFIG_INT(BrFilterFull, br_filter_full, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out full server in browser") MACRO_CONFIG_INT(BrFilterEmpty, br_filter_empty, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out empty server in browser") @@ -62,6 +62,7 @@ MACRO_CONFIG_INT(BrFilterUnfinishedMap, br_filter_unfinished_map, 0, 0, 1, CFGFL MACRO_CONFIG_STR(BrFilterExcludeCountries, br_filter_exclude_countries, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out ddnet servers by country") MACRO_CONFIG_STR(BrFilterExcludeTypes, br_filter_exclude_types, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Filter out ddnet servers by type (mod)") +MACRO_CONFIG_INT(BrIndicateFinished, br_indicate_finished, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Show whether you have finished a DDNet map (transmits your player name to info.ddnet.tw)") MACRO_CONFIG_INT(BrSort, br_sort, 4, 0, 256, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") MACRO_CONFIG_INT(BrSortOrder, br_sort_order, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") @@ -133,7 +134,7 @@ MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 0, 0, 0, CFGFLAG_SAVE| MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render quads as triangles (fixes quad coloring on some GPUs)") #endif -MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity") +MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 200, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity") MACRO_CONFIG_INT(InpMouseOld, inp_mouseold, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use old mouse mode (warp mouse instead of raw input)") MACRO_CONFIG_INT(InpIgnoredModifiers, inp_ignored_modifiers, 0, 0, 65536, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ignored keyboard modifier mask") diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index bc650679d..68ff8febe 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -925,10 +925,7 @@ void CMenus::OnInit() // */ if(g_Config.m_ClShowWelcome) - { m_Popup = POPUP_LANGUAGE; - str_copy(g_Config.m_BrFilterString, "Novice [DDraceNetwork]", sizeof(g_Config.m_BrFilterString)); - } g_Config.m_ClShowWelcome = 0; Console()->Chain("add_favorite", ConchainServerbrowserUpdate, this); @@ -1159,7 +1156,7 @@ int CMenus::Render() } else if(m_Popup == POPUP_FIRST_LAUNCH) { - pTitle = Localize("Welcome to Teeworlds"); + pTitle = Localize("Welcome to DDNet"); pExtraText = Localize("As this is the first time you launch the game, please enter your nick name below. It's recommended that you check the settings to adjust them to your liking before joining a server."); pButtonText = Localize("Ok"); ExtraAlign = -1; @@ -1609,9 +1606,22 @@ int CMenus::Render() static int s_EnterButton = 0; if(DoButton_Menu(&s_EnterButton, Localize("Enter"), 0, &Part) || m_EnterPressed) + { + Client()->RequestDDNetInfo(); m_Popup = POPUP_NONE; + } + + Box.HSplitBottom(20.f, &Box, &Part); +#if defined(__ANDROID__) + Box.HSplitBottom(60.f, &Box, &Part); +#else + Box.HSplitBottom(24.f, &Box, &Part); +#endif + + Part.VSplitLeft(60.0f, 0, &Part); + if (DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Show DDNet map finishes in server browser\n(transmits your player name to info.ddnet.tw)"), g_Config.m_BrIndicateFinished, &Part)) + g_Config.m_BrIndicateFinished ^= 1; - Box.HSplitBottom(40.f, &Box, &Part); #if defined(__ANDROID__) Box.HSplitBottom(60.f, &Box, &Part); #else diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 7075d7adc..00904b089 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -669,8 +669,19 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) if(g_Config.m_UiPage == PAGE_DDNET) { ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter); - if (DoButton_CheckBox(&g_Config.m_BrFilterUnfinishedMap, Localize("Unfinished map"), g_Config.m_BrFilterUnfinishedMap, &Button)) - g_Config.m_BrFilterUnfinishedMap ^= 1; + if (DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Indicate map finish"), g_Config.m_BrIndicateFinished, &Button)) + g_Config.m_BrIndicateFinished ^= 1; + + if(g_Config.m_BrIndicateFinished) + { + ServerFilter.HSplitTop(20.0f, &Button, &ServerFilter); + if (DoButton_CheckBox(&g_Config.m_BrFilterUnfinishedMap, Localize("Unfinished map"), g_Config.m_BrFilterUnfinishedMap, &Button)) + g_Config.m_BrFilterUnfinishedMap ^= 1; + } + else + { + g_Config.m_BrFilterUnfinishedMap = 0; + } // add more space ServerFilter.HSplitTop(10.0f, 0, &ServerFilter); diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index c507059b1..821624c52 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -1047,7 +1047,10 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView) MainView.HSplitTop(20.0f, &Label, &MainView); Label.VSplitLeft(130.0f, &Label, &Button); - str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_GfxRefreshRate); + if(g_Config.m_GfxRefreshRate) + str_format(aBuf, sizeof(aBuf), "%s: %i Hz", Localize("Refresh Rate"), g_Config.m_GfxRefreshRate); + else + str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Refresh Rate"), Localize("no limit")); UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1); Button.HMargin(2.0f, &Button); g_Config.m_GfxRefreshRate = static_cast(DoScrollbarH(&g_Config.m_GfxRefreshRate, &Button, g_Config.m_GfxRefreshRate/1000.0f)*1000.0f+0.1f); diff --git a/src/game/variables.h b/src/game/variables.h index 981310a3f..415d1d689 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -87,11 +87,11 @@ MACRO_CONFIG_STR(ClPlayerSkin, player_skin, 24, "default", CFGFLAG_CLIENT|CFGFLA MACRO_CONFIG_INT(ClKittySkins, cl_kitty_skins, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable kitty skins instead of vanilla skins") MACRO_CONFIG_INT(ClFatSkins, cl_fat_skins, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Enable fat skins") -MACRO_CONFIG_INT(UiPage, ui_page, 6, 0, 11, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page") +MACRO_CONFIG_INT(UiPage, ui_page, 9, 0, 11, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface page") MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Toolbox page") MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 64, "localhost:8303", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface server address") MACRO_CONFIG_INT(UiScale, ui_scale, 100, 50, 150, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface scale") -MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor") +MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 200, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor") MACRO_CONFIG_INT(UiColorHue, ui_color_hue, 160, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color hue") MACRO_CONFIG_INT(UiColorSat, ui_color_sat, 70, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Interface color saturation") From e7e1070adf9bfbcd63f4ba3db474d1eea086d19f Mon Sep 17 00:00:00 2001 From: def Date: Fri, 8 Sep 2017 20:06:48 +0200 Subject: [PATCH 06/10] WinXP: Use http://info.ddnet.tw --- src/engine/client/client.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 9d9b3df58..e54d07d35 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3623,7 +3623,15 @@ bool CClient::RaceRecordIsRecording() void CClient::RequestDDNetInfo() { char aUrl[256]; - str_copy(aUrl, "https://info.ddnet.tw/info", sizeof(aUrl)); + #if defined(CONF_FAMILY_WINDOWS) + static bool s_IsWinXP = os_compare_version(5U, 1U) <= 0; + #else + static bool s_IsWinXP = false; + #endif + if(s_IsWinXP) + str_copy(aUrl, "http://info.ddnet.tw/info", sizeof(aUrl)); + else + str_copy(aUrl, "https://info.ddnet.tw/info", sizeof(aUrl)); if(g_Config.m_BrIndicateFinished) { From 874c8381f263f09748d5072f9a017f234f38ed0f Mon Sep 17 00:00:00 2001 From: def Date: Fri, 8 Sep 2017 20:48:53 +0200 Subject: [PATCH 07/10] macosx freetype try --- other/freetype.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/other/freetype.lua b/other/freetype.lua index 0fdcb7f89..5a5a8994f 100644 --- a/other/freetype.lua +++ b/other/freetype.lua @@ -35,12 +35,6 @@ FreeType = { settings.link.libpath:Add("ddnet-libs/freetype/windows/lib64") end settings.link.libs:Add("freetype") - elseif platform == "macosx" and string.find(settings.config_name, "64") then - settings.link.libpath:Add("ddnet-libs/freetype/mac/lib64") - settings.link.libs:Add("freetype") - elseif platform == "macosx" then - settings.link.libpath:Add("ddnet-libs/freetype/mac/lib32") - settings.link.libs:Add("freetype") end end From 030239351208c298a00a15c4b145a0343176bf89 Mon Sep 17 00:00:00 2001 From: def Date: Fri, 8 Sep 2017 21:01:38 +0200 Subject: [PATCH 08/10] builds now --- ddnet-libs | 2 +- other/freetype.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ddnet-libs b/ddnet-libs index d2b509bba..3d28233cb 160000 --- a/ddnet-libs +++ b/ddnet-libs @@ -1 +1 @@ -Subproject commit d2b509bbad1a473be8fa31f902bc586b41da6b4b +Subproject commit 3d28233cbc36a810e3164ace4bb61b62162519e5 diff --git a/other/freetype.lua b/other/freetype.lua index 5a5a8994f..3d79f671c 100644 --- a/other/freetype.lua +++ b/other/freetype.lua @@ -35,6 +35,8 @@ FreeType = { settings.link.libpath:Add("ddnet-libs/freetype/windows/lib64") end settings.link.libs:Add("freetype") + else + settings.link.libs:Add("freetype") end end From 715ac673ecec86e1d32682658c693350d820ccd2 Mon Sep 17 00:00:00 2001 From: def Date: Fri, 8 Sep 2017 22:01:51 +0200 Subject: [PATCH 09/10] Version 10.8.6 --- src/game/version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/version.h b/src/game/version.h index a15af367b..68567e83c 100644 --- a/src/game/version.h +++ b/src/game/version.h @@ -3,8 +3,8 @@ #ifndef GAME_VERSION_H #define GAME_VERSION_H #include "generated/nethash.cpp" -#define GAME_VERSION "0.6.3, 10.8.5" +#define GAME_VERSION "0.6.3, 10.8.6" #define GAME_NETVERSION "0.6 626fce9a778df4d4" -#define GAME_RELEASE_VERSION "10.8.5" -#define CLIENT_VERSIONNR 10085 +#define GAME_RELEASE_VERSION "10.8.6" +#define CLIENT_VERSIONNR 10086 #endif From 73d9ad76151f8d3c0a77b3dc8c97999e5126a959 Mon Sep 17 00:00:00 2001 From: def Date: Fri, 8 Sep 2017 22:16:00 +0200 Subject: [PATCH 10/10] Really only download ddnet-info.json at correct time --- src/engine/client/client.cpp | 2 ++ src/game/client/components/menus.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index e54d07d35..b59052b1f 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2691,6 +2691,8 @@ void CClient::Run() LoadDDNetInfo(); // but still request the new one from server if(g_Config.m_ClShowWelcome) + g_Config.m_ClShowWelcome = 0; + else RequestDDNetInfo(); bool LastD = false; diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 68ff8febe..53507eb9b 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -926,7 +926,6 @@ void CMenus::OnInit() if(g_Config.m_ClShowWelcome) m_Popup = POPUP_LANGUAGE; - g_Config.m_ClShowWelcome = 0; Console()->Chain("add_favorite", ConchainServerbrowserUpdate, this); Console()->Chain("remove_favorite", ConchainServerbrowserUpdate, this);