diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 32e5e6591..a1f3df8aa 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -106,6 +106,7 @@ ENDIF(WIN32) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) +FIND_PACKAGE(GIF) FIND_PACKAGE(Jpeg) IF(WITH_STATIC_LIBXML2) @@ -161,9 +162,9 @@ IF(WITH_NEL) IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) SET(CURL_STATIC ON) - ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + ELSE() SET(CURL_STATIC OFF) - ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + ENDIF() IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) @@ -175,15 +176,23 @@ IF(WITH_NEL) SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) ENDIF(OPENSSL_FOUND) - # CURL Macports version depends on libidn, libintl and libiconv too - IF(APPLE) + IF(UNIX) + # CURL depends on libidn FIND_LIBRARY(IDN_LIBRARY idn) - FIND_LIBRARY(INTL_LIBRARY intl) - - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) - ENDIF(APPLE) - ENDIF(CURL_STATIC) - ENDIF(WITH_GUI) + IF(IDN_LIBRARY) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY}) + ENDIF() + + # CURL Macports version depends on libidn, libintl and libiconv too + IF(APPLE) + FIND_LIBRARY(INTL_LIBRARY intl) + IF(INTL_LIBRARY) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) + ENDIF() + ENDIF() + ENDIF() + ENDIF() + ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 5d6086bc6..2e161d3b6 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -8,7 +8,7 @@ # EXTERNAL_FOUND - True if the external libraries are available SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH}) -SET(EXTERNAL_TEMP_FILE "include/wwwconf.h") +SET(EXTERNAL_TEMP_FILE "include/zlib.h") SET(EXTERNAL_NAME "external") # If using STLport preprend external_stlport @@ -38,35 +38,35 @@ IF(EXTERNAL_PATH) # Using 32 or 64 bits binaries IF(TARGET_X64 AND WIN32) SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64") - ELSE(TARGET_X64 AND WIN32) + ELSE() SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin") - ENDIF(TARGET_X64 AND WIN32) + ENDIF() # Using 32 or 64 bits libraries IF(TARGET_X64 AND WIN32) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") - ELSE(TARGET_X64 AND WIN32) + ELSE() SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib") - ENDIF(TARGET_X64 AND WIN32) + ENDIF() SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}") # Stupid hack for FindOpenAL.cmake SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}") SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}") -ENDIF(EXTERNAL_PATH) +ENDIF() IF(EXTERNAL_FOUND) IF(NOT External_FIND_QUIETLY) MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}") - ENDIF(NOT External_FIND_QUIETLY) + ENDIF() ELSE(EXTERNAL_FOUND) IF(External_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!") - ELSE(External_FIND_REQUIRED) + ELSE() IF(NOT External_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!") - ENDIF(NOT External_FIND_QUIETLY) - ENDIF(External_FIND_REQUIRED) -ENDIF(EXTERNAL_FOUND) + ENDIF() + ENDIF() +ENDIF() MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH) diff --git a/code/CMakeModules/FindLua53.cmake b/code/CMakeModules/FindLua53.cmake new file mode 100644 index 000000000..45fdcf630 --- /dev/null +++ b/code/CMakeModules/FindLua53.cmake @@ -0,0 +1,81 @@ +# Locate Lua library +# This module defines +# LUA53_FOUND, if false, do not try to link to Lua +# LUA_LIBRARIES +# LUA_INCLUDE_DIR, where to find lua.h +# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES include/lua53 include/lua5.3 include/lua-5.3 include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(LUA_LIBRARY + NAMES lua53 lua5.3 lua-5.3 lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) + +if(LUA_LIBRARY) + # include the math library for Unix + if(UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() + +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") + + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52 + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) + diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index 73255077a..6795a5089 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -42,20 +42,22 @@ MACRO(FIND_CORRECT_LUA_VERSION) ENDIF(LUALIB_FOUND) ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") # TODO: find a way to detect Lua version - IF(WITH_LUA52) + IF(WITH_LUA53) + FIND_PACKAGE(Lua53 REQUIRED) + ELSEIF(WITH_LUA52) FIND_PACKAGE(Lua52 REQUIRED) ELSEIF(WITH_LUA51) FIND_PACKAGE(Lua51 REQUIRED) - ELSE(WITH_LUA52) + ELSE() FIND_PACKAGE(Lua50 REQUIRED) - ENDIF(WITH_LUA52) - ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") -ENDMACRO(FIND_CORRECT_LUA_VERSION) + ENDIF() + ENDIF() +ENDMACRO() IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) # in cache already SET(Luabind_FIND_QUIETLY TRUE) -ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) +ENDIF() FIND_PATH(LUABIND_INCLUDE_DIR luabind/luabind.hpp @@ -72,11 +74,21 @@ FIND_PATH(LUABIND_INCLUDE_DIR SET(LIBRARY_NAME_RELEASE) SET(LIBRARY_NAME_DEBUG) +IF(WITH_LUA53) + IF(WITH_STLPORT) + LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua53) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua53d) + ENDIF() + + LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua53) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua53d) +ENDIF() + IF(WITH_LUA52) IF(WITH_STLPORT) LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52) LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d) - ENDIF(WITH_STLPORT) + ENDIF() LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52) LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index dbcb48931..bdc940090 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -251,10 +251,10 @@ MACRO(USE_CURRENT_WINSDK) SET(WINSDK_VERSION "6.1") ELSEIF(WINSDK6.0_FOUND) SET(WINSDK_VERSION "6.0") - ELSE(WINSDK7.1_FOUND) + ELSE() MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.") - ENDIF(WINSDK7.1_FOUND) - ENDIF(NOT WINSDK_VERSION) + ENDIF() + ENDIF() # Look for correct registered Windows SDK version FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 97b5ed88d..005d430d2 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -10,22 +10,22 @@ IF(MSVC) SET(PCHSupport_FOUND TRUE) -ELSE(MSVC) +ELSE() IF(CMAKE_COMPILER_IS_GNUCXX) EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE gcc_compiler_version) - IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?") + IF(gcc_compiler_version VERSION_LESS "4.2") SET(PCHSupport_FOUND FALSE) - ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?") + ELSE() SET(PCHSupport_FOUND TRUE) - ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?") - ELSE(CMAKE_COMPILER_IS_GNUCXX) + ENDIF() + ELSE() # TODO: make tests for other compilers than GCC SET(PCHSupport_FOUND TRUE) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) -ENDIF(MSVC) + ENDIF() +ENDIF() # Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs MACRO(PCH_SET_COMPILE_FLAGS _target) @@ -40,19 +40,19 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) GET_TARGET_PROPERTY(_targetType ${_target} TYPE) - IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY") LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") - ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + ELSE() GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE) IF(_pic) LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}") - ENDIF(_pic) - ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + ENDIF() + ENDIF() GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES) FOREACH(item ${DIRINC}) LIST(APPEND _FLAGS " -I\"${item}\"") - ENDFOREACH(item) + ENDFOREACH() # Required for CMake 2.6 SET(GLOBAL_DEFINITIONS) @@ -60,61 +60,64 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) IF(oldProps) LIST(APPEND _FLAGS " ${oldProps}") - ENDIF(oldProps) + ENDIF() GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) IF(oldPropsBuild) LIST(APPEND _FLAGS " ${oldPropsBuild}") - ENDIF(oldPropsBuild) + ENDIF() GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) IF(DIRINC) FOREACH(item ${DIRINC}) LIST(APPEND _FLAGS " -I\"${item}\"") - ENDFOREACH(item) - ENDIF(DIRINC) + ENDFOREACH() + ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD}) IF(DEFINITIONS) FOREACH(item ${DEFINITIONS}) LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) - ENDIF(DEFINITIONS) + ENDFOREACH() + ENDIF() - GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) - GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") - LIST(APPEND _FLAGS " ${_directory_flags}") - LIST(APPEND _FLAGS " ${_directory_definitions}") + + IF(CMAKE_VERSION VERSION_LESS "3.3.0") + GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) + GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) + LIST(APPEND _FLAGS " ${_directory_flags}") + LIST(APPEND _FLAGS " ${_directory_definitions}") + ENDIF() # Format definitions IF(MSVC) # Fix path with space SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}") - ELSE(MSVC) + ELSE() STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) SEPARATE_ARGUMENTS(_FLAGS) - ENDIF(MSVC) + ENDIF() IF(CLANG) # Determining all architectures and get common flags @@ -127,11 +130,11 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND PCH_ARCHS ${item}) STRING(TOUPPER "${item}" _UPPER_ARCH) SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) - ENDIF(ITEM_FOUND EQUAL -1) + ENDIF() SET(_ARCH_NEXT OFF) ELSEIF(_XARCH_NEXT) SET(_XARCH_NEXT OFF) - ELSE(_ARCH_NEXT) + ELSE() IF(item MATCHES "^-arch") SET(_ARCH_NEXT ON) ELSEIF(item MATCHES "^-Xarch_") @@ -141,13 +144,13 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND PCH_ARCHS ${item}) STRING(TOUPPER "${item}" _UPPER_ARCH) SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) - ENDIF(ITEM_FOUND EQUAL -1) + ENDIF() SET(_XARCH_NEXT ON) - ELSE(item MATCHES "^-arch") + ELSE() LIST(APPEND PCH_FLAGS ${item}) - ENDIF(item MATCHES "^-arch") - ENDIF(_ARCH_NEXT) - ENDFOREACH(item) + ENDIF() + ENDIF() + ENDFOREACH() # Get architcture specific flags SET(_XARCH_NEXT) @@ -156,25 +159,25 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH) LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item}) SET(_XARCH_NEXT OFF) - ELSE(_XARCH_NEXT) + ELSE() IF(item MATCHES "^-Xarch_") STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT) - ENDIF(item MATCHES "^-Xarch_") - ENDIF(_XARCH_NEXT) - ENDFOREACH(item) + ENDIF() + ENDIF() + ENDFOREACH() # Remove duplicated architectures IF(_ARCHS AND PCH_ARCHS) LIST(REMOVE_DUPLICATES PCH_ARCHS) - ENDIF(_ARCHS AND PCH_ARCHS) - ELSE(CLANG) + ENDIF() + ELSE() SET(PCH_FLAGS ${_FLAGS}) - ENDIF(CLANG) + ENDIF() IF(PCH_FLAGS) LIST(REMOVE_DUPLICATES PCH_FLAGS) - ENDIF(PCH_FLAGS) -ENDMACRO(PCH_SET_COMPILE_FLAGS) + ENDIF() +ENDMACRO() MACRO(GET_PDB_FILENAME _out_filename _target) # determine output directory based on target type @@ -201,9 +204,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) IF(CMAKE_CXX_COMPILER_ARG1) # remove leading space in compiler argument STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) - ELSE(CMAKE_CXX_COMPILER_ARG1) + ELSE() SET(pchsupport_compiler_cxx_arg1 "") - ENDIF(CMAKE_CXX_COMPILER_ARG1) + ENDIF() IF(MSVC) GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) @@ -211,16 +214,16 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) # Ninja PCH Support # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj") - ELSE(MSVC) + ELSE() SET(HEADER_FORMAT "c++-header") SET(_FLAGS "") IF(APPLE) SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch) - ENDIF(APPLE) + ENDIF() SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) - ENDIF(MSVC) -ENDMACRO(PCH_SET_COMPILE_COMMAND) + ENDIF() +ENDMACRO() MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch") @@ -230,14 +233,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) GET_FILENAME_COMPONENT(_name ${_input} NAME_WE) SET(PCH_INPUT ${_input}) SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch") - ELSE(MSVC) + ELSE() IF(NOT "${_arch}" STREQUAL "") SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}") - ENDIF(NOT "${_arch}" STREQUAL "") + ENDIF() IF(NOT "${_language}" STREQUAL "") SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}") - ENDIF(NOT "${_language}" STREQUAL "") + ENDIF() GET_FILENAME_COMPONENT(_name ${_input} NAME) @@ -251,14 +254,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) IF(CLANG) SET(PCH_EXT "pth") - ELSE(CLANG) + ELSE() SET(PCH_EXT "gch") - ENDIF(CLANG) + ENDIF() # For GCC and Clang, PCH needs to be in the same directory as .h SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}") - ENDIF(MSVC) -ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT) + ENDIF() +ENDMACRO() # Add common flags MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) @@ -266,7 +269,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) IF(${oldProps} MATCHES NOTFOUND) SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) + ENDIF() IF(MSVC) SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"") @@ -279,17 +282,17 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS) IF(NOT _STATIC_LIBRARY_FLAGS) SET(_STATIC_LIBRARY_FLAGS) - ENDIF(NOT _STATIC_LIBRARY_FLAGS) + ENDIF() SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}") GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS) IF(NOT _LINK_FLAGS) SET(_LINK_FLAGS) - ENDIF(NOT _LINK_FLAGS) + ENDIF() SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS}) - ELSE(MSVC) + ELSE() # for use with distcc and gcc >4.0.1 if preprocessed files are accessible # on all remote machines set # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess @@ -299,21 +302,21 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) # If no arch is specified, create common flags IF(PCH_ARCHS_COUNT LESS 2) SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}") - ENDIF(PCH_ARCHS_COUNT LESS 2) + ENDIF() IF(APPLE) SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") - ENDIF(APPLE) + ENDIF() IF(WITH_PCH_DEBUG) SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}") - ENDIF(WITH_PCH_DEBUG) + ENDIF() SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch") - ENDIF(MSVC) + ENDIF() SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags}) -ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET) +ENDMACRO() # Add specific flags for an arch MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch) @@ -324,19 +327,19 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch) IF(${_FLAGS} MATCHES NOTFOUND) SET(_FLAGS "") - ENDIF(${_FLAGS} MATCHES NOTFOUND) + ENDIF() SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS}) - ENDIF(PCH_ARCHS_COUNT GREATER 1) -ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH) + ENDIF() +ENDMACRO() MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH) ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT}) ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT}) ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH}) -ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp) +ENDMACRO() MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET(_PCH_current_target ${_targetName}) @@ -346,7 +349,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) "This is the ADD_PRECOMPILED_HEADER macro. " "You must set CMAKE_BUILD_TYPE!" ) - ENDIF(NOT CMAKE_BUILD_TYPE) + ENDIF() PCH_SET_COMPILE_FLAGS(${_targetName}) @@ -362,25 +365,25 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH}) ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH}) - ENDFOREACH(_ARCH) - ELSE(PCH_ARCHS) + ENDFOREACH() + ELSE() PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "") LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}") PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch) - ENDIF(PCH_ARCHS) + ENDIF() ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName}) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}") -ENDMACRO(ADD_PRECOMPILED_HEADER) +ENDMACRO() MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) IF(NOT PCHSupport_FOUND) MESSAGE(STATUS "PCH disabled because compiler doesn't support them") RETURN() - ENDIF(NOT PCHSupport_FOUND) + ENDIF() # 0 => creating a new target for PCH, works for all makefiles # 1 => setting PCH for VC++ project, works for VC++ projects @@ -389,9 +392,9 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET(PCH_METHOD 1) ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") SET(PCH_METHOD 2) - ELSE(CMAKE_GENERATOR MATCHES "Visual Studio") + ELSE() SET(PCH_METHOD 0) - ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") + ENDIF() IF(PCH_METHOD EQUAL 1) # Auto include the precompile (useful for moc processing, since the use of @@ -401,7 +404,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) IF(${oldProps} MATCHES NOTFOUND) SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) + ENDIF() SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") @@ -418,12 +421,12 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") - ELSE(PCH_METHOD EQUAL 1) + ELSE() #Fallback to the "old" precompiled suppport ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) - ENDIF(PCH_METHOD EQUAL 1) + ENDIF() IF(TARGET ${_targetName}_static) ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp}) - ENDIF(TARGET ${_targetName}_static) -ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) + ENDIF() +ENDMACRO() diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 28e36bd61..802458ca3 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -102,10 +102,10 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) - IF(HAVE_REVISION_H) + IF(TARGET revision) # explicitly say that the target depends on revision.h ADD_DEPENDENCIES(${name} revision) - ENDIF(HAVE_REVISION_H) + ENDIF() # Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name. # CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819 @@ -375,6 +375,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) ### OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON ) OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF) + OPTION(WITH_LUA53 "Build Ryzom Core using Lua 5.3" OFF) OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) diff --git a/code/nel/include/nel/3d/index_buffer.h b/code/nel/include/nel/3d/index_buffer.h index d5872f5e9..3d9c289ee 100644 --- a/code/nel/include/nel/3d/index_buffer.h +++ b/code/nel/include/nel/3d/index_buffer.h @@ -429,7 +429,7 @@ private: void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);} // Force non resident memory - void restaureNonResidentMemory(); + void restoreNonResidentMemory(); // Convert current index to a serializable vector void buildSerialVector(std::vector &dest) const; diff --git a/code/nel/include/nel/3d/vertex_buffer.h b/code/nel/include/nel/3d/vertex_buffer.h index 6c269ec6c..1f1c789ae 100644 --- a/code/nel/include/nel/3d/vertex_buffer.h +++ b/code/nel/include/nel/3d/vertex_buffer.h @@ -653,7 +653,7 @@ private: void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);} // Force non resident memory - void restaureNonResidentMemory(); + void restoreNonResidentMemory(); private: diff --git a/code/nel/include/nel/gui/ctrl_base.h b/code/nel/include/nel/gui/ctrl_base.h index 3b522e114..35148b5b0 100644 --- a/code/nel/include/nel/gui/ctrl_base.h +++ b/code/nel/include/nel/gui/ctrl_base.h @@ -151,8 +151,12 @@ namespace NLGUI // called when keyboard capture has been lost virtual void onKeyboardCaptureLost() {} + // 'tooltip' property expects string to be ucstring or latin1 which is not possible from html page + int luaSetTooltipUtf8(CLuaState &ls); + REFLECT_EXPORT_START(CCtrlBase, CViewBase) REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp); + REFLECT_LUA_METHOD("setTooltipUtf8", luaSetTooltipUtf8); REFLECT_EXPORT_END // special for mouse over : return true and fill the name of the cursor to display diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index bafa63348..bdec4009e 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -64,8 +64,10 @@ namespace NLGUI std::string languageCode; /// List of domains the widget can consider secure. std::vector< std::string > trustedDomains; + /// Maximum concurrent MultiCurl connections per CGroupHTML instance + sint32 curlMaxConnections; - SWebOptions() + SWebOptions(): curlMaxConnections(2) { } }; @@ -366,7 +368,7 @@ namespace NLGUI bool _Connecting; double _TimeoutValue; // the timeout in seconds double _ConnectingTimeout; - uint32 _RedirectsRemaining; + sint _RedirectsRemaining; // minimal embeded lua script support // Note : any embeded script is executed immediately after the closing diff --git a/code/nel/include/nel/gui/lua_helper.h b/code/nel/include/nel/gui/lua_helper.h index 69639fc04..50896b30c 100644 --- a/code/nel/include/nel/gui/lua_helper.h +++ b/code/nel/include/nel/gui/lua_helper.h @@ -239,6 +239,7 @@ namespace NLGUI bool isNil(int index = -1); bool isBoolean(int index = -1); bool isNumber(int index = -1); + bool isInteger(int index = -1); bool isString(int index = -1); bool isTable(int index = -1); bool isFunction(int index = -1); @@ -248,6 +249,7 @@ namespace NLGUI // converting then getting a value from the stack bool toBoolean(int index = -1); lua_Number toNumber(int index = -1); + lua_Integer toInteger(int index = -1); const char *toString(int index = -1); void toString(int index, std::string &str); // convert to a std::string, with a NULL check. size_t strlen(int index = -1); @@ -259,11 +261,21 @@ namespace NLGUI * If conversion fails then an exception is thrown (with optional msg) */ bool getTableBooleanValue(const char *name, bool defaultValue= false); - double getTableNumberValue(const char *name, double defaultValue= 0); + double getTableNumberValue(const char *name, double defaultValue= 0.0); + sint64 getTableIntegerValue(const char *name, sint64 defaultValue= 0); const char *getTableStringValue(const char *name, const char *defaultValue= NULL); // pushing value onto the stack void push(bool value); - void push(lua_Number value); + void push(float value); + void push(double value); + void push(uint8 value); + void push(uint16 value); + void push(uint32 value); + void push(uint64 value); + void push(sint8 value); + void push(sint16 value); + void push(sint32 value); + void push(sint64 value); void push(const char *str); void push(const char *str, int length); void push(const std::string &str); diff --git a/code/nel/include/nel/gui/lua_helper_inline.h b/code/nel/include/nel/gui/lua_helper_inline.h index 01afd142f..68721cfaa 100644 --- a/code/nel/include/nel/gui/lua_helper_inline.h +++ b/code/nel/include/nel/gui/lua_helper_inline.h @@ -172,6 +172,18 @@ inline bool CLuaState::isNumber(int index) return lua_isnumber(_State, index) != 0; } +//================================================================================ +inline bool CLuaState::isInteger(int index) +{ + //H_AUTO(Lua_CLuaState_isInteger) + checkIndex(index); +#if LUA_VERSION_NUM >= 503 + return lua_isinteger(_State, index) != 0; +#else + return lua_isnumber(_State, index) != 0; +#endif +} + //================================================================================ inline bool CLuaState::isString(int index) { @@ -236,6 +248,14 @@ inline lua_Number CLuaState::toNumber(int index) return lua_tonumber(_State, index); } +//================================================================================ +inline lua_Integer CLuaState::toInteger(int index) +{ + //H_AUTO(Lua_CLuaState_toInteger) + checkIndex(index); + return lua_tointeger(_State, index); +} + //================================================================================ inline const char *CLuaState::toString(int index) { @@ -302,11 +322,83 @@ inline void CLuaState::push(bool value) } //================================================================================ -inline void CLuaState::push(lua_Number value) +inline void CLuaState::push(float value) { //H_AUTO(Lua_CLuaState_push) nlverify( lua_checkstack(_State, 1) ); - lua_pushnumber(_State, value); + lua_pushnumber(_State, (lua_Number)value); +} + +//================================================================================ +inline void CLuaState::push(double value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushnumber(_State, (lua_Number)value); +} + +//================================================================================ +inline void CLuaState::push(uint8 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(uint16 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(uint32 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(uint64 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(sint8 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(sint16 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(sint32 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); +} + +//================================================================================ +inline void CLuaState::push(sint64 value) +{ + //H_AUTO(Lua_CLuaState_push) + nlverify( lua_checkstack(_State, 1) ); + lua_pushinteger(_State, (lua_Integer)value); } //================================================================================ diff --git a/code/nel/include/nel/gui/lua_manager.h b/code/nel/include/nel/gui/lua_manager.h index 00aecbe84..01c123f55 100644 --- a/code/nel/include/nel/gui/lua_manager.h +++ b/code/nel/include/nel/gui/lua_manager.h @@ -31,8 +31,8 @@ namespace NLGUI class CLuaManager { public: - ~CLuaManager(); + /// Get or create singleton static CLuaManager& getInstance() { if( instance == NULL ) @@ -42,6 +42,9 @@ namespace NLGUI return *instance; } + /// Release singleton + static void releaseInstance(); + /// Enables attaching the Lua debugger in the CLuaState instance, only matters on startup. static void enableLuaDebugging(){ debugLua = true; } @@ -65,6 +68,7 @@ namespace NLGUI private: CLuaManager(); + ~CLuaManager(); static CLuaManager *instance; static bool debugLua; diff --git a/code/nel/include/nel/gui/lua_object.h b/code/nel/include/nel/gui/lua_object.h index 2360f1609..1d3b0d64c 100644 --- a/code/nel/include/nel/gui/lua_object.h +++ b/code/nel/include/nel/gui/lua_object.h @@ -80,6 +80,7 @@ namespace NLGUI const char *getTypename() const; bool isNil() const; bool isNumber() const; + bool isInteger() const; bool isBoolean() const; bool isString() const; bool isFunction() const; @@ -94,6 +95,7 @@ namespace NLGUI NLMISC::CRGBA toRGBA() const; // default to black if not a crgba bool toBoolean() const; lua_Number toNumber() const; + lua_Integer toInteger() const; std::string toString() const; lua_CFunction toCFunction() const; void *toUserData() const; @@ -102,6 +104,8 @@ namespace NLGUI operator bool() const; operator float() const; operator double() const; + operator sint32() const; + operator sint64() const; operator std::string() const; /** create a sub table for this object, with a string as a key * This object must be a table or an exception if thrown @@ -121,6 +125,9 @@ namespace NLGUI void setValue(const char *key, bool value) throw(ELuaNotATable); void setValue(const char *key, TLuaWrappedFunction value) throw(ELuaNotATable); void setValue(const char *key, double value) throw(ELuaNotATable); + void setValue(const char *key, uint32 value) throw(ELuaNotATable); + void setValue(const char *key, sint32 value) throw(ELuaNotATable); + void setValue(const char *key, sint64 value) throw(ELuaNotATable); void setValue(const std::string &key, const std::string &value) throw(ELuaNotATable) { setValue(key.c_str(), value); } void setNil(const char *key) throw(ELuaNotATable); void setNil(const std::string &key) throw(ELuaNotATable) { setNil(key.c_str()); } diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 6d2336047..c30bdd663 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -569,7 +569,7 @@ namespace NLGUI std::vector< CInterfaceGroup* > _GroupsUnderPointer; // view that should be notified from clock msg - std::vector _ClockMsgTargets; + std::list _ClockMsgTargets; NLMISC::CRGBA _GlobalColor; NLMISC::CRGBA _GlobalColorForContent; diff --git a/code/nel/include/nel/misc/bitmap.h b/code/nel/include/nel/misc/bitmap.h index 0b6940629..408b2fd27 100644 --- a/code/nel/include/nel/misc/bitmap.h +++ b/code/nel/include/nel/misc/bitmap.h @@ -44,6 +44,7 @@ const uint32 DDS_HEADER = NL_MAKEFOURCC('D', 'D', 'S', ' '); const uint32 DXT_HEADER = NL_MAKEFOURCC('D', 'X', 'T', '\0'); const uint32 PNG_HEADER = NL_MAKEFOURCC(0x89, 'P', 'N', 'G'); const uint32 JPG_HEADER = NL_MAKEFOURCC(0xff, 0xd8, 0xff, 0xe0); +const uint32 GIF_HEADER = NL_MAKEFOURCC('G', 'I', 'F', '8'); // dwLinearSize is valid @@ -132,6 +133,15 @@ private : uint8 readJPG( NLMISC::IStream &f ); + /** + * Read a GIF from an IStream. + * GIF pictures are all converted to 32bit + * \param f IStream (must be a reading stream) + * \return image depth if succeed, 0 else + */ + uint8 readGIF( NLMISC::IStream &f ); + + /** * Change bitmap format * diff --git a/code/nel/include/nel/misc/i18n.h b/code/nel/include/nel/misc/i18n.h index 5f98c5f34..1102a8907 100644 --- a/code/nel/include/nel/misc/i18n.h +++ b/code/nel/include/nel/misc/i18n.h @@ -104,6 +104,11 @@ public: */ static const std::vector &getLanguageCodes(); + /** Check if a language code is supported. + * Code are ISO 639-2 compliant. + */ + static bool isLanguageCodeSupported(const std::string &lang); + /// Load a language file depending of the language code("en", "fr", ...). Code are ISO 639-2 compliant. static void load (const std::string &languageCode, const std::string &fallbackLanguageCode=""); @@ -119,6 +124,9 @@ public: /// Returns the code of the language ("fr", "en", ...) static std::string getCurrentLanguageCode (); + /// Returns the code of the language ("fr", "en", ...) defined on system + static std::string getSystemLanguageCode (); + /// Find a string in the selected language and return his association. static const ucstring &get (const std::string &label); diff --git a/code/nel/src/3d/cloud.cpp b/code/nel/src/3d/cloud.cpp index 2606f9ad5..eb53589ce 100644 --- a/code/nel/src/3d/cloud.cpp +++ b/code/nel/src/3d/cloud.cpp @@ -178,7 +178,7 @@ void CCloud::generate (CNoise3d &noise) _Driver->activeVertexBuffer (rVB); _Driver->renderRawQuads (_CloudTexClamp->ToClamp, 0, 1); - // Restaure render target + // Restore render target _Driver->setRenderTarget (NULL); _CloudTexTmp->Tex->setFilterMode (ITexture::Nearest, ITexture::NearestMipMapOff); @@ -685,7 +685,7 @@ void CCloud::genBill (CCamera *pCam, uint32 nBillSize) dispXYZ (&_CloudTexTmp->ToBill); - // Restaure render target + // Restore render target _Driver->setRenderTarget (NULL); // This is the end of render to texture like so reset all stuff diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 8a7be80d2..5ffaceda6 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1912,7 +1912,7 @@ bool CDriverD3D::clear2D(CRGBA rgba) bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_TARGET, NL_D3DCOLOR_RGBA(rgba), 1.0f, 0 ) == D3D_OK; - // Restaure the old viewport + // Restore the old viewport setupViewport (oldViewport); return result; } @@ -1931,7 +1931,7 @@ bool CDriverD3D::clearZBuffer(float zval) bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0,0,0,0), zval, 0 ) == D3D_OK; - // Restaure the old viewport + // Restore the old viewport setupViewport (oldViewport); // NVidia driver 56.72 needs to reset the vertex buffer after a clear Z @@ -1954,7 +1954,7 @@ bool CDriverD3D::clearStencilBuffer(float stencilval) bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_STENCIL, D3DCOLOR_ARGB(0,0,0,0), 1.0f, (unsigned long)stencilval ) == D3D_OK; - // Restaure the old viewport + // Restore the old viewport setupViewport (oldViewport); return result; @@ -2526,7 +2526,7 @@ bool CDriverD3D::reset (const GfxMode& mode) _CurrentMaterial = NULL; _CurrentMaterialInfo = NULL; - // Restaure non managed vertex buffer in system memory + // Restore non managed vertex buffer in system memory ItVBDrvInfoPtrList iteVb = _VBDrvInfos.begin(); while (iteVb != _VBDrvInfos.end()) { diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.def b/code/nel/src/3d/driver/direct3d/driver_direct3d.def index 7e6b29b2e..e52ed712d 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.def +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.def @@ -1,4 +1,3 @@ -LIBRARY nel_drv_direct3d_win_r EXPORTS NL3D_createIDriverInstance NL3D_interfaceVersion \ No newline at end of file diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp index b75a21d9d..dfdc48670 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_index.cpp @@ -49,7 +49,7 @@ uint indexCount=0; CIBDrvInfosD3D::~CIBDrvInfosD3D() { H_AUTO_D3D(CIBDrvInfosD3D_CIBDrvInfosD3DDtor); - // Restaure non resident memory + // Restore non resident memory if (IndexBufferPtr) { IndexBufferPtr->setLocation(CIndexBuffer::NotResident); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index f22cba111..1e8878fb9 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -818,7 +818,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) if (_CurrentMaterial != &mat) { // Material has changed ? - // Restaure fog state to its current value + // Restore fog state to its current value { H_AUTO_D3D(CDriverD3D_setupMaterial_updateFog) setRenderState (D3DRS_FOGENABLE, _FogEnabled?TRUE:FALSE); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp index d37c272a2..ad5bb04b9 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp @@ -63,7 +63,7 @@ CVBDrvInfosD3D::~CVBDrvInfosD3D() { H_AUTO_D3D(CVBDrvInfosD3D_CVBDrvInfosD3D) CDriverD3D *driver = static_cast(_Driver); - // Restaure non resident memory + // Restore non resident memory if (VertexBufferPtr) { VertexBufferPtr->setLocation(CVertexBuffer::NotResident); diff --git a/code/nel/src/3d/driver/opengl/GL/glext.h b/code/nel/src/3d/driver/opengl/GL/glext.h index f2844e170..ea6c7c396 100644 --- a/code/nel/src/3d/driver/opengl/GL/glext.h +++ b/code/nel/src/3d/driver/opengl/GL/glext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. +** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -33,7 +33,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $ +** Khronos $Revision: 32155 $ on $Date: 2015-10-22 23:25:39 -0400 (Thu, 22 Oct 2015) $ */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -53,7 +53,7 @@ extern "C" { #define GLAPI extern #endif -#define GL_GLEXT_VERSION 20140416 +#define GL_GLEXT_VERSION 20151022 /* Generated C header for: * API: gl @@ -1041,6 +1041,22 @@ typedef unsigned short GLhalf; #define GL_COLOR_ATTACHMENT13 0x8CED #define GL_COLOR_ATTACHMENT14 0x8CEE #define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_COLOR_ATTACHMENT16 0x8CF0 +#define GL_COLOR_ATTACHMENT17 0x8CF1 +#define GL_COLOR_ATTACHMENT18 0x8CF2 +#define GL_COLOR_ATTACHMENT19 0x8CF3 +#define GL_COLOR_ATTACHMENT20 0x8CF4 +#define GL_COLOR_ATTACHMENT21 0x8CF5 +#define GL_COLOR_ATTACHMENT22 0x8CF6 +#define GL_COLOR_ATTACHMENT23 0x8CF7 +#define GL_COLOR_ATTACHMENT24 0x8CF8 +#define GL_COLOR_ATTACHMENT25 0x8CF9 +#define GL_COLOR_ATTACHMENT26 0x8CFA +#define GL_COLOR_ATTACHMENT27 0x8CFB +#define GL_COLOR_ATTACHMENT28 0x8CFC +#define GL_COLOR_ATTACHMENT29 0x8CFD +#define GL_COLOR_ATTACHMENT30 0x8CFE +#define GL_COLOR_ATTACHMENT31 0x8CFF #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 #define GL_FRAMEBUFFER 0x8D40 @@ -1308,11 +1324,13 @@ GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #define GL_UNIFORM_BUFFER_START 0x8A29 #define GL_UNIFORM_BUFFER_SIZE 0x8A2A #define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C #define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D #define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E #define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F #define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 #define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 #define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 #define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 #define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 @@ -1331,6 +1349,7 @@ GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 #define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 #define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 #define GL_INVALID_INDEX 0xFFFFFFFFu typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); @@ -2041,6 +2060,10 @@ GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data) #ifndef GL_VERSION_4_2 #define GL_VERSION_4_2 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 #define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 #define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 #define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 @@ -2212,6 +2235,7 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum #define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED #define GL_DISPATCH_INDIRECT_BUFFER 0x90EE #define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 @@ -2571,10 +2595,297 @@ GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLui #endif #endif /* GL_VERSION_4_4 */ +#ifndef GL_VERSION_4_5 +#define GL_VERSION_4_5 1 +#define GL_CONTEXT_LOST 0x0507 +#define GL_NEGATIVE_ONE_TO_ONE 0x935E +#define GL_ZERO_TO_ONE 0x935F +#define GL_CLIP_ORIGIN 0x935C +#define GL_CLIP_DEPTH_MODE 0x935D +#define GL_QUERY_WAIT_INVERTED 0x8E17 +#define GL_QUERY_NO_WAIT_INVERTED 0x8E18 +#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19 +#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A +#define GL_MAX_CULL_DISTANCES 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA +#define GL_TEXTURE_TARGET 0x1006 +#define GL_QUERY_TARGET 0x82EA +#define GL_GUILTY_CONTEXT_RESET 0x8253 +#define GL_INNOCENT_CONTEXT_RESET 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET 0x8252 +#define GL_NO_RESET_NOTIFICATION 0x8261 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004 +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth); +typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers); +typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNMAPDVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLGETNMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth); +GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param); +GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param); +GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers); +GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access); +GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer); +GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf); +GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src); +GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures); +GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param); +GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture); +GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture); +GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params); +GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays); +GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer); +GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param); +GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers); +GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids); +GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset); +GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); +GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels); +GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void); +GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels); +GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnMapdv (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfv (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapiv (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfv (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuiv (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusv (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStipple (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTable (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI void APIENTRY glGetnConvolutionFilter (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI void APIENTRY glGetnSeparableFilter (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI void APIENTRY glGetnHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glGetnMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glTextureBarrier (void); +#endif +#endif /* GL_VERSION_4_5 */ + #ifndef GL_ARB_ES2_compatibility #define GL_ARB_ES2_compatibility 1 #endif /* GL_ARB_ES2_compatibility */ +#ifndef GL_ARB_ES3_1_compatibility +#define GL_ARB_ES3_1_compatibility 1 +#endif /* GL_ARB_ES3_1_compatibility */ + +#ifndef GL_ARB_ES3_2_compatibility +#define GL_ARB_ES3_2_compatibility 1 +#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE +#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381 +#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382 +typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_ARB_ES3_2_compatibility */ + #ifndef GL_ARB_ES3_compatibility #define GL_ARB_ES3_compatibility 1 #endif /* GL_ARB_ES3_compatibility */ @@ -2655,6 +2966,10 @@ GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, s #define GL_ARB_clear_texture 1 #endif /* GL_ARB_clear_texture */ +#ifndef GL_ARB_clip_control +#define GL_ARB_clip_control 1 +#endif /* GL_ARB_clip_control */ + #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float 1 #define GL_RGBA_FLOAT_MODE_ARB 0x8820 @@ -2678,7 +2993,6 @@ GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); #ifndef GL_ARB_compute_shader #define GL_ARB_compute_shader 1 -#define GL_COMPUTE_SHADER_BIT 0x00000020 #endif /* GL_ARB_compute_shader */ #ifndef GL_ARB_compute_variable_group_size @@ -2693,20 +3007,26 @@ GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint n #endif #endif /* GL_ARB_compute_variable_group_size */ +#ifndef GL_ARB_conditional_render_inverted +#define GL_ARB_conditional_render_inverted 1 +#endif /* GL_ARB_conditional_render_inverted */ + #ifndef GL_ARB_conservative_depth #define GL_ARB_conservative_depth 1 #endif /* GL_ARB_conservative_depth */ #ifndef GL_ARB_copy_buffer #define GL_ARB_copy_buffer 1 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 #endif /* GL_ARB_copy_buffer */ #ifndef GL_ARB_copy_image #define GL_ARB_copy_image 1 #endif /* GL_ARB_copy_image */ +#ifndef GL_ARB_cull_distance +#define GL_ARB_cull_distance 1 +#endif /* GL_ARB_cull_distance */ + #ifndef GL_ARB_debug_output #define GL_ARB_debug_output 1 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); @@ -2761,6 +3081,14 @@ GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GL #define GL_DEPTH_TEXTURE_MODE_ARB 0x884B #endif /* GL_ARB_depth_texture */ +#ifndef GL_ARB_derivative_control +#define GL_ARB_derivative_control 1 +#endif /* GL_ARB_derivative_control */ + +#ifndef GL_ARB_direct_state_access +#define GL_ARB_direct_state_access 1 +#endif /* GL_ARB_direct_state_access */ + #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers 1 #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 @@ -2971,6 +3299,10 @@ GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); #define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B #endif /* GL_ARB_fragment_shader */ +#ifndef GL_ARB_fragment_shader_interlock +#define GL_ARB_fragment_shader_interlock 1 +#endif /* GL_ARB_fragment_shader_interlock */ + #ifndef GL_ARB_framebuffer_no_attachments #define GL_ARB_framebuffer_no_attachments 1 #endif /* GL_ARB_framebuffer_no_attachments */ @@ -3019,6 +3351,10 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen #define GL_ARB_get_program_binary 1 #endif /* GL_ARB_get_program_binary */ +#ifndef GL_ARB_get_texture_sub_image +#define GL_ARB_get_texture_sub_image 1 +#endif /* GL_ARB_get_texture_sub_image */ + #ifndef GL_ARB_gpu_shader5 #define GL_ARB_gpu_shader5 1 #endif /* GL_ARB_gpu_shader5 */ @@ -3027,6 +3363,91 @@ GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachmen #define GL_ARB_gpu_shader_fp64 1 #endif /* GL_ARB_gpu_shader_fp64 */ +#ifndef GL_ARB_gpu_shader_int64 +#define GL_ARB_gpu_shader_int64 1 +#define GL_INT64_ARB 0x140E +#define GL_INT64_VEC2_ARB 0x8FE9 +#define GL_INT64_VEC3_ARB 0x8FEA +#define GL_INT64_VEC4_ARB 0x8FEB +#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7 +typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x); +typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y); +typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x); +GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y); +GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z); +GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x); +GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y); +GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params); +GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params); +GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params); +GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x); +GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y); +GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z); +GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w); +GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value); +GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x); +GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y); +GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z); +GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w); +GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value); +#endif +#endif /* GL_ARB_gpu_shader_int64 */ + #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel 1 typedef unsigned short GLhalfARB; @@ -3406,6 +3827,30 @@ GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *par #define GL_ARB_occlusion_query2 1 #endif /* GL_ARB_occlusion_query2 */ +#ifndef GL_ARB_parallel_shader_compile +#define GL_ARB_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0 +#define GL_COMPLETION_STATUS_ARB 0x91B1 +typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count); +#endif +#endif /* GL_ARB_parallel_shader_compile */ + +#ifndef GL_ARB_pipeline_statistics_query +#define GL_ARB_pipeline_statistics_query 1 +#define GL_VERTICES_SUBMITTED_ARB 0x82EE +#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF +#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0 +#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1 +#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2 +#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3 +#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4 +#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5 +#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6 +#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7 +#endif /* GL_ARB_pipeline_statistics_query */ + #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object 1 #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB @@ -3434,6 +3879,10 @@ GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); #define GL_COORD_REPLACE_ARB 0x8862 #endif /* GL_ARB_point_sprite */ +#ifndef GL_ARB_post_depth_coverage +#define GL_ARB_post_depth_coverage 1 +#endif /* GL_ARB_post_depth_coverage */ + #ifndef GL_ARB_program_interface_query #define GL_ARB_program_interface_query 1 #endif /* GL_ARB_program_interface_query */ @@ -3507,6 +3956,26 @@ GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum form #define GL_ARB_robustness_isolation 1 #endif /* GL_ARB_robustness_isolation */ +#ifndef GL_ARB_sample_locations +#define GL_ARB_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340 +#define GL_SAMPLE_LOCATION_ARB 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glEvaluateDepthValuesARB (void); +#endif +#endif /* GL_ARB_sample_locations */ + #ifndef GL_ARB_sample_shading #define GL_ARB_sample_shading 1 #define GL_SAMPLE_SHADING_ARB 0x8C36 @@ -3533,14 +4002,26 @@ GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); #define GL_ARB_separate_shader_objects 1 #endif /* GL_ARB_separate_shader_objects */ +#ifndef GL_ARB_shader_atomic_counter_ops +#define GL_ARB_shader_atomic_counter_ops 1 +#endif /* GL_ARB_shader_atomic_counter_ops */ + #ifndef GL_ARB_shader_atomic_counters #define GL_ARB_shader_atomic_counters 1 #endif /* GL_ARB_shader_atomic_counters */ +#ifndef GL_ARB_shader_ballot +#define GL_ARB_shader_ballot 1 +#endif /* GL_ARB_shader_ballot */ + #ifndef GL_ARB_shader_bit_encoding #define GL_ARB_shader_bit_encoding 1 #endif /* GL_ARB_shader_bit_encoding */ +#ifndef GL_ARB_shader_clock +#define GL_ARB_shader_clock 1 +#endif /* GL_ARB_shader_clock */ + #ifndef GL_ARB_shader_draw_parameters #define GL_ARB_shader_draw_parameters 1 #endif /* GL_ARB_shader_draw_parameters */ @@ -3697,10 +4178,18 @@ GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GL #define GL_ARB_shader_subroutine 1 #endif /* GL_ARB_shader_subroutine */ +#ifndef GL_ARB_shader_texture_image_samples +#define GL_ARB_shader_texture_image_samples 1 +#endif /* GL_ARB_shader_texture_image_samples */ + #ifndef GL_ARB_shader_texture_lod #define GL_ARB_shader_texture_lod 1 #endif /* GL_ARB_shader_texture_lod */ +#ifndef GL_ARB_shader_viewport_layer_array +#define GL_ARB_shader_viewport_layer_array 1 +#endif /* GL_ARB_shader_viewport_layer_array */ + #ifndef GL_ARB_shading_language_100 #define GL_ARB_shading_language_100 1 #define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C @@ -3747,11 +4236,25 @@ GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GL #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #endif /* GL_ARB_shadow_ambient */ +#ifndef GL_ARB_sparse_buffer +#define GL_ARB_sparse_buffer 1 +#define GL_SPARSE_STORAGE_BIT_ARB 0x0400 +#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8 +typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit); +#endif +#endif /* GL_ARB_sparse_buffer */ + #ifndef GL_ARB_sparse_texture #define GL_ARB_sparse_texture 1 #define GL_TEXTURE_SPARSE_ARB 0x91A6 #define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 -#define GL_MIN_SPARSE_LEVEL_ARB 0x919B +#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA #define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 #define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 #define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 @@ -3760,12 +4263,20 @@ GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GL #define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 #define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A #define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 -typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); #endif #endif /* GL_ARB_sparse_texture */ +#ifndef GL_ARB_sparse_texture2 +#define GL_ARB_sparse_texture2 1 +#endif /* GL_ARB_sparse_texture2 */ + +#ifndef GL_ARB_sparse_texture_clamp +#define GL_ARB_sparse_texture_clamp 1 +#endif /* GL_ARB_sparse_texture_clamp */ + #ifndef GL_ARB_stencil_texturing #define GL_ARB_stencil_texturing 1 #endif /* GL_ARB_stencil_texturing */ @@ -3778,6 +4289,10 @@ GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xo #define GL_ARB_tessellation_shader 1 #endif /* GL_ARB_tessellation_shader */ +#ifndef GL_ARB_texture_barrier +#define GL_ARB_texture_barrier 1 +#endif /* GL_ARB_texture_barrier */ + #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp 1 #define GL_CLAMP_TO_BORDER_ARB 0x812D @@ -3914,6 +4429,12 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #define GL_DOT3_RGBA_ARB 0x86AF #endif /* GL_ARB_texture_env_dot3 */ +#ifndef GL_ARB_texture_filter_minmax +#define GL_ARB_texture_filter_minmax 1 +#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366 +#define GL_WEIGHTED_AVERAGE_ARB 0x9367 +#endif /* GL_ARB_texture_filter_minmax */ + #ifndef GL_ARB_texture_float #define GL_ARB_texture_float 1 #define GL_TEXTURE_RED_TYPE_ARB 0x8C10 @@ -4012,8 +4533,6 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #ifndef GL_ARB_transform_feedback2 #define GL_ARB_transform_feedback2 1 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 #endif /* GL_ARB_transform_feedback2 */ #ifndef GL_ARB_transform_feedback3 @@ -4024,6 +4543,12 @@ GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void #define GL_ARB_transform_feedback_instanced 1 #endif /* GL_ARB_transform_feedback_instanced */ +#ifndef GL_ARB_transform_feedback_overflow_query +#define GL_ARB_transform_feedback_overflow_query 1 +#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC +#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED +#endif /* GL_ARB_transform_feedback_overflow_query */ + #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 @@ -4044,9 +4569,6 @@ GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object 1 -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 #endif /* GL_ARB_uniform_buffer_object */ #ifndef GL_ARB_vertex_array_bgra @@ -4371,10 +4893,56 @@ GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); #endif #endif /* GL_ARB_window_pos */ +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#endif /* GL_KHR_context_flush_control */ + #ifndef GL_KHR_debug #define GL_KHR_debug 1 #endif /* GL_KHR_debug */ +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS 0x90F3 +#endif /* GL_KHR_robustness */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -4411,6 +4979,10 @@ GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); #define GL_KHR_texture_compression_astc_ldr 1 #endif /* GL_KHR_texture_compression_astc_ldr */ +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ + #ifndef GL_OES_byte_coordinates #define GL_OES_byte_coordinates 1 typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s); @@ -4429,11 +5001,11 @@ typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords); typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x); +typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x, GLbyte y); typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y); +typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y, GLbyte z); typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords); -typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z, GLbyte w); typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s); @@ -4452,11 +5024,11 @@ GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r); GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords); GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q); GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex2bOES (GLbyte x); +GLAPI void APIENTRY glVertex2bOES (GLbyte x, GLbyte y); GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y); +GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y, GLbyte z); GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords); -GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z, GLbyte w); GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); #endif #endif /* GL_OES_byte_coordinates */ @@ -4508,7 +5080,6 @@ typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfix typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEOESPROC) (GLfixed value, GLboolean invert); typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); @@ -4613,7 +5184,6 @@ GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); GLAPI void APIENTRY glPointSizexOES (GLfixed size); GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GLAPI void APIENTRY glSampleCoverageOES (GLfixed value, GLboolean invert); GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); @@ -4804,6 +5374,10 @@ GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRG #endif #endif /* GL_AMD_draw_buffers_blend */ +#ifndef GL_AMD_gcn_shader +#define GL_AMD_gcn_shader 1 +#endif /* GL_AMD_gcn_shader */ + #ifndef GL_AMD_gpu_shader_int64 #define GL_AMD_gpu_shader_int64 1 typedef int64_t GLint64EXT; @@ -6323,7 +6897,7 @@ typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaob typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); @@ -6579,7 +7153,7 @@ GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint at GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); -GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor); #endif #endif /* GL_EXT_direct_state_access */ @@ -7105,6 +7679,19 @@ GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); #endif #endif /* GL_EXT_polygon_offset */ +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + #ifndef GL_EXT_provoking_vertex #define GL_EXT_provoking_vertex 1 #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C @@ -7117,6 +7704,20 @@ GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); #endif #endif /* GL_EXT_provoking_vertex */ +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 #define GL_RESCALE_NORMAL_EXT 0x803A @@ -7271,6 +7872,10 @@ GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #endif /* GL_EXT_shared_texture_palette */ +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + #ifndef GL_EXT_stencil_clear_tag #define GL_EXT_stencil_clear_tag 1 #define GL_STENCIL_TAG_BITS_EXT 0x88F2 @@ -7383,6 +7988,10 @@ GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffse #define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D #define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF #define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif #endif /* GL_EXT_texture_array */ #ifndef GL_EXT_texture_buffer_object @@ -7479,6 +8088,10 @@ GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif /* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#endif /* GL_EXT_texture_filter_minmax */ + #ifndef GL_EXT_texture_integer #define GL_EXT_texture_integer 1 #define GL_RGBA32UI_EXT 0x8D70 @@ -8204,6 +8817,14 @@ GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRG #define GL_INTEL_fragment_shader_ordering 1 #endif /* GL_INTEL_fragment_shader_ordering */ +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + #ifndef GL_INTEL_map_texture #define GL_INTEL_map_texture 1 #define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF @@ -8398,6 +9019,16 @@ GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum t #endif #endif /* GL_NV_bindless_multi_draw_indirect */ +#ifndef GL_NV_bindless_multi_draw_indirect_count +#define GL_NV_bindless_multi_draw_indirect_count 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount); +#endif +#endif /* GL_NV_bindless_multi_draw_indirect_count */ + #ifndef GL_NV_bindless_texture #define GL_NV_bindless_texture 1 typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); @@ -8498,6 +9129,65 @@ GLAPI void APIENTRY glBlendBarrierNV (void); #define GL_NV_blend_square 1 #endif /* GL_NV_blend_square */ +#ifndef GL_NV_command_list +#define GL_NV_command_list 1 +#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000 +#define GL_NOP_COMMAND_NV 0x0001 +#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002 +#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003 +#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004 +#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005 +#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006 +#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007 +#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008 +#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009 +#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A +#define GL_BLEND_COLOR_COMMAND_NV 0x000B +#define GL_STENCIL_REF_COMMAND_NV 0x000C +#define GL_LINE_WIDTH_COMMAND_NV 0x000D +#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E +#define GL_ALPHA_REF_COMMAND_NV 0x000F +#define GL_VIEWPORT_COMMAND_NV 0x0010 +#define GL_SCISSOR_COMMAND_NV 0x0011 +#define GL_FRONT_FACE_COMMAND_NV 0x0012 +typedef void (APIENTRYP PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint *states); +typedef void (APIENTRYP PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint *states); +typedef GLboolean (APIENTRYP PFNGLISSTATENVPROC) (GLuint state); +typedef void (APIENTRYP PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode); +typedef GLuint (APIENTRYP PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size); +typedef GLushort (APIENTRYP PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint *lists); +typedef void (APIENTRYP PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint *lists); +typedef GLboolean (APIENTRYP PFNGLISCOMMANDLISTNVPROC) (GLuint list); +typedef void (APIENTRYP PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +typedef void (APIENTRYP PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments); +typedef void (APIENTRYP PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list); +typedef void (APIENTRYP PFNGLCALLCOMMANDLISTNVPROC) (GLuint list); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCreateStatesNV (GLsizei n, GLuint *states); +GLAPI void APIENTRY glDeleteStatesNV (GLsizei n, const GLuint *states); +GLAPI GLboolean APIENTRY glIsStateNV (GLuint state); +GLAPI void APIENTRY glStateCaptureNV (GLuint state, GLenum mode); +GLAPI GLuint APIENTRY glGetCommandHeaderNV (GLenum tokenID, GLuint size); +GLAPI GLushort APIENTRY glGetStageIndexNV (GLenum shadertype); +GLAPI void APIENTRY glDrawCommandsNV (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count); +GLAPI void APIENTRY glDrawCommandsAddressNV (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count); +GLAPI void APIENTRY glDrawCommandsStatesNV (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glDrawCommandsStatesAddressNV (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glCreateCommandListsNV (GLsizei n, GLuint *lists); +GLAPI void APIENTRY glDeleteCommandListsNV (GLsizei n, const GLuint *lists); +GLAPI GLboolean APIENTRY glIsCommandListNV (GLuint list); +GLAPI void APIENTRY glListDrawCommandsStatesClientNV (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count); +GLAPI void APIENTRY glCommandListSegmentsNV (GLuint list, GLuint segments); +GLAPI void APIENTRY glCompileCommandListNV (GLuint list); +GLAPI void APIENTRY glCallCommandListNV (GLuint list); +#endif +#endif /* GL_NV_command_list */ + #ifndef GL_NV_compute_program5 #define GL_NV_compute_program5 1 #define GL_COMPUTE_PROGRAM_NV 0x90FB @@ -8518,6 +9208,29 @@ GLAPI void APIENTRY glEndConditionalRenderNV (void); #endif #endif /* GL_NV_conditional_render */ +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + +#ifndef GL_NV_conservative_raster_dilate +#define GL_NV_conservative_raster_dilate 1 +#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379 +#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A +#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B +typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value); +#endif +#endif /* GL_NV_conservative_raster_dilate */ + #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color 1 #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E @@ -8660,6 +9373,11 @@ GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #endif #endif /* GL_NV_fence */ +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + #ifndef GL_NV_float_buffer #define GL_NV_float_buffer 1 #define GL_FLOAT_R_NV 0x8880 @@ -8686,6 +9404,16 @@ GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #endif /* GL_NV_fog_distance */ +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + #ifndef GL_NV_fragment_program #define GL_NV_fragment_program 1 #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 @@ -8727,6 +9455,30 @@ GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, cons #define GL_NV_fragment_program_option 1 #endif /* GL_NV_fragment_program_option */ +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GLAPI void APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + #ifndef GL_NV_framebuffer_multisample_coverage #define GL_NV_framebuffer_multisample_coverage 1 #define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB @@ -8746,12 +9498,10 @@ GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, G #define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); #endif #endif /* GL_NV_geometry_program4 */ @@ -8760,6 +9510,10 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen #define GL_NV_geometry_shader4 1 #endif /* GL_NV_geometry_shader4 */ +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + #ifndef GL_NV_gpu_program4 #define GL_NV_gpu_program4 1 #define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 @@ -8932,6 +9686,18 @@ GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfN #endif #endif /* GL_NV_half_float */ +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent 1 #define GL_MAX_SHININESS_NV 0x8504 @@ -8940,7 +9706,6 @@ GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfN #ifndef GL_NV_multisample_coverage #define GL_NV_multisample_coverage 1 -#define GL_COLOR_SAMPLES_NV 0x8E20 #endif /* GL_NV_multisample_coverage */ #ifndef GL_NV_multisample_filter_hint @@ -9053,13 +9818,11 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_SKIP_MISSING_GLYPH_NV 0x90A9 #define GL_USE_MISSING_GLYPH_NV 0x90AA #define GL_PATH_ERROR_POSITION_NV 0x90AB -#define GL_PATH_FOG_GEN_MODE_NV 0x90AC #define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD #define GL_ADJACENT_PAIRS_NV 0x90AE #define GL_FIRST_TO_REST_NV 0x90AF #define GL_PATH_GEN_MODE_NV 0x90B0 #define GL_PATH_GEN_COEFF_NV 0x90B1 -#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 #define GL_PATH_GEN_COMPONENTS_NV 0x90B3 #define GL_PATH_STENCIL_FUNC_NV 0x90B7 #define GL_PATH_STENCIL_REF_NV 0x90B8 @@ -9128,8 +9891,44 @@ GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindi #define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 #define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 #define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_2_BYTES_NV 0x1407 +#define GL_3_BYTES_NV 0x1408 +#define GL_4_BYTES_NV 0x1409 +#define GL_EYE_LINEAR_NV 0x2400 +#define GL_OBJECT_LINEAR_NV 0x2401 +#define GL_CONSTANT_NV 0x8576 +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC #define GL_PRIMARY_COLOR_NV 0x852C #define GL_SECONDARY_COLOR_NV 0x852D +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); @@ -9156,9 +9955,6 @@ typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint refere typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); -typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); @@ -9171,14 +9967,32 @@ typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dash typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); -typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); #ifdef GL_GLEXT_PROTOTYPES GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); @@ -9206,9 +10020,6 @@ GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); -GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); -GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); -GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); @@ -9221,17 +10032,40 @@ GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); -GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); -GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); -GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); +GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); #endif #endif /* GL_NV_path_rendering */ +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 @@ -9389,6 +10223,30 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #endif #endif /* GL_NV_register_combiners2 */ +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + #ifndef GL_NV_shader_atomic_counters #define GL_NV_shader_atomic_counters 1 #endif /* GL_NV_shader_atomic_counters */ @@ -9397,6 +10255,14 @@ GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, #define GL_NV_shader_atomic_float 1 #endif /* GL_NV_shader_atomic_float */ +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_atomic_int64 +#define GL_NV_shader_atomic_int64 1 +#endif /* GL_NV_shader_atomic_int64 */ + #ifndef GL_NV_shader_buffer_load #define GL_NV_shader_buffer_load 1 #define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D @@ -9666,7 +10532,7 @@ GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenu #define GL_SKIP_COMPONENTS1_NV -6 typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLenum bufferMode); typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); @@ -9679,7 +10545,7 @@ typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei coun #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); GLAPI void APIENTRY glEndTransformFeedbackNV (void); -GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLsizei count, const GLint *attribs, GLenum bufferMode); GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); @@ -9716,6 +10582,13 @@ GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); #endif #endif /* GL_NV_transform_feedback2 */ +#ifndef GL_NV_uniform_buffer_unified_memory +#define GL_NV_uniform_buffer_unified_memory 1 +#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E +#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F +#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370 +#endif /* GL_NV_uniform_buffer_unified_memory */ + #ifndef GL_NV_vdpau_interop #define GL_NV_vdpau_interop 1 typedef GLintptr GLvdpauSurfaceNV; @@ -10211,6 +11084,10 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot #endif #endif /* GL_NV_video_capture */ +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + #ifndef GL_OML_interlace #define GL_OML_interlace 1 #define GL_INTERLACE_OML 0x8980 @@ -10233,6 +11110,21 @@ GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot #define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 #endif /* GL_OML_subsample */ +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + #ifndef GL_PGI_misc_hints #define GL_PGI_misc_hints 1 #define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 @@ -10789,10 +11681,10 @@ GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); #ifndef GL_SGIX_resample #define GL_SGIX_resample 1 -#define GL_PACK_RESAMPLE_SGIX 0x842C -#define GL_UNPACK_RESAMPLE_SGIX 0x842D -#define GL_RESAMPLE_REPLICATE_SGIX 0x842E -#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_PACK_RESAMPLE_SGIX 0x842E +#define GL_UNPACK_RESAMPLE_SGIX 0x842F +#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 #define GL_RESAMPLE_DECIMATE_SGIX 0x8430 #endif /* GL_SGIX_resample */ diff --git a/code/nel/src/3d/driver/opengl/GL/glxext.h b/code/nel/src/3d/driver/opengl/GL/glxext.h index 7437d148c..227045ad9 100644 --- a/code/nel/src/3d/driver/opengl/GL/glxext.h +++ b/code/nel/src/3d/driver/opengl/GL/glxext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. +** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -33,10 +33,10 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $ +** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $ */ -#define GLX_GLXEXT_VERSION 20140416 +#define GLX_GLXEXT_VERSION 20150623 /* Generated C header for: * API: glx @@ -158,6 +158,13 @@ __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName); #endif #endif /* GLX_VERSION_1_4 */ +#ifndef GLX_ARB_context_flush_control +#define GLX_ARB_context_flush_control 1 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* GLX_ARB_context_flush_control */ + #ifndef GLX_ARB_create_context #define GLX_ARB_create_context 1 #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 @@ -243,6 +250,26 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); #define GLX_GPU_NUM_SIMD_AMD 0x21A6 #define GLX_GPU_NUM_RB_AMD 0x21A7 #define GLX_GPU_NUM_SPI_AMD 0x21A8 +typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids); +typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx); +typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list); +typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList); +typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx); +typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx); +typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GLX_GLXEXT_PROTOTYPES +unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids); +int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data); +unsigned int glXGetContextGPUIDAMD (GLXContext ctx); +GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list); +GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList); +Bool glXDeleteAssociatedContextAMD (GLXContext ctx); +Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx); +GLXContext glXGetCurrentAssociatedContextAMD (void); +void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif #endif /* GLX_AMD_gpu_association */ #ifndef GLX_EXT_buffer_age @@ -468,6 +495,16 @@ Bool glXSet3DfxModeMESA (int mode); #endif #endif /* GLX_MESA_set_3dfx_mode */ +#ifndef GLX_NV_copy_buffer +#define GLX_NV_copy_buffer 1 +typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GLX_GLXEXT_PROTOTYPES +void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GLX_NV_copy_buffer */ + #ifndef GLX_NV_copy_image #define GLX_NV_copy_image 1 typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); @@ -544,8 +581,8 @@ void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV devic #endif #endif /* GLX_NV_video_capture */ -#ifndef GLX_NV_video_output -#define GLX_NV_video_output 1 +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 typedef unsigned int GLXVideoDeviceNV; #define GLX_VIDEO_OUT_COLOR_NV 0x20C3 #define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 @@ -571,7 +608,7 @@ int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf); int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); #endif -#endif /* GLX_NV_video_output */ +#endif /* GLX_NV_video_out */ #ifndef GLX_OML_swap_method #define GLX_OML_swap_method 1 diff --git a/code/nel/src/3d/driver/opengl/GL/wglext.h b/code/nel/src/3d/driver/opengl/GL/wglext.h index e9648c37c..912e31c64 100644 --- a/code/nel/src/3d/driver/opengl/GL/wglext.h +++ b/code/nel/src/3d/driver/opengl/GL/wglext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. +** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -33,7 +33,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $ +** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $ */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -41,7 +41,7 @@ extern "C" { #include #endif -#define WGL_WGLEXT_VERSION 20140416 +#define WGL_WGLEXT_VERSION 20150623 /* Generated C header for: * API: wgl @@ -70,6 +70,13 @@ BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, #endif #endif /* WGL_ARB_buffer_region */ +#ifndef WGL_ARB_context_flush_control +#define WGL_ARB_context_flush_control 1 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 +#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#endif /* WGL_ARB_context_flush_control */ + #ifndef WGL_ARB_create_context #define WGL_ARB_create_context 1 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 35cf9c094..3539948ac 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -234,7 +234,7 @@ CDriverGL::CDriverGL() _CursorScale = 1.f; _MouseCaptured = false; - _NeedToRestaureGammaRamp = false; + _NeedToRestoreGammaRamp = false; _win = EmptyWindow; _WindowX = 0; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.def b/code/nel/src/3d/driver/opengl/driver_opengl.def index 369389fa9..e52ed712d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.def +++ b/code/nel/src/3d/driver/opengl/driver_opengl.def @@ -1,4 +1,3 @@ -LIBRARY nel_drv_opengl_win_r EXPORTS NL3D_createIDriverInstance NL3D_interfaceVersion \ No newline at end of file diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index c4540b9da..1a7ca6825 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -1558,7 +1558,7 @@ private: // Monitor color parameters backup - bool _NeedToRestaureGammaRamp; + bool _NeedToRestoreGammaRamp; uint16 _GammaRampBackuped[3*256]; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 1a660f9c7..7342b3efc 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -519,6 +519,14 @@ PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurrentAMD; PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD; PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD; +// WGL_NV_gpu_affinity +//==================== +PFNWGLENUMGPUSNVPROC nwglEnumGpusNV; +PFNWGLENUMGPUDEVICESNVPROC nwglEnumGpuDevicesNV; +PFNWGLCREATEAFFINITYDCNVPROC nwglCreateAffinityDCNV; +PFNWGLENUMGPUSFROMAFFINITYDCNVPROC nwglEnumGpusFromAffinityDCNV; +PFNWGLDELETEDCNVPROC nwglDeleteDCNV; + #elif defined(NL_OS_MAC) #elif defined(NL_OS_UNIX) @@ -1553,12 +1561,20 @@ static bool setupATIMeminfo(const char *glext) void registerGlExtensions(CGlExtensions &ext) { H_AUTO_OGL(registerGlExtensions); + // OpenGL 1.2 ?? const char *nglVersion= (const char *)glGetString (GL_VERSION); sint a=0, b=0; + // 1.2*** ??? sscanf(nglVersion, "%d.%d", &a, &b); - ext.Version1_2= (a==1 && b>=2) || (a>=2); + ext.Version1_2 = (a==1 && b>=2) || (a>=2); + + const char *vendor = (const char *) glGetString (GL_VENDOR); + const char *renderer = (const char *) glGetString (GL_RENDERER); + + // Log GPU details + nlinfo("3D: OpenGL %s / %s / %s", nglVersion, vendor, renderer); // Extensions. const char *glext= (const char*)glGetString(GL_EXTENSIONS); @@ -1777,17 +1793,30 @@ void registerGlExtensions(CGlExtensions &ext) if (ext.NVXGPUMemoryInfo) { -// GPU_MEMORY_INFO_EVICTION_COUNT_NVX; -// GPU_MEMORY_INFO_EVICTED_MEMORY_NVX; + GLint nEvictionCount = 0; +#ifdef GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX + glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &nEvictionCount); +#endif + + GLint nEvictionMemory = 0; +#ifdef GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX + glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &nEvictionMemory); +#endif GLint nDedicatedMemoryInKB = 0; +#ifdef GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &nDedicatedMemoryInKB); +#endif GLint nTotalMemoryInKB = 0; +#ifdef GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &nTotalMemoryInKB); +#endif GLint nCurAvailMemoryInKB = 0; +#ifdef GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &nCurAvailMemoryInKB); +#endif nlinfo("Memory: total: %d available: %d dedicated: %d", nTotalMemoryInKB, nCurAvailMemoryInKB, nDedicatedMemoryInKB); } @@ -1840,7 +1869,23 @@ static bool setupWGLAMDGPUAssociation(const char *glext) return true; } -// ********************************* +// *************************************************************************** +static bool setupWGLNVGPUAssociation(const char *glext) +{ + H_AUTO_OGL(setupWGLNVGPUAssociation); + CHECK_EXT("WGL_NV_gpu_affinity"); + +#if !defined(USE_OPENGLES) && defined(NL_OS_WINDOWS) + CHECK_ADDRESS(PFNWGLENUMGPUSNVPROC, wglEnumGpusNV); + CHECK_ADDRESS(PFNWGLENUMGPUDEVICESNVPROC, wglEnumGpuDevicesNV); + CHECK_ADDRESS(PFNWGLCREATEAFFINITYDCNVPROC, wglCreateAffinityDCNV); + CHECK_ADDRESS(PFNWGLENUMGPUSFROMAFFINITYDCNVPROC, wglEnumGpusFromAffinityDCNV); + CHECK_ADDRESS(PFNWGLDELETEDCNVPROC, wglDeleteDCNV); +#endif + + return true; +} + static bool setupGLXEXTSwapControl(const char *glext) { H_AUTO_OGL(setupGLXEXTSwapControl); @@ -1966,6 +2011,31 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC) delete [] uGPUIDs; } + ext.WGLNVGPUAffinity = setupWGLNVGPUAssociation(glext); + + if (ext.WGLNVGPUAffinity) + { + uint i = 0; + + HGPUNV hGPU; + + while(nwglEnumGpusNV(i, &hGPU)) + { + uint j = 0; + + PGPU_DEVICE lpGpuDevice = NULL; + + while(nwglEnumGpuDevicesNV(hGPU, j, lpGpuDevice)) + { + nlinfo("Device: %s - %s - flags: %u", lpGpuDevice->DeviceName, lpGpuDevice->DeviceString, lpGpuDevice->Flags); + + ++j; + } + + ++i; + } + } + return true; } #elif defined(NL_OS_MAC) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h index 868a0eaf4..d5556ef64 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -123,6 +123,9 @@ struct CGlExtensions // WGL_AMD_gpu_association bool WGLAMDGPUAssociation; + // WGL_NV_gpu_affinity + bool WGLNVGPUAffinity; + public: /// \name Disable Hardware feature. False by default. setuped by IDriver @@ -793,6 +796,13 @@ extern PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurren extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD; extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD; +// WGL_NV_gpu_affinity +//==================== +extern PFNWGLENUMGPUSNVPROC nwglEnumGpusNV; +extern PFNWGLENUMGPUDEVICESNVPROC nwglEnumGpuDevicesNV; +extern PFNWGLCREATEAFFINITYDCNVPROC nwglCreateAffinityDCNV; +extern PFNWGLENUMGPUSFROMAFFINITYDCNVPROC nwglEnumGpusFromAffinityDCNV; +extern PFNWGLDELETEDCNVPROC nwglDeleteDCNV; #elif defined(NL_OS_MAC) #elif defined(NL_OS_UNIX) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 95c8e61f2..e5375a49c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -532,7 +532,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat) } else { - // Restaure fog state to its current value + // Restore fog state to its current value _DriverGLStates.enableFog(_FogEnabled); } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp index cab62f094..39f71d77a 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -71,7 +71,7 @@ CVBDrvInfosGL::CVBDrvInfosGL(CDriverGL *drv, ItVBDrvInfoPtrList it, CVertexBuffe CVBDrvInfosGL::~CVBDrvInfosGL() { H_AUTO_OGL(CVBDrvInfosGL_CVBDrvInfosGLDtor) - // Restaure non resident memory + // Restore non resident memory if (VertexBufferPtr) { VertexBufferPtr->setLocation(CVertexBuffer::NotResident); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 943371fd9..36ac67281 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -329,7 +329,7 @@ bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc) HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); if (dc) { - _NeedToRestaureGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE; + _NeedToRestoreGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE; // Release the DC ReleaseDC (NULL, dc); @@ -465,8 +465,8 @@ bool CDriverGL::unInit() } _Registered = 0; - // Restaure monitor color parameters - if (_NeedToRestaureGammaRamp) + // Restore monitor color parameters + if (_NeedToRestoreGammaRamp) { HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL); if (dc) @@ -1738,7 +1738,9 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle) } else if (windowStyle == EWSFullscreen) { +#ifndef _DEBUG dwNewStyle |= WS_POPUP; +#endif isVisible = true; } @@ -1756,14 +1758,14 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle) #elif defined(NL_OS_MAC) // leave fullscreen mode, enter windowed mode - if(windowStyle == EWSWindowed && [containerView() isInFullScreenMode]) + if (windowStyle == EWSWindowed && [containerView() isInFullScreenMode]) { // disable manual setting of back buffer size, cocoa handles this // automatically as soon as the view gets resized CGLError error = CGLDisable((CGLContextObj)[_ctx CGLContextObj], kCGLCESurfaceBackingSize); - if(error != kCGLNoError) + if (error != kCGLNoError) nlerror("cannot disable kCGLCESurfaceBackingSize (%s)", CGLErrorString(error)); @@ -1778,20 +1780,20 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle) } // enter fullscreen, leave windowed mode - else if(windowStyle == EWSFullscreen && ![containerView() isInFullScreenMode]) + else if (windowStyle == EWSFullscreen && ![containerView() isInFullScreenMode]) { // enable manual back buffer size for mode setting in fullscreen CGLError error = CGLEnable((CGLContextObj)[_ctx CGLContextObj], kCGLCESurfaceBackingSize); - if(error != kCGLNoError) + if (error != kCGLNoError) nlerror("cannot enable kCGLCESurfaceBackingSize (%s)", CGLErrorString(error)); // put the view in fullscreen mode, hiding the dock but enabling the menubar // to pop up if the mouse hits the top screen border. // NOTE: withOptions:nil disables + application switching! -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP [containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: @@ -1915,8 +1917,9 @@ bool CDriverGL::setMode(const GfxMode& mode) return true; } -#if defined(NL_OS_MAC) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_OS_MAC +#ifdef NL_MAC_VERSION_10_6_UP /// helper to extract bits per pixel value from screen mode, only 16 or 32 bits static int bppFromDisplayMode(CGDisplayModeRef mode) @@ -1934,7 +1937,7 @@ static int bppFromDisplayMode(CGDisplayModeRef mode) return 0; } -#elif defined(NL_OS_MAC) +#else long GetDictionaryLong(CFDictionaryRef theDict, const void* key) { @@ -1951,7 +1954,9 @@ long GetDictionaryLong(CFDictionaryRef theDict, const void* key) #define GetModeHeight(mode) GetDictionaryLong((mode), kCGDisplayHeight) #define GetModeBitsPerPixel(mode) GetDictionaryLong((mode), kCGDisplayBitsPerPixel) -#endif // defined(NL_OS_MAC) +#endif + +#endif // NL_OS_MAC // -------------------------------------------------- bool CDriverGL::getModes(std::vector &modes) @@ -1998,7 +2003,7 @@ bool CDriverGL::getModes(std::vector &modes) { CGDirectDisplayID dspy = display[i]; -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL); #else CFArrayRef modeList = CGDisplayAvailableModes(dspy); @@ -2012,7 +2017,7 @@ bool CDriverGL::getModes(std::vector &modes) for (CFIndex j = 0; j < CFArrayGetCount(modeList); ++j) { -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j); uint8 bpp = bppFromDisplayMode(mode); #else @@ -2022,7 +2027,7 @@ bool CDriverGL::getModes(std::vector &modes) if (bpp >= 16) { -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP uint16 w = CGDisplayModeGetWidth(mode); uint16 h = CGDisplayModeGetHeight(mode); #else @@ -2045,6 +2050,10 @@ bool CDriverGL::getModes(std::vector &modes) // nldebug(" Display 0x%x: Mode %dx%d, %d BPP", dspy, w, h, bpp); } } + +#ifdef NL_MAC_VERSION_10_6_UP + CFRelease(modeList); +#endif } #elif defined (NL_OS_UNIX) diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h b/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h index da033c7c1..9577bda40 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h @@ -27,7 +27,7 @@ using NL3D::CDriverGL; #endif @interface CocoaApplicationDelegate : NSObject -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP #endif { diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp index 6206d94c3..e4a531b9b 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "../stdopengl.h" #include "cocoa_event_emitter.h" namespace NLMISC @@ -380,7 +381,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) case NSOtherMouseDown:break; case NSOtherMouseUp:break; case NSOtherMouseDragged:break; -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP case NSEventTypeGesture:break; case NSEventTypeMagnify:break; case NSEventTypeSwipe:break; diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m index 17500389c..e989f94d5 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m @@ -47,7 +47,7 @@ static void viewDidResize(NSView* view, CDriverGL* driver) -(void)keyDown:(NSEvent*)event { -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP [[self inputContext] handleEvent:event]; #endif } diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h index 53078e95a..3f13a7345 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h @@ -28,7 +28,7 @@ using NL3D::CDriverGL; #endif @interface CocoaWindowDelegate : NSObject -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP #endif { diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm index a2eb54a6b..2e5faf852 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm @@ -31,8 +31,7 @@ static void windowDidMove(NSWindow* window, CDriverGL* driver) driver->_WindowX = windowRect.origin.x; // map y from cocoa to NeL coordinates before setting in driver - driver->_WindowY = - screenRect.size.height - windowRect.size.height - windowRect.origin.y; + driver->_WindowY = screenRect.size.height - windowRect.size.height - windowRect.origin.y; } @implementation CocoaWindowDelegate diff --git a/code/nel/src/3d/driver/opengl/stdopengl.h b/code/nel/src/3d/driver/opengl/stdopengl.h index ab4eb8316..3066a778a 100644 --- a/code/nel/src/3d/driver/opengl/stdopengl.h +++ b/code/nel/src/3d/driver/opengl/stdopengl.h @@ -100,4 +100,11 @@ #include "nel/3d/light.h" #include "nel/3d/index_buffer.h" +#ifdef NL_OS_MAC +#include +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#define NL_MAC_VERSION_10_6_UP +#endif +#endif + #endif diff --git a/code/nel/src/3d/index_buffer.cpp b/code/nel/src/3d/index_buffer.cpp index b9e1356dc..7bb2e1cd5 100644 --- a/code/nel/src/3d/index_buffer.cpp +++ b/code/nel/src/3d/index_buffer.cpp @@ -106,7 +106,7 @@ CIndexBuffer::~CIndexBuffer() // Single value if (DrvInfos) - DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die + DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die // Must kill the drv mirror of this VB. DrvInfos.kill(); @@ -144,7 +144,7 @@ void CIndexBuffer::setPreferredMemory (TPreferredMemory preferredMemory, bool ke _KeepLocalMemory = keepLocalMemory; // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } @@ -159,7 +159,7 @@ void CIndexBuffer::reserve(uint32 n) _NbIndexes=std::min (_NbIndexes,_Capacity); // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } @@ -206,7 +206,7 @@ void CIndexBuffer::deleteAllIndexes() } // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); // Delete driver info nlassert (DrvInfos == NULL); @@ -276,12 +276,12 @@ void CIndexBuffer::setLocation (TLocation newLocation) // *************************************************************************** -void CIndexBuffer::restaureNonResidentMemory() +void CIndexBuffer::restoreNonResidentMemory() { setLocation (NotResident); if (DrvInfos) - DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die + DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die // Must kill the drv mirror of this VB. DrvInfos.kill(); @@ -407,7 +407,7 @@ void CIndexBuffer::serial(NLMISC::IStream &f) if (f.isReading()) { // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } diff --git a/code/nel/src/3d/vertex_buffer.cpp b/code/nel/src/3d/vertex_buffer.cpp index ea3ec5100..fc09dc956 100644 --- a/code/nel/src/3d/vertex_buffer.cpp +++ b/code/nel/src/3d/vertex_buffer.cpp @@ -166,7 +166,7 @@ CVertexBuffer::~CVertexBuffer() * ***********************************************/ if (DrvInfos) - DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die + DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die // Must kill the drv mirror of this VB. DrvInfos.kill(); @@ -302,7 +302,7 @@ bool CVertexBuffer::setVertexFormat(uint32 flags) initEx (); // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); return (true); } @@ -468,7 +468,7 @@ void CVertexBuffer::initEx () _Capacity = 0; // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } // -------------------------------------------------- @@ -482,7 +482,7 @@ void CVertexBuffer::reserve(uint32 n) _NbVerts=std::min (_NbVerts,_Capacity); // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } @@ -518,7 +518,7 @@ void CVertexBuffer::deleteAllVertices() } // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); // Delete driver info nlassert (DrvInfos == NULL); @@ -725,7 +725,7 @@ void CVertexBuffer::serialOldV1Minus(NLMISC::IStream &f, sint ver) if(f.isReading()) { // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } @@ -979,7 +979,7 @@ void CVertexBuffer::serialSubset(NLMISC::IStream &f, uint vertexStart, uint ver if(f.isReading()) { // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } @@ -1029,7 +1029,7 @@ bool CVertexBuffer::setVertexColorFormat (TVertexColorType format) _VertexColorFormat = (uint8)format; // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } return true; } @@ -1044,7 +1044,7 @@ void CVertexBuffer::setPreferredMemory (TPreferredMemory preferredMemory, bool k _KeepLocalMemory = keepLocalMemory; // Force non resident - restaureNonResidentMemory(); + restoreNonResidentMemory(); } } @@ -1110,12 +1110,12 @@ void CVertexBuffer::setLocation (TLocation newLocation) } // -------------------------------------------------- -void CVertexBuffer::restaureNonResidentMemory() +void CVertexBuffer::restoreNonResidentMemory() { setLocation (NotResident); if (DrvInfos) - DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die + DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die // Must kill the drv mirror of this VB. DrvInfos.kill(); diff --git a/code/nel/src/gui/ctrl_base.cpp b/code/nel/src/gui/ctrl_base.cpp index 5c250a0da..475761e89 100644 --- a/code/nel/src/gui/ctrl_base.cpp +++ b/code/nel/src/gui/ctrl_base.cpp @@ -19,6 +19,7 @@ #include "libxml/globals.h" #include "nel/misc/debug.h" #include "nel/misc/xml_auto_ptr.h" +#include "nel/gui/lua_ihm.h" #include "nel/gui/ctrl_base.h" #include "nel/gui/interface_group.h" #include "nel/gui/widget_manager.h" @@ -556,5 +557,17 @@ namespace NLGUI return itr2->second; } + // *************************************************************************** + int CCtrlBase::luaSetTooltipUtf8(CLuaState &ls) + { + const char *funcName = "setTooltipUtf8"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + std::string tooltip = ls.toString(1); + + setDefaultContextHelp(ucstring::makeFromUtf8(tooltip)); + + return 0; + } } diff --git a/code/nel/src/gui/ctrl_col_pick.cpp b/code/nel/src/gui/ctrl_col_pick.cpp index 610f545c6..2d62b6e74 100644 --- a/code/nel/src/gui/ctrl_col_pick.cpp +++ b/code/nel/src/gui/ctrl_col_pick.cpp @@ -169,25 +169,25 @@ namespace NLGUI if( _ColSelR.getNodePtr() != NULL ) s = _ColSelR.getNodePtr()->getFullName(); else - s = ""; + s.clear(); xmlSetProp( node, BAD_CAST "dbcolr", BAD_CAST s.c_str() ); if( _ColSelG.getNodePtr() != NULL ) s = _ColSelG.getNodePtr()->getFullName(); else - s = ""; + s.clear(); xmlSetProp( node, BAD_CAST "dbcolg", BAD_CAST s.c_str() ); if( _ColSelB.getNodePtr() != NULL ) s = _ColSelB.getNodePtr()->getFullName(); else - s = ""; + s.clear(); xmlSetProp( node, BAD_CAST "dbcolb", BAD_CAST s.c_str() ); if( _ColSelA.getNodePtr() != NULL ) s = _ColSelA.getNodePtr()->getFullName(); else - s = ""; + s.clear(); xmlSetProp( node, BAD_CAST "dbcola", BAD_CAST s.c_str() ); return node; diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index c29f73fea..da42cd40b 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -519,17 +519,17 @@ namespace NLGUI // Read Action handlers prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" ); - if (prop) _AHOnScroll = NLMISC::strlwr(prop.str()); + if (prop) _AHOnScroll = NLMISC::toLower(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"params" ); if (prop) _AHOnScrollParams = string((const char*)prop); // prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" ); - if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop.str()); + if (prop) _AHOnScrollEnd = NLMISC::toLower(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" ); if (prop) _AHOnScrollEndParams = string((const char*)prop); // prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" ); - if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop.str()); + if (prop) _AHOnScrollCancel = NLMISC::toLower(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" ); if (prop) _AHOnScrollCancelParams = string((const char*)prop); diff --git a/code/nel/src/gui/dbgroup_combo_box.cpp b/code/nel/src/gui/dbgroup_combo_box.cpp index 39ddd63c1..dd30957b8 100644 --- a/code/nel/src/gui/dbgroup_combo_box.cpp +++ b/code/nel/src/gui/dbgroup_combo_box.cpp @@ -543,7 +543,7 @@ namespace NLGUI CLuaIHM::checkArgTypeUCString(ls, funcName, 2); ucstring text; nlverify(CLuaIHM::pop(ls, text)); - setText((uint) ls.toNumber(1), text); + setText((uint) ls.toInteger(1), text); return 0; } @@ -556,7 +556,7 @@ namespace NLGUI CLuaIHM::checkArgTypeUCString(ls, funcName, 2); ucstring text; nlverify(CLuaIHM::pop(ls, text)); - insertText((uint) ls.toNumber(1), text); + insertText((uint) ls.toInteger(1), text); return 0; } @@ -569,7 +569,7 @@ namespace NLGUI CLuaIHM::checkArgTypeUCString(ls, funcName, 2); ucstring texture; nlverify(CLuaIHM::pop(ls, texture)); - setTexture((uint) ls.toNumber(1), texture); + setTexture((uint) ls.toInteger(1), texture); return 0; } @@ -579,7 +579,7 @@ namespace NLGUI const char *funcName = "setText"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CLuaIHM::push(ls, getText((uint) ls.toNumber(1))); + CLuaIHM::push(ls, getText((uint) ls.toInteger(1))); return 1; } @@ -589,7 +589,7 @@ namespace NLGUI const char *funcName = "removeText"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - removeText((uint) ls.toNumber(1)); + removeText((uint) ls.toInteger(1)); return 0; } @@ -598,7 +598,7 @@ namespace NLGUI { const char *funcName = "getNumTexts"; CLuaIHM::checkArgCount(ls, funcName, 0); - ls.push((double) getNumTexts()); + ls.push(getNumTexts()); return 1; } diff --git a/code/nel/src/gui/group_container.cpp b/code/nel/src/gui/group_container.cpp index 18a65bc5f..5003654f9 100644 --- a/code/nel/src/gui/group_container.cpp +++ b/code/nel/src/gui/group_container.cpp @@ -4820,7 +4820,7 @@ namespace NLGUI const char *funcName = "blink"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - enableBlink((uint) ls.toNumber(1)); + enableBlink((uint) ls.toInteger(1)); return 0; } diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index f6d909119..c96c27b46 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -606,11 +606,7 @@ namespace NLGUI } prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" ); - if (prop) - { - string tmp = (const char *) prop; - _ListMenuRight = strlwr(tmp); - } + if (prop) _ListMenuRight = toLower((const char *) prop); prop = (char*) xmlGetProp( cur, (xmlChar*)"max_historic" ); if (prop) fromString((const char*)prop, _MaxHistoric); diff --git a/code/nel/src/gui/group_header.cpp b/code/nel/src/gui/group_header.cpp index 16b52cad6..d166b539b 100644 --- a/code/nel/src/gui/group_header.cpp +++ b/code/nel/src/gui/group_header.cpp @@ -202,7 +202,7 @@ namespace NLGUI const char *funcName = "enlargeColumns"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - enlargeColumns((sint32) ls.toNumber(1)); + enlargeColumns((sint32) ls.toInteger(1)); return 0; } @@ -212,7 +212,7 @@ namespace NLGUI const char *funcName = "resizeColumnsAndContainer"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - resizeColumnsAndContainer((sint32) ls.toNumber(1)); + resizeColumnsAndContainer((sint32) ls.toInteger(1)); return 0; } diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index f2df454cb..7d451d561 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -772,8 +772,7 @@ namespace NLGUI cellParams.NoWrap = true; \ if (present[prefix##_ALIGN] && value[prefix##_ALIGN]) \ { \ - string align = value[prefix##_ALIGN]; \ - align = strlwr(align); \ + string align = toLower(value[prefix##_ALIGN]); \ if (align == "left") \ cellParams.Align = CGroupCell::Left; \ if (align == "center") \ @@ -783,8 +782,7 @@ namespace NLGUI } \ if (present[prefix##_VALIGN] && value[prefix##_VALIGN]) \ { \ - string align = value[prefix##_VALIGN]; \ - align = strlwr(align); \ + string align = toLower(value[prefix##_VALIGN]); \ if (align == "top") \ cellParams.VAlign = CGroupCell::Top; \ if (align == "middle") \ @@ -1182,7 +1180,7 @@ namespace NLGUI if (it != styles.end()) { string image = it->second; - string::size_type texExt = strlwr(image).find("url("); + string::size_type texExt = toLower(image).find("url("); // Url image if (texExt != string::npos) // Remove url() @@ -1321,8 +1319,7 @@ namespace NLGUI if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT]) tooltip = value[MY_HTML_INPUT_ALT]; - string type = value[MY_HTML_INPUT_TYPE]; - type = strlwr (type); + string type = toLower(value[MY_HTML_INPUT_TYPE]); if (type == "image") { // The submit button @@ -1668,7 +1665,7 @@ namespace NLGUI { nlinfo("found background-image %s", it->second.c_str()); string image = (*it).second; - string::size_type texExt = strlwr(image).find("url("); + string::size_type texExt = toLower(image).find("url("); // Url image if (texExt != string::npos) { @@ -2090,6 +2087,14 @@ namespace NLGUI clearContext(); MultiCurl = curl_multi_init(); + if (MultiCurl) + { +#ifdef CURLMOPT_MAX_HOST_CONNECTIONS + // added in libcurl 7.30.0 + curl_multi_setopt(MultiCurl, CURLMOPT_MAX_HOST_CONNECTIONS, options.curlMaxConnections); +#endif + curl_multi_setopt(MultiCurl, CURLMOPT_PIPELINING, 1); + } RunningCurls = 0; _CurlWWW = NULL; @@ -3613,7 +3618,7 @@ namespace NLGUI } else { - ctrlButton->setDefaultContextHelp(ucstring(tooltip)); + ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(tooltip)); //ctrlButton->setOnContextHelp(string(tooltip)); } @@ -3818,7 +3823,7 @@ namespace NLGUI // folder used for images cache static const string cacheDir = "cache"; - string::size_type protocolPos = strlwr(result).find("://"); + string::size_type protocolPos = toLower(result).find("://"); if (protocolPos != string::npos) { @@ -3832,7 +3837,7 @@ namespace NLGUI else { // Url is a file ? - if (strlwr(result).find("file:") == 0) + if (toLower(result).find("file:") == 0) { result = result.substr(5, result.size()-5); } @@ -3849,7 +3854,7 @@ namespace NLGUI { // Normalize the path if (isUrl) - //result = "file:"+strlwr(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/ + //result = "file:"+toLower(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/ result = "file:/"+tmp; else result = tmp; @@ -4106,7 +4111,7 @@ namespace NLGUI void CGroupHTML::doBrowseLocalFile(const std::string &uri) { std::string filename; - if (strlwr(uri).find("file:/") == 0) + if (toLower(uri).find("file:/") == 0) { filename = uri.substr(6, uri.size() - 6); } @@ -4720,7 +4725,7 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE); - uint element_number = (uint)ls.toNumber(1); + uint element_number = (uint)ls.toInteger(1); std::vector present; std::vector value; present.resize(30, false); @@ -4733,7 +4738,7 @@ namespace NLGUI ENUM_LUA_TABLE(params, it) { - if (!it.nextKey().isNumber()) + if (!it.nextKey().isInteger()) { nlwarning("%s : bad key encountered with type %s, number expected.", funcName, it.nextKey().getTypename()); continue; @@ -4743,16 +4748,16 @@ namespace NLGUI nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str()); continue; } - uint idx = (uint)it.nextKey().toNumber(); + uint idx = (uint)it.nextKey().toInteger(); - present.insert(present.begin() + (uint)it.nextKey().toNumber(), true); + present.insert(present.begin() + (uint)it.nextKey().toInteger(), true); string str = it.nextValue().toString(); size_t size = str.size() + 1; char * buffer = new char[ size ]; strncpy(buffer, str.c_str(), size ); - value.insert(value.begin() + (uint)it.nextKey().toNumber(), buffer); + value.insert(value.begin() + (uint)it.nextKey().toInteger(), buffer); } beginElement(element_number, present, value); @@ -4770,7 +4775,7 @@ namespace NLGUI CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - uint element_number = (uint)ls.toNumber(1); + uint element_number = (uint)ls.toInteger(1); endElement(element_number); return 0; @@ -4970,7 +4975,7 @@ namespace NLGUI else if (it->first == "text-decoration" || it->first == "text-decoration-line") { - std::string prop(strlwr(it->second)); + std::string prop(toLower(it->second)); style.Underlined = (prop.find("underline") != std::string::npos); style.StrikeThrough = (prop.find("line-through") != std::string::npos); } diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp index 4936ad3e2..e75f8787e 100644 --- a/code/nel/src/gui/group_list.cpp +++ b/code/nel/src/gui/group_list.cpp @@ -1145,7 +1145,7 @@ namespace NLGUI { CLuaIHM::checkArgCount(ls, "getElementIndex", 1); CViewBase * viewBase = dynamic_cast(CLuaIHM::getUIOnStack(ls, 1)); - ls.push((double) getElementIndex(viewBase)); + ls.push(getElementIndex(viewBase)); return 1; } @@ -1224,7 +1224,7 @@ namespace NLGUI const char *funcName = "getChild"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - sint index = (sint) ls.toNumber(1); + sint index = (sint) ls.toInteger(1); if(index < 0 || index >= (sint) _Elements.size()) { CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements", @@ -1304,10 +1304,10 @@ namespace NLGUI ucstring ucText; ucText.fromUtf8(text); - uint r = (uint) ls.toNumber(2); - uint g = (uint) ls.toNumber(3); - uint b = (uint) ls.toNumber(4); - uint a = (uint) ls.toNumber(5); + uint r = (uint) ls.toInteger(2); + uint g = (uint) ls.toInteger(3); + uint b = (uint) ls.toInteger(4); + uint a = (uint) ls.toInteger(5); addTextChild(ucText, CRGBA(r, g, b, a)); @@ -1344,7 +1344,7 @@ namespace NLGUI } else { - addChildAtIndex(vb, (uint) ls.toNumber(2)); + addChildAtIndex(vb, (uint) ls.toInteger(2)); } return 0; } diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index ddd022310..381623e20 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -1702,7 +1702,7 @@ namespace NLGUI int CGroupSubMenu::luaGetNumLine(CLuaState &ls) { CLuaIHM::checkArgCount(ls, "getNumLine", 0); - ls.push((double) getNumLine()); + ls.push(getNumLine()); return 1; } @@ -1712,7 +1712,7 @@ namespace NLGUI const char *funcName = "getSubMenu"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toNumber(1))); + CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toInteger(1))); return 1; } @@ -1722,8 +1722,8 @@ namespace NLGUI const char *funcName = "addSubMenu"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - setSubMenu((uint) ls.toNumber(1), new CGroupSubMenu(CViewText::TCtorParam())); - CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toNumber(1))); + setSubMenu((uint) ls.toInteger(1), new CGroupSubMenu(CViewText::TCtorParam())); + CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toInteger(1))); return 1; } @@ -1733,7 +1733,7 @@ namespace NLGUI const char *funcName = "getLineId"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - std::string id = getLineId((uint) ls.toNumber(1)); + std::string id = getLineId((uint) ls.toInteger(1)); CLuaIHM::push(ls, id); return 1; } @@ -1744,7 +1744,7 @@ namespace NLGUI const char *funcName = "getLineFromId"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); - ls.push((double) getLineFromId(ls.toString(1))); + ls.push(getLineFromId(ls.toString(1))); return 1; } @@ -1754,7 +1754,7 @@ namespace NLGUI const char *funcName = "isSeparator"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - ls.push(isSeparator((uint) ls.toNumber(1))); + ls.push(isSeparator((uint) ls.toInteger(1))); return 1; } @@ -1785,7 +1785,7 @@ namespace NLGUI CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); ucstring arg2; nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2)); - addLineAtIndex((uint) ls.toNumber(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5)); + addLineAtIndex((uint) ls.toInteger(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5)); return 0; } @@ -1803,7 +1803,7 @@ namespace NLGUI const char *funcName = "addSeparatorAtIndex"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - addSeparatorAtIndex((uint) ls.toNumber(1)); + addSeparatorAtIndex((uint) ls.toInteger(1)); return 0; } @@ -1813,7 +1813,7 @@ namespace NLGUI const char *funcName = "removeLine"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - removeLine((uint) ls.toNumber(1)); + removeLine((uint) ls.toInteger(1)); return 0; } @@ -1833,7 +1833,7 @@ namespace NLGUI { CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName); } - setUserGroupRight((uint) ls.toNumber(1), group, true); + setUserGroupRight((uint) ls.toInteger(1), group, true); return 0; } @@ -1853,7 +1853,7 @@ namespace NLGUI { CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName); } - setUserGroupLeft((uint) ls.toNumber(1), group, true); + setUserGroupLeft((uint) ls.toInteger(1), group, true); return 0; } @@ -1864,7 +1864,7 @@ namespace NLGUI const char *funcName = "getUserGroupRight"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CLuaIHM::pushUIOnStack(ls, getUserGroupRight((uint) ls.toNumber(1))); + CLuaIHM::pushUIOnStack(ls, getUserGroupRight((uint) ls.toInteger(1))); return 1; } @@ -1875,7 +1875,7 @@ namespace NLGUI const char *funcName = "getUserGroupLeft"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CInterfaceElement *pIE = getUserGroupLeft((uint) ls.toNumber(1)); + CInterfaceElement *pIE = getUserGroupLeft((uint) ls.toInteger(1)); if (pIE) { CLuaIHM::pushUIOnStack(ls, pIE); @@ -1890,7 +1890,7 @@ namespace NLGUI const char *funcName = "setMaxVisibleLine"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - setMaxVisibleLine((uint) ls.toNumber(1)); + setMaxVisibleLine((uint) ls.toInteger(1)); return 0; } @@ -2566,7 +2566,7 @@ namespace NLGUI const char *funcName = "setMinW"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - setMinW((sint32) ls.toNumber(1)); + setMinW((sint32) ls.toInteger(1)); return 0; } } diff --git a/code/nel/src/gui/group_tab.cpp b/code/nel/src/gui/group_tab.cpp index 1a8c6b726..ca876c25e 100644 --- a/code/nel/src/gui/group_tab.cpp +++ b/code/nel/src/gui/group_tab.cpp @@ -316,7 +316,7 @@ namespace NLGUI if (tabB) { // don't use addTab to avoid selection of new tab - addTab(tabB, (sint) ls.toNumber(2)); + addTab(tabB, (sint) ls.toInteger(2)); } return 0; } @@ -395,7 +395,7 @@ namespace NLGUI const char *funcName = "removeTab"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - removeTab((uint) ls.toNumber(1)); + removeTab((uint) ls.toInteger(1)); return 0; } @@ -441,7 +441,7 @@ namespace NLGUI const char *funcName = "getTabButton"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CCtrlTabButton* tab = getTabButton((uint) ls.toNumber(1)); + CCtrlTabButton* tab = getTabButton((uint) ls.toInteger(1)); if(tab != NULL) { CLuaIHM::pushUIOnStack(ls, tab); @@ -562,7 +562,7 @@ namespace NLGUI const char *funcName = "showTabButton"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - sint showTab = (sint)ls.toNumber(1); + sint showTab = (sint)ls.toInteger(1); if(showTab>=0 && showTab<(sint)_Buttons.size()) { @@ -770,7 +770,7 @@ namespace NLGUI const char *funcName = "getGroup"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - CInterfaceGroup* group = getGroup((uint) ls.toNumber(1)); + CInterfaceGroup* group = getGroup((uint) ls.toInteger(1)); if(group != NULL) { CLuaIHM::pushUIOnStack(ls, group); diff --git a/code/nel/src/gui/group_tree.cpp b/code/nel/src/gui/group_tree.cpp index 82a2f5eb0..1b80ee84b 100644 --- a/code/nel/src/gui/group_tree.cpp +++ b/code/nel/src/gui/group_tree.cpp @@ -1815,7 +1815,7 @@ namespace NLGUI const char *funcName = "CGroupTree::SNode::luaAddChildAtIndex"; CLuaIHM::checkArgCount(ls, funcName, 2); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); - addChildAtIndex(luaGetNodeOnStack(ls, funcName), (sint) ls.toNumber(2)); + addChildAtIndex(luaGetNodeOnStack(ls, funcName), (sint) ls.toInteger(2)); return 0; } @@ -1836,7 +1836,7 @@ namespace NLGUI { const char *funcName = "CGroupTree::SNode::luaGetNumChildren"; CLuaIHM::checkArgCount(ls, funcName, 0); - ls.push((double) Children.size()); + ls.push((uint)Children.size()); return 1; } @@ -1847,7 +1847,7 @@ namespace NLGUI CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); // - sint index = (sint) ls.toNumber(1); + sint index = (sint) ls.toInteger(1); if (index < 0 || index >= (sint) Children.size()) { std::string range = Children.empty() ? "" : toString("[0, %d]", Children.size() - 1); @@ -1890,7 +1890,7 @@ namespace NLGUI { CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 2, LUA_TBOOLEAN); - selectLine((uint) ls.toNumber(1), ls.toBoolean(2)); + selectLine((uint) ls.toInteger(1), ls.toBoolean(2)); return 0; } diff --git a/code/nel/src/gui/interface_anim.cpp b/code/nel/src/gui/interface_anim.cpp index edd96e1cf..4b230bb25 100644 --- a/code/nel/src/gui/interface_anim.cpp +++ b/code/nel/src/gui/interface_anim.cpp @@ -55,8 +55,7 @@ namespace NLGUI if (ptr) _Dynamic = CInterfaceElement::convertBool (ptr); ptr = xmlGetProp (cur, (xmlChar*)"type"); - string sTmp = ptr.str(); - sTmp = strlwr(sTmp); + string sTmp = toLower(ptr.str()); if (sTmp == "linear") _Type = Track_Linear; else if (sTmp == "bezier") diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index b5027a87c..6318bf61a 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -312,8 +312,7 @@ namespace NLGUI ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_sizeparent" ); if (ptr) { - string idparent = ptr.str(); - idparent = NLMISC::strlwr(idparent); + string idparent = NLMISC::toLower(ptr.str()); if (idparent != "parent") { if (parentGroup) @@ -1174,7 +1173,7 @@ namespace NLGUI int CInterfaceGroup::luaGetNumGroups(CLuaState &ls) { CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getNumGroups", 0); - ls.push((double) _ChildrenGroups.size()); + ls.push((uint)_ChildrenGroups.size()); return 1; } @@ -1184,7 +1183,7 @@ namespace NLGUI const char *funcName = "CInterfaceGroup::getGroup"; CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getGroup", 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - uint index = (uint) ls.toNumber(1); + uint index = (uint) ls.toInteger(1); if (index >= _ChildrenGroups.size()) { CLuaIHM::fails(ls, "getGroup : try to index group %s, but there are only %d son groups", ls.toString(1), (int) _ChildrenGroups.size()); @@ -2140,7 +2139,8 @@ namespace NLGUI std::string typeName = "???"; if (_ChildrenGroups[k]) { - const type_info &ti = typeid(*_ChildrenGroups[k]); + NLGUI::CInterfaceGroup *group = _ChildrenGroups[k]; + const type_info &ti = typeid(*group); typeName = ti.name(); } nlinfo("Group %d, name = %s, type=%s", k, _ChildrenGroups[k] ? _ChildrenGroups[k]->getId().c_str() : "???", typeName.c_str()); @@ -2156,7 +2156,8 @@ namespace NLGUI std::string typeName = "???"; if (_ChildrenGroups[k]) { - const type_info &ti = typeid(*_EltOrder[k]); + NLGUI::CViewBase *view = _EltOrder[k]; + const type_info &ti = typeid(*view); typeName = ti.name(); } CInterfaceElement *el = _EltOrder[k]; diff --git a/code/nel/src/gui/interface_options.cpp b/code/nel/src/gui/interface_options.cpp index 3de015d65..1daef83cb 100644 --- a/code/nel/src/gui/interface_options.cpp +++ b/code/nel/src/gui/interface_options.cpp @@ -127,8 +127,7 @@ namespace NLGUI // *************************************************************************** const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const { - string sLwrParamName = strlwr (sParamName); - std::map::const_iterator it = _ParamValue.find (sLwrParamName); + std::map::const_iterator it = _ParamValue.find (toLower(sParamName)); if (it != _ParamValue.end()) return it->second; else diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 1dbf62d51..02434e66a 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -1359,6 +1359,9 @@ namespace NLGUI { CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" )); if (!ptr) return false; + + string stmp2 = toLower(string((const char*)ptr)); + CInterfaceElement *pEltFound = NULL; std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); for (uint32 i = 0; i < _MasterGroups.size(); ++i) @@ -1367,8 +1370,8 @@ namespace NLGUI for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j) { CInterfaceGroup *pIG = rMG.Group->getGroups()[j]; - string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); - string stmp2 = strlwr(string((const char*)ptr)); + string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); + if (stmp == stmp2) { pEltFound = pIG; @@ -1408,6 +1411,9 @@ namespace NLGUI { CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" )); if (!ptr) return false; + + string stmp2 = toLower(string((const char*)ptr)); + std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); CInterfaceElement *pEltFound = NULL; for (uint32 i = 0; i < _MasterGroups.size(); ++i) @@ -1416,8 +1422,7 @@ namespace NLGUI for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j) { CInterfaceGroup *pIG = rMG.Group->getGroups()[j]; - string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); - string stmp2 = strlwr(string((const char*)ptr)); + string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); if (stmp == stmp2) { pEltFound = pIG; @@ -1600,6 +1605,9 @@ namespace NLGUI { CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" )); if (!ptr) return false; + + string stmp2 = toLower(string((const char*)ptr)); + std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); CInterfaceElement *pEltFound = NULL; for (uint32 i = 0; i < _MasterGroups.size(); ++i) @@ -1608,8 +1616,8 @@ namespace NLGUI for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j) { CInterfaceGroup *pIG = rMG.Group->getGroups()[j]; - string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); - string stmp2 = strlwr(string((const char*)ptr)); + string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size())); + if (stmp == stmp2) { pEltFound = pIG; diff --git a/code/nel/src/gui/lua_helper.cpp b/code/nel/src/gui/lua_helper.cpp index fb9466b36..0e2b9ba71 100644 --- a/code/nel/src/gui/lua_helper.cpp +++ b/code/nel/src/gui/lua_helper.cpp @@ -623,6 +623,23 @@ namespace NLGUI return result; } + // *************************************************************************** + sint64 CLuaState::getTableIntegerValue(const char *name, sint64 defaultValue) + { + //H_AUTO(Lua_CLuaState_getTableIntegerValue) + nlassert(name); + push(name); + getTable(-2); + if (isNil()) + { + pop(); + return defaultValue; + } + sint64 result = toInteger(-1); + pop(); + return result; + } + // *************************************************************************** const char *CLuaState::getTableStringValue(const char *name, const char *defaultValue) { diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index 0a7bacf9b..f1c91c4a4 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -231,20 +231,24 @@ namespace NLGUI } +#if LUA_VERSION_NUM < 503 +#define lua_isinteger(a, b) lua_isnumber(a, b) +#endif + // *************************************************************************** #define LUA_REGISTER_BASIC(_type_) \ - luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \ - _type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \ + luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \ + _type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \ { \ - return (_type_)lua_tonumber(L, index); \ + return (_type_)lua_tointeger(L, index); \ } \ - int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \ + int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \ { \ - if (lua_isnumber(L, index)) return 0; else return -1; \ + if (lua_isinteger(L, index)) return 0; else return -1; \ } \ - void convert_cpp_to_lua(lua_State* L, const _type_& v) \ + void convert_cpp_to_lua(lua_State* L, const _type_& v) \ { \ - lua_pushnumber(L, (double)v); \ + lua_pushinteger(L, (double)v); \ } // Basic LUA types @@ -258,8 +262,6 @@ namespace NLGUI LUA_REGISTER_BASIC(uint16) LUA_REGISTER_BASIC(sint32) LUA_REGISTER_BASIC(uint32) - // LUA_REGISTER_BASIC(sint) - // LUA_REGISTER_BASIC(uint) } } @@ -942,8 +944,8 @@ namespace NLGUI CLuaIHM::checkArgCount(ls, "getWindowSize", 0); uint32 w, h; CViewRenderer::getInstance()->getScreenSize(w, h); - ls.push((double) w); - ls.push((double) h); + ls.push(w); + ls.push(h); return 2; } @@ -974,8 +976,8 @@ namespace NLGUI CIFile fs(CPath::lookup(textureName).c_str()); bitmap.load(fs); - ls.push((double) bitmap.getWidth()); - ls.push((double) bitmap.getHeight()); + ls.push(bitmap.getWidth()); + ls.push(bitmap.getHeight()); return 2; } @@ -1098,7 +1100,7 @@ namespace NLGUI ls.push(value.getBool()); break; case CInterfaceExprValue::Integer: - ls.push((double)value.getInteger()); + ls.push(value.getInteger()); break; case CInterfaceExprValue::Double: ls.push(value.getDouble()); @@ -1361,7 +1363,7 @@ namespace NLGUI ls.newTable(); for(uint k = 0; k < files.size(); ++k) { - ls.push((double) k); + ls.push(k); ls.push(files[k]); ls.setTable(-3); } @@ -1381,10 +1383,10 @@ namespace NLGUI ls.push( (reflectedObject.*(property.GetMethod.GetBool))() ); break; case CReflectedProperty::SInt32: - ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetSInt32))() ); + ls.push( (reflectedObject.*(property.GetMethod.GetSInt32))() ); break; case CReflectedProperty::Float: - ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetFloat))() ); + ls.push( (reflectedObject.*(property.GetMethod.GetFloat))() ); break; case CReflectedProperty::String: ls.push( (reflectedObject.*(property.GetMethod.GetString))() ); @@ -1447,13 +1449,13 @@ namespace NLGUI } case CReflectedProperty::SInt32: { - sint32 val= (sint32)ls.toNumber(stackIndex); + sint32 val= (sint32)ls.toInteger(stackIndex); (target.*(property.SetMethod.SetSInt32))(val); return; } case CReflectedProperty::UInt32: { - uint32 val= (uint32)ls.toNumber(stackIndex); + uint32 val= (uint32)ls.toInteger(stackIndex); (target.*(property.SetMethod.SetUInt32))(val); return; } @@ -1474,7 +1476,7 @@ namespace NLGUI { ucstring val; // Additionaly return of CInterfaceExpr may be std::string... test std string too - if(ls.isString() || ls.isNumber()) + if(ls.isString() || ls.isNumber() || ls.isInteger()) { std::string str; ls.toString(stackIndex, str); diff --git a/code/nel/src/gui/lua_manager.cpp b/code/nel/src/gui/lua_manager.cpp index 95e6767f1..2b354b0e4 100644 --- a/code/nel/src/gui/lua_manager.cpp +++ b/code/nel/src/gui/lua_manager.cpp @@ -33,8 +33,20 @@ namespace NLGUI CLuaManager::~CLuaManager() { - delete luaState; - luaState = NULL; + if (luaState) + { + delete luaState; + luaState = NULL; + } + } + + void CLuaManager::releaseInstance() + { + if (instance) + { + delete instance; + instance = NULL; + } } bool CLuaManager::executeLuaScript( const std::string &luaScript, bool smallScript ) @@ -60,7 +72,8 @@ namespace NLGUI void CLuaManager::ResetLuaState() { - delete luaState; + if (luaState) delete luaState; + luaState = new CLuaState( debugLua ); } diff --git a/code/nel/src/gui/lua_object.cpp b/code/nel/src/gui/lua_object.cpp index a50569858..622157ed9 100644 --- a/code/nel/src/gui/lua_object.cpp +++ b/code/nel/src/gui/lua_object.cpp @@ -150,7 +150,8 @@ namespace NLGUI // ************************************************* bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; } bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; } - bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; } + bool CLuaObject::isInteger() const { push(); bool result = _LuaState->isInteger(); _LuaState->pop(); return result; } + bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; } bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; } bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; } bool CLuaObject::isCFunction() const { push(); bool result = _LuaState->isCFunction(); _LuaState->pop(); return result; } @@ -168,6 +169,7 @@ namespace NLGUI // ************************************************* bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; } lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; } + lua_Integer CLuaObject::toInteger() const { push(); lua_Integer result = _LuaState->toInteger(); _LuaState->pop(); return result; } std::string CLuaObject::toString() const { push(); @@ -194,6 +196,8 @@ namespace NLGUI CLuaObject::operator bool() const { return toBoolean(); } CLuaObject::operator float() const { return (float) toNumber(); } CLuaObject::operator double() const { return (double) toNumber(); } + CLuaObject::operator sint32() const { return (sint32) toInteger(); } + CLuaObject::operator sint64() const { return (sint64) toInteger(); } CLuaObject::operator std::string() const { return toString(); } @@ -385,6 +389,48 @@ namespace NLGUI _LuaState->pop(); } + // ************************************************* + void CLuaObject::setValue(const char *key, uint32 value) throw(ELuaNotATable) + { + nlassert(key); + nlassert(isValid()); + if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%u' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename())); + CLuaStackChecker lsc(_LuaState); + push(); + _LuaState->push(key); + _LuaState->push(value); + _LuaState->setTable(-3); + _LuaState->pop(); + } + + // ************************************************* + void CLuaObject::setValue(const char *key, sint32 value) throw(ELuaNotATable) + { + nlassert(key); + nlassert(isValid()); + if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename())); + CLuaStackChecker lsc(_LuaState); + push(); + _LuaState->push(key); + _LuaState->push(value); + _LuaState->setTable(-3); + _LuaState->pop(); + } + + // ************************************************* + void CLuaObject::setValue(const char *key, sint64 value) throw(ELuaNotATable) + { + nlassert(key); + nlassert(isValid()); + if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d"NL_I64"' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename())); + CLuaStackChecker lsc(_LuaState); + push(); + _LuaState->push(key); + _LuaState->push(value); + _LuaState->setTable(-3); + _LuaState->pop(); + } + // ************************************************* void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable) { diff --git a/code/nel/src/gui/view_pointer.cpp b/code/nel/src/gui/view_pointer.cpp index 3816045b8..da8d730fc 100644 --- a/code/nel/src/gui/view_pointer.cpp +++ b/code/nel/src/gui/view_pointer.cpp @@ -52,6 +52,9 @@ namespace NLGUI _TxIdPanR2 = -2; _TxIdCanPanR2 = -2; + _OffsetX = 0; + _OffsetY = 0; + // The pointer must be draw over ALL layers _RenderLayer= VR_LAYER_MAX; _Color = CRGBA(255,255,255,255); @@ -59,6 +62,7 @@ namespace NLGUI _StringMode = false; _ForceStringMode = false; _StringCursor = NULL; + _StringCursorHardware = NULL; } void CViewPointer::forceLink() @@ -80,56 +84,43 @@ namespace NLGUI _OffsetY = getY(); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_default"); - if (prop) _TxDefault = (const char *) prop; - _TxDefault = NLMISC::strlwr (_TxDefault); + if (prop) _TxDefault = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_move_window"); - if (prop) _TxMoveWindow = (const char *) prop; - _TxMoveWindow = NLMISC::strlwr (_TxMoveWindow); + if (prop) _TxMoveWindow = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BR_TL"); - if (prop) _TxResizeBRTL = (const char *) prop; - _TxResizeBRTL = NLMISC::strlwr (_TxResizeBRTL); + if (prop) _TxResizeBRTL = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BL_TR"); - if (prop) _TxResizeBLTR = (const char *) prop; - _TxResizeBLTR = NLMISC::strlwr (_TxResizeBLTR); + if (prop) _TxResizeBLTR = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_TB"); - if (prop) _TxResizeTB = (const char *) prop; - _TxResizeTB = NLMISC::strlwr (_TxResizeTB); + if (prop) _TxResizeTB = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_LR"); - if (prop) _TxResizeLR = (const char *) prop; - _TxResizeLR = NLMISC::strlwr (_TxResizeLR); + if (prop) _TxResizeLR = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_rotate"); - if (prop) _TxRotate = (const char *) prop; - _TxRotate = NLMISC::strlwr (_TxRotate); + if (prop) _TxRotate = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_scale"); - if (prop) _TxScale = (const char *) prop; - _TxScale = NLMISC::strlwr (_TxScale); + if (prop) _TxScale = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_colpick"); - if (prop) _TxColPick = (const char *) prop; - _TxColPick = NLMISC::strlwr (_TxColPick); + if (prop) _TxColPick = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan"); - if (prop) _TxPan = (const char *) prop; - _TxPan = NLMISC::strlwr (_TxPan); + if (prop) _TxPan = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan"); - if (prop) _TxCanPan = (const char *) prop; - _TxCanPan = NLMISC::strlwr (_TxCanPan); + if (prop) _TxCanPan = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2"); - if (prop) _TxPanR2 = (const char *) prop; - _TxPanR2 = NLMISC::strlwr (_TxPanR2); + if (prop) _TxPanR2 = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2"); - if (prop) _TxCanPanR2 = (const char *) prop; - _TxCanPanR2 = NLMISC::strlwr (_TxCanPanR2); + if (prop) _TxCanPanR2 = NLMISC::toLower ((const char *) prop); prop = (char*) xmlGetProp (cur, (xmlChar*)"color"); if (prop) _Color = convertColor(prop); diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index 6e6675599..0b4d837f3 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -854,12 +854,11 @@ namespace NLGUI return; } // Look if already existing - string sLwrGTName = strlwr(sGlobalTextureName); + string sLwrGTName = toLower(sGlobalTextureName); TGlobalTextureList::iterator ite = _GlobalTextures.begin(); while (ite != _GlobalTextures.end()) { - std::string sText = strlwr(ite->Name); - if (sText == sLwrGTName) + if (toLower(ite->Name) == sLwrGTName) break; ite++; } @@ -984,11 +983,11 @@ namespace NLGUI */ NL3D::UTexture *CViewRenderer::getGlobalTexture(const std::string &name) { - string sLwrGTName = strlwr(name); + string sLwrGTName = NLMISC::toLower(name); TGlobalTextureList::iterator ite = _GlobalTextures.begin(); while (ite != _GlobalTextures.end()) { - std::string sText = strlwr(ite->Name); + std::string sText = NLMISC::toLower(ite->Name); if (sText == sLwrGTName) break; ite++; diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 0e3b420a0..1ccd0ec71 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -42,6 +42,8 @@ namespace NLGUI // *************************************************************************** void CViewText::setupDefault () { + _ParentElm = NULL; + _CaseMode = CaseNormal; _Underlined = false; _StrikeThrough = false; @@ -2650,6 +2652,10 @@ namespace NLGUI void CViewText::onInvalidateContent() { _InvalidTextContext= true; + + if (_ParentElm) + _ParentElm->invalidateCoords(); + invalidateCoords(); } diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index b9efd50d5..9417778f3 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -1026,7 +1026,7 @@ namespace NLGUI void CWidgetManager::reset() { setCurContextHelp( NULL ); - + _ViewsUnderPointer.clear(); _CtrlsUnderPointer.clear(); _GroupsUnderPointer.clear(); @@ -1254,7 +1254,7 @@ namespace NLGUI sint32 wParent, sint32 hParent ) { CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent(); - CInterfaceGroup *groupContextHelp = + CInterfaceGroup *groupContextHelp = getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName()); uint32 _ScreenH, _ScreenW; @@ -1383,7 +1383,7 @@ namespace NLGUI { if (!newCtrl) return; if (!newCtrl->getInvalidCoords()) return; - + CInterfaceGroup *groupContextHelp = getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName()); @@ -1450,7 +1450,7 @@ namespace NLGUI // **** resolve auto posref - uint clampCount = + uint clampCount = adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRef(), newCtrl->getToolTipPosRef(), xParent, yParent, wParent, hParent); @@ -1458,7 +1458,7 @@ namespace NLGUI if (clampCount != 0) { // try to fallback on alternate tooltip posref - uint altClampCount = + uint altClampCount = adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRefAlt(), newCtrl->getToolTipPosRefAlt(), xParent, yParent, wParent, hParent); @@ -1961,6 +1961,7 @@ namespace NLGUI } while (cb); } + // Check if screen size changed uint32 w, h; CViewRenderer::getInstance()->checkNewScreenSize (); @@ -1974,7 +1975,7 @@ namespace NLGUI setScreenWH( w, h ); } } - + // Update global color from database if (!_RProp) { @@ -1983,6 +1984,7 @@ namespace NLGUI _BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B"); _AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A"); } + setGlobalColor(NLMISC::CRGBA( (uint8)_RProp->getValue32(), (uint8)_GProp->getValue32(), @@ -1996,7 +1998,7 @@ namespace NLGUI c.B = gc.B; c.A = (uint8) (( (uint16) c.A * (uint16) getContentAlpha() ) >> 8); setGlobalColorForContent( c ); - + // Update global alphaS from database updateGlobalAlphas(); @@ -2005,7 +2007,7 @@ namespace NLGUI Computed String are rendered in on big drawQuads at last part of each layer */ CDBManager::getInstance()->flushObserverCalls(); - + for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) { CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; @@ -2158,7 +2160,7 @@ namespace NLGUI bool CWidgetManager::handleKeyboardEvent( const CEventDescriptor &evnt ) { bool handled = false; - + CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt; //_LastEventKeyDesc = eventDesc; @@ -2541,7 +2543,7 @@ namespace NLGUI if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup) - { + { if (!handled) if (pNewCurrentWnd != NULL) pNewCurrentWnd->handleEvent(evnt); @@ -2589,7 +2591,7 @@ namespace NLGUI } _CapturedView = NULL; - + if( CInterfaceElement::getEditorMode() ) stopDragging(); } @@ -2634,7 +2636,7 @@ namespace NLGUI if( eventDesc.getType() != CEventDescriptor::mouse ) return false; - const CEventDescriptorMouse &e = static_cast< const CEventDescriptorMouse& >( eventDesc ); + const CEventDescriptorMouse &e = static_cast< const CEventDescriptorMouse& >( eventDesc ); if( e.getEventTypeExtended() != CEventDescriptorMouse::mousemove ) return false; @@ -2699,7 +2701,7 @@ namespace NLGUI e->setParent( NULL ); draggedElement = e; - + return true; } @@ -2715,7 +2717,7 @@ namespace NLGUI g = tw; std::string oldid = e->getId(); - + e->setParent( g ); e->setIdRecurse( e->getShortId() ); e->setParentPos( g ); @@ -2730,7 +2732,7 @@ namespace NLGUI onWidgetMoved( oldid, e->getId() ); } } - + // ------------------------------------------------------------------------------------------------ void CWidgetManager::movePointer (sint32 dx, sint32 dy) { @@ -2866,17 +2868,19 @@ namespace NLGUI void CWidgetManager::unregisterClockMsgTarget(CCtrlBase *vb) { if (!vb) return; - std::vector::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb); + std::list::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb); if (it != _ClockMsgTargets.end()) { - _ClockMsgTargets.erase(it); + // instead of deleting, just mark as deleted incase we are inside iterating loop, + // it will be removed in sendClockTickEvent + (*it) = NULL; } } // *************************************************************************** bool CWidgetManager::isClockMsgTarget(CCtrlBase *vb) const { - std::vector::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb); + std::list::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb); return it != _ClockMsgTargets.end(); } @@ -2895,10 +2899,16 @@ namespace NLGUI } // and send clock tick msg to ctrl that are registered - std::vector clockMsgTarget = _ClockMsgTargets; - for(std::vector::iterator it = clockMsgTarget.begin(); it != clockMsgTarget.end(); ++it) + for(std::list::iterator it = _ClockMsgTargets.begin(); it != _ClockMsgTargets.end();) { - (*it)->handleEvent(clockTick); + CCtrlBase* ctrl = *it; + if (ctrl) + { + ctrl->handleEvent(clockTick); + ++it; + } + else + it = _ClockMsgTargets.erase(it); } } @@ -3083,7 +3093,7 @@ namespace NLGUI { const SMasterGroup &mg = _MasterGroups[ i ]; - std::vector< CInterfaceGroup* >::size_type j; + std::vector< CInterfaceGroup* >::size_type j; for( j = 0; j < mg.Group->getNumGroup(); j++ ) { CInterfaceGroup *g = mg.Group->getGroup( j ); @@ -3098,8 +3108,8 @@ namespace NLGUI return true; } - - + + // *************************************************************************** void CWidgetManager::enableMouseHandling( bool handle ) { @@ -3108,7 +3118,7 @@ namespace NLGUI { if(!getPointer()) return; - + // If Left captured, reset if( getCapturePointerLeft() ) setCapturePointerLeft( NULL ); @@ -3116,12 +3126,12 @@ namespace NLGUI // Same for Right if( getCapturePointerRight() ) setCapturePointerRight( NULL ); - + // Avoid any problem with modals disableModalWindow(); } } - + // *************************************************************************** uint CWidgetManager::getUserDblClickDelay() { @@ -3129,11 +3139,11 @@ namespace NLGUI NLMISC::CCDBNodeLeaf *pNL = CDBManager::getInstance()->getDbProp("UI:SAVE:DOUBLE_CLICK_SPEED"); if( pNL != NULL ) nVal = pNL->getValue32(); - + uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f); return dbclickDelay; } - + // ------------------------------------------------------------------------------------------------ void CWidgetManager::setupOptions() { @@ -3157,9 +3167,9 @@ namespace NLGUI _SystemOptions[OptionTimeoutContext]= opt->getValue("context_timeout"); _SystemOptions[OptionTimeoutContextHtml]= opt->getValue("context_html_timeout"); } - + } - + // Get the alpha roll over speed float CWidgetManager::getAlphaRolloverSpeed() { @@ -3173,7 +3183,7 @@ namespace NLGUI { _AlphaRolloverSpeedDB = NULL; } - + void CWidgetManager::setContainerAlpha(uint8 alpha) { _ContainerAlpha = alpha; @@ -3368,11 +3378,11 @@ namespace NLGUI void CWidgetManager::selectWidget( const std::string &name ) { - std::vector< std::string >::iterator itr + std::vector< std::string >::iterator itr = std::find( editorSelection.begin(), editorSelection.end(), name ); CInterfaceElement *e = getElementFromId( name ); - + if( itr != editorSelection.end() ) { // If multiselection is on unselect if already selected @@ -3397,7 +3407,7 @@ namespace NLGUI e->setEditorSelected( true ); editorSelection.push_back( name ); } - + } notifySelectionWatchers(); @@ -3414,7 +3424,7 @@ namespace NLGUI std::vector< IEditorSelectionWatcher* >::iterator itr = selectionWatchers.begin(); while( itr != selectionWatchers.end() ) { - (*itr)->selectionChanged(); + (*itr)->selectionChanged(); ++itr; } } @@ -3423,7 +3433,7 @@ namespace NLGUI { std::vector< IEditorSelectionWatcher* >::iterator itr = std::find( selectionWatchers.begin(), selectionWatchers.end(), watcher ); - + // We already have this watcher if( itr != selectionWatchers.end() ) return; @@ -3435,7 +3445,7 @@ namespace NLGUI { std::vector< IEditorSelectionWatcher* >::iterator itr = std::find( selectionWatchers.begin(), selectionWatchers.end(), watcher ); - + // We don't have this watcher if( itr == selectionWatchers.end() ) return; @@ -3465,7 +3475,7 @@ namespace NLGUI void CWidgetManager::registerWidgetWatcher( IWidgetWatcher *watcher ) { - std::vector< IWidgetWatcher* >::const_iterator itr + std::vector< IWidgetWatcher* >::const_iterator itr = std::find( widgetWatchers.begin(), widgetWatchers.end(), watcher ); // already exists if( itr != widgetWatchers.end() ) @@ -3516,7 +3526,7 @@ namespace NLGUI g->addView( v ); onWidgetAdded( v->getId() ); - + return v; } @@ -3560,7 +3570,7 @@ namespace NLGUI e->setParent( g ); e->setParentPos( g ); e->setParentSize( g ); - e->setIdRecurse( e->getShortId() ); + e->setIdRecurse( e->getShortId() ); onWidgetMoved( oldId, e->getId() ); } @@ -3572,9 +3582,9 @@ namespace NLGUI g->alignElements(); // Align the new group to the top window g->alignTo( getTopWindow() ); - + g->setActive( true ); - + return true; } @@ -3626,7 +3636,7 @@ namespace NLGUI SMasterGroup mg; mg.Group = root; - + root->setIdRecurse( project ); root->setW( 1024 ); root->setH( 768 ); @@ -3658,7 +3668,7 @@ namespace NLGUI VariableData v; v.type = "sint32"; v.value = "255"; - + v.entry = "UI:SAVE:COLOR:R"; parser->setVariable( v ); @@ -3670,7 +3680,7 @@ namespace NLGUI v.entry = "UI:SAVE:COLOR:A"; parser->setVariable( v ); - + return true; } diff --git a/code/nel/src/logic/logic_state_machine.cpp b/code/nel/src/logic/logic_state_machine.cpp index 0edc7bd14..94a8c6587 100644 --- a/code/nel/src/logic/logic_state_machine.cpp +++ b/code/nel/src/logic/logic_state_machine.cpp @@ -49,7 +49,7 @@ void xmlCheckNodeName (xmlNodePtr &node, const char *nodeName) // Make an error message char tmp[512]; smprintf (tmp, 512, "LogicStateMachine STATE_MACHINE XML Syntax error in block line %d, node %s should be %s", - (int)node->line, node->name, nodeName); + node ? (int)node->line:-1, node->name, nodeName); nlinfo (tmp); nlstop; diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index 8cdbf0fe6..4805209cb 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -187,6 +187,12 @@ IF(JPEG_FOUND) TARGET_LINK_LIBRARIES(nelmisc ${JPEG_LIBRARY}) ENDIF(JPEG_FOUND) +IF(GIF_FOUND) + INCLUDE_DIRECTORIES(${GIF_INCLUDE_DIR}) + ADD_DEFINITIONS(-DUSE_GIF) + TARGET_LINK_LIBRARIES(nelmisc ${GIF_LIBRARY}) +ENDIF(GIF_FOUND) + IF(WITH_STATIC OR WIN32) TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARIES}) ELSE(WITH_STATIC OR WIN32) diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index f32980508..30c708929 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -134,6 +134,19 @@ uint8 CBitmap::load(NLMISC::IStream &f, uint mipMapSkip) } #endif // USE_JPEG +#ifdef USE_GIF + if (fileType == GIF_HEADER) + { +#ifdef NEL_ALL_BITMAP_WHITE + uint8 result = readGIF(f); + MakeWhite (*this); + return result; +#else // NEL_ALL_BITMAP_WHITE + return readGIF(f); +#endif // NEL_ALL_BITMAP_WHITE + } +#endif // USE_GIF + // assuming it's TGA NLMISC::IStream::TSeekOrigin origin= f.begin; if(!f.seek (0, origin)) @@ -3149,6 +3162,25 @@ void CBitmap::loadSize(NLMISC::IStream &f, uint32 &retWidth, uint32 &retHeight) } while(!eof); } + else if(fileType == GIF_HEADER) + { + // check second part of header ("7a" or "9a" in 'GIF89a') + uint16 s; + f.serial(s); + if (s != 0x6137 && s != 0x6139) + { + nlwarning("Invalid GIF header, expected GIF87a or GIF89a"); + return; + } + + uint16 lsWidth; + uint16 lsHeight; + f.serial(lsWidth); + f.serial(lsHeight); + + retWidth = lsWidth; + retHeight = lsHeight; + } // assuming it's TGA else { diff --git a/code/nel/src/misc/bitmap_gif.cpp b/code/nel/src/misc/bitmap_gif.cpp new file mode 100644 index 000000000..355e2a2bf --- /dev/null +++ b/code/nel/src/misc/bitmap_gif.cpp @@ -0,0 +1,315 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdmisc.h" +#include "nel/misc/bitmap.h" + +#ifdef USE_GIF +#include +#endif + +using namespace std; + +namespace NLMISC +{ + +#ifdef USE_GIF + +// GIFLIB_MAJOR is defined from version 5 +#ifndef GIFLIB_MAJOR +#define GIFLIB_MAJOR 4 +#endif + +static uint8 GIF_TRANSPARENT_MASK = 0x01; +static uint8 GIF_DISPOSE_MASK = 0x07; +static sint8 GIF_NOT_TRANSPARENT = -1; + +static uint8 GIF_DISPOSE_NONE = 0; +static uint8 GIF_DISPOSE_LEAVE = 1; +static uint8 GIF_DISPOSE_BACKGROUND = 2; +static uint8 GIF_DISPOSE_RESTORE = 3; + +static NLMISC::IStream *GIFStream = NULL; + +#if GIFLIB_MAJOR < 5 +static uint8 INTERLACED_OFFSET[] = { 0, 4, 2, 1 }; +static uint8 INTERLACED_JUMP[] = { 8, 8, 4, 2 }; +#endif + +static int readGIFData(GifFileType *gif, GifByteType *data, int length){ + NLMISC::IStream *f = static_cast(gif->UserData); + + if(!f->isReading()) return 0; + + try + { + f->serialBuffer((uint8*) data, length); + } + catch(...) + { + nlwarning("error while reading JPEG image"); + + return 0; + } + + return length; +} + +/*-------------------------------------------------------------------*\ + readGIF +\*-------------------------------------------------------------------*/ +uint8 CBitmap::readGIF( NLMISC::IStream &f ) +{ + if(!f.isReading()) return false; + + { + // check gif canvas dimension + uint16 ver; + uint16 width; + uint16 height; + + f.serial(ver); + f.serial(width); + f.serial(height); + + // limit image size as we are using 32bit pixels + // 4000x4000x4 ~ 61MiB + if (width*height > 4000*4000) + { + nlwarning("GIF image size is too big (width=%d, height=%d)", width, height); + return 0; + } + + // rewind for gif decoder + f.seek(-10, IStream::current); + } + +#if GIFLIB_MAJOR >= 5 + sint32 errorCode; + GifFileType *gif = DGifOpen(&f, readGIFData, &errorCode); + if (gif == NULL) + { + nlwarning("failed to open gif, error=%d", errorCode); + return 0; + } +#else + GifFileType *gif = DGifOpen(&f, readGIFData); + if (gif == NULL) + { + nlwarning("failed to open gif, error=%d", GifLastError()); + return 0; + } +#endif + + // this will read and decode all frames + sint32 ret = DGifSlurp(gif); + if (ret != GIF_OK) + { + nlwarning("failed to read gif, error=%d", ret); +#if GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1 + DGifCloseFile(gif, &errorCode); +#else + DGifCloseFile(gif); +#endif + return 0; + } + + // resize target buffer + uint32 dstChannels = 4; // RGBA + resize (gif->SWidth, gif->SHeight, RGBA); + + // make transparent + _Data[0].fill(0); + + // make sure background color index exists in global colormap + if (gif->SColorMap && gif->SColorMap->ColorCount < gif->SBackGroundColor) + { + gif->SBackGroundColor = 0; + } + + // merge all frames one by one into single target + ColorMapObject *ColorMap; + sint32 transparency = GIF_NOT_TRANSPARENT; + uint8 r, g, b, a; + uint32 offset_x, offset_y, width, height; + + // disable loop as we only interested in first frame + // for (uint32 frame = 0; frame < gif->ImageCount; frame++) + { + uint32 frame = 0; + SavedImage *curFrame = &gif->SavedImages[frame]; + + if (curFrame->ExtensionBlockCount > 0) + { + for(uint e=0; eExtensionBlockCount; e++){ + ExtensionBlock *ext = &curFrame->ExtensionBlocks[e]; + + if (ext->Function == GRAPHICS_EXT_FUNC_CODE) { + uint8 flag = ext->Bytes[0]; + //delay = (ext.Bytes[1] << 8) | ext.Bytes[2]; + transparency = (flag & GIF_TRANSPARENT_MASK) ? ext->Bytes[3] : GIF_NOT_TRANSPARENT; + //dispose = ((flag >> 2) & GIF_DISPOSE_MASK); + } + } + } + + // select color map for frame + if (curFrame->ImageDesc.ColorMap) + { + ColorMap = curFrame->ImageDesc.ColorMap; + } + else + if (gif->SColorMap) + { + ColorMap = gif->SColorMap; + } + else + { + nlwarning("GIF has no global or local color map"); + ColorMap = NULL; + } + + // copy frame to canvas + offset_x = curFrame->ImageDesc.Left; + offset_y = curFrame->ImageDesc.Top; + width = curFrame->ImageDesc.Width; + height = curFrame->ImageDesc.Height; + +#if GIFLIB_MAJOR < 5 + // giflib 4 does not handle interlaced images, so we must do it + if (curFrame->ImageDesc.Interlace) + { + uint32 srcOffset = 0; + for (uint8 pass = 0; pass < 4; pass++) + { + uint32 nextLine = INTERLACED_OFFSET[pass]; + + // y is destination row + for (uint32 y = 0; y < height; y++) + { + if (y != nextLine) + continue; + + uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels; + nextLine += INTERLACED_JUMP[pass]; + + for (uint32 x = 0; x < width; x++) + { + srcOffset++; + dstOffset+= dstChannels; + + uint32 index = curFrame->RasterBits[srcOffset]; + if (index != transparency) + { + // make sure color index is not outside colormap + if (ColorMap) + { + if (index > ColorMap->ColorCount) + { + index = 0; + } + r = ColorMap->Colors[index].Red; + g = ColorMap->Colors[index].Green; + b = ColorMap->Colors[index].Blue; + } + else + { + // broken gif, no colormap + r = g = b = 0; + } + a = 255; + } + else + { + // transparent + r = g = b = a = 0; + } + + _Data[0][dstOffset] = r; + _Data[0][dstOffset+1] = g; + _Data[0][dstOffset+2] = b; + _Data[0][dstOffset+3] = a; + } // x loop + } // y loop + } // pass loop + } + else +#endif + for (uint32 y = 0; y < height; y++) + { + uint32 srcOffset = y*width; + uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels; + for (uint32 x = 0; x < width; x++) + { + srcOffset++; + dstOffset+= dstChannels; + + uint32 index = curFrame->RasterBits[srcOffset]; + if (index != transparency) + { + // make sure color index is not outside colormap + if (ColorMap) + { + if (index > ColorMap->ColorCount) + { + index = 0; + } + r = ColorMap->Colors[index].Red; + g = ColorMap->Colors[index].Green; + b = ColorMap->Colors[index].Blue; + } + else + { + // broken gif, no colormap + r = g = b = 0; + } + a = 255; + } + else + { + // transparent + r = g = b = a = 0; + } + + _Data[0][dstOffset] = r; + _Data[0][dstOffset+1] = g; + _Data[0][dstOffset+2] = b; + _Data[0][dstOffset+3] = a; + } // x loop + } // y loop + } + + // clean up after the read, and free any memory allocated +#if GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1 + DGifCloseFile(gif, &errorCode); +#else + DGifCloseFile(gif); +#endif + + //return the size of a pixel as 32bits + return 32; +} + +#else + +uint8 CBitmap::readGIF( NLMISC::IStream &/* f */) +{ + nlwarning ("You must compile NLMISC with USE_GIF if you want gif support"); + return 0; +} + +#endif +}//namespace diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 8183430f1..83f1916d9 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -440,7 +440,7 @@ NLMISC_CATEGORISED_COMMAND(nel,hrtob, "Convert a human readable number into a by string secondsToHumanReadable (uint32 time) { static const char *divTable[] = { "s", "mn", "h", "d" }; - static uint divCoef[] = { 60, 60, 24 }; + static uint divCoef[] = { 60, 60, 24 }; uint div = 0; uint32 res = time; uint32 newres = res; @@ -671,13 +671,13 @@ bool launchProgram(const std::string &programName, const std::string &arguments, { #ifdef NL_OS_WINDOWS - STARTUPINFOA si; - PROCESS_INFORMATION pi; + STARTUPINFOA si; + PROCESS_INFORMATION pi; - memset(&si, 0, sizeof(si)); - memset(&pi, 0, sizeof(pi)); + memset(&si, 0, sizeof(si)); + memset(&pi, 0, sizeof(pi)); - si.cb = sizeof(si); + si.cb = sizeof(si); /* SECURITY_ATTRIBUTES sa; sa.nLength = sizeof (sa); @@ -781,7 +781,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments, nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err); } else if (status == 0) - { + { // Exec (the only allowed instruction after vfork) status = execvp(programName.c_str(), &argv.front()); @@ -1009,50 +1009,87 @@ NLMISC_CATEGORISED_COMMAND(nel, killProgram, "kill a program given the pid", "

31); + } + } + } + else + { + return true; + } +#else + // TODO: implement for Linux and Mac OS X + nlunreferenced(document); +#endif // NL_OS_WINDOWS + + return false; +} + bool openURL (const char *url) { #ifdef NL_OS_WINDOWS - char key[1024]; - if (GetRegKey(HKEY_CLASSES_ROOT, ".html", key) == ERROR_SUCCESS) - { - lstrcatA(key, "\\shell\\open\\command"); - - if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) - { - char *pos; - pos = strstr(key, "\"%1\""); - if (pos == NULL) { // No quotes found - pos = strstr(key, "%1"); // Check for %1, without quotes - if (pos == NULL) // No parameter at all... - pos = key+lstrlenA(key)-1; - else - *pos = '\0'; // Remove the parameter - } - else - *pos = '\0'; // Remove the parameter - - lstrcatA(pos, " "); - lstrcatA(pos, url); - int res = WinExec(key,SW_SHOWDEFAULT); - return (res>31); - } - } + return openDocWithExtension(url, "htm"); #elif defined(NL_OS_MAC) return launchProgram("open", url); #elif defined(NL_OS_UNIX) @@ -1060,53 +1097,17 @@ bool openURL (const char *url) #else nlwarning("openURL() is not implemented for this OS"); #endif // NL_OS_WINDOWS + return false; } bool openDoc (const char *document) { -#ifdef NL_OS_WINDOWS - string ext = CFile::getExtension (document); - char key[MAX_PATH + MAX_PATH]; + // get extension from document fullpath + string ext = CFile::getExtension(document); - // First try ShellExecute() - HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT); - - // If it failed, get the .htm regkey and lookup the program - if ((uintptr_t)result <= HINSTANCE_ERROR) - { - if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS) - { - lstrcatA(key, "\\shell\\open\\command"); - - if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) - { - char *pos; - pos = strstr(key, "\"%1\""); - if (pos == NULL) { // No quotes found - pos = strstr(key, "%1"); // Check for %1, without quotes - if (pos == NULL) // No parameter at all... - pos = key+lstrlenA(key)-1; - else - *pos = '\0'; // Remove the parameter - } - else - *pos = '\0'; // Remove the parameter - - lstrcatA(pos, " "); - lstrcatA(pos, document); - int res = WinExec(key,SW_SHOWDEFAULT); - return (res>31); - } - } - } - else - return true; -#else - // TODO: implement for Linux and Mac OS X - nlunreferenced(document); -#endif // NL_OS_WINDOWS - return false; + // try to open document + return openDocWithExtension(document, ext.c_str()); } } // NLMISC diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 798161a21..bcd2d25cb 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -79,8 +79,7 @@ using namespace std; #define LOG_IN_FILE NEL_LOG_IN_FILE // If true, debug system will trap crash even if the application is in debugger -//static const bool TrapCrashInDebugger = false; -static const bool TrapCrashInDebugger = true; +static const bool TrapCrashInDebugger = false; #ifdef DEBUG_NEW #define new DEBUG_NEW diff --git a/code/nel/src/misc/displayer.cpp b/code/nel/src/misc/displayer.cpp index 57b3e09d4..e1738592c 100644 --- a/code/nel/src/misc/displayer.cpp +++ b/code/nel/src/misc/displayer.cpp @@ -700,6 +700,9 @@ void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *m # endif abort(); break; + + default: + break; } // no more sent mail for crash diff --git a/code/nel/src/misc/i18n.cpp b/code/nel/src/misc/i18n.cpp index e53750af7..99e9c68a0 100644 --- a/code/nel/src/misc/i18n.cpp +++ b/code/nel/src/misc/i18n.cpp @@ -20,6 +20,12 @@ #include "nel/misc/path.h" #include "nel/misc/i18n.h" +#include + +#ifdef NL_OS_MAC +#include +#endif + using namespace std; #ifdef DEBUG_NEW @@ -52,11 +58,13 @@ void CI18N::initLanguages() _LanguageCodes.push_back("fr"); _LanguageCodes.push_back("de"); _LanguageCodes.push_back("ru"); + _LanguageCodes.push_back("es"); _LanguageNames.push_back(ucstring("English")); _LanguageNames.push_back(ucstring("French")); _LanguageNames.push_back(ucstring("German")); _LanguageNames.push_back(ucstring("Russian")); + _LanguageNames.push_back(ucstring("Spanish")); _LanguagesNamesLoaded = true; } @@ -226,6 +234,108 @@ string CI18N::getCurrentLanguageCode () return _SelectedLanguageCode; } +bool CI18N::isLanguageCodeSupported(const std::string &lang) +{ + initLanguages(); + + for (sint i = 0, ilen = _LanguageCodes.size(); i < ilen; ++i) + { + if (lang == _LanguageCodes[i]) return true; + } + + return false; +} + +std::string CI18N::getSystemLanguageCode () +{ + static std::string s_cachedSystemLanguage; + + if (!s_cachedSystemLanguage.empty()) + return s_cachedSystemLanguage; + +#ifdef NL_OS_MAC + // under OS X, locale is only defined in console, not in UI + // so we need to use CoreFoundation API to retrieve it + + // get an array with all preferred languages + CFArrayRef langs = CFLocaleCopyPreferredLanguages(); + + if (langs) + { + // get languages count + sint languagesCount = CFArrayGetCount(langs); + + // process each language + for (sint i = 0; i < languagesCount; ++i) + { + std::string lang; + + // get language CFString + CFStringRef langCF = (CFStringRef)CFArrayGetValueAtIndex(langs, i); + + if (langCF) + { + // get a C string from CFString + const char *langStr = CFStringGetCStringPtr(langCF, kCFStringEncodingASCII); + + if (!langStr) + { + // get length of the CFString + CFIndex length = CFStringGetLength(langCF); + + // allocate a temporary buffer to hold converted string + char *tmp = new char[length+1]; + + // use alternative function to get a C string from CFString + if (CFStringGetCString(langCF, tmp, length+1, kCFStringEncodingASCII)) + { + lang = std::string(tmp, length); + } + else + { + nlerror("Unable to convert CFStringRef to string"); + } + + delete [] tmp; + } + else + { + lang = std::string(langStr); + } + + CFRelease(langCF); + } + + // only keep language code if supported by NeL + if (!lang.empty() && isLanguageCodeSupported(lang)) + { + s_cachedSystemLanguage = lang; + break; + } + } + + // don't need languages array anymore + CFRelease(langs); + } +#endif + + // use system locale (works under Linux and Windows) + if (s_cachedSystemLanguage.empty()) + { + std::string lang = NLMISC::toLower(std::string(setlocale(LC_CTYPE, ""))); + + // only keep 2 first characters + if (lang.size() > 1) + s_cachedSystemLanguage = lang.substr(0, 2); + } + + // english is default language + if (s_cachedSystemLanguage.empty()) + s_cachedSystemLanguage = "en"; + + return s_cachedSystemLanguage; +} + void CI18N::removeCComment(ucstring &commentedString) { ucstring temp; diff --git a/code/nel/src/misc/mutex.cpp b/code/nel/src/misc/mutex.cpp index 8135d954f..af0e850ab 100644 --- a/code/nel/src/misc/mutex.cpp +++ b/code/nel/src/misc/mutex.cpp @@ -677,7 +677,7 @@ void CFairMutex::debugEndEnter() if (_Mutex == (void*)0x88) { OutputDebugString (str); - if (entered) __asm int 3; + if (entered) __debugbreak(); entered = true; } */ @@ -704,7 +704,7 @@ void CFairMutex::debugLeave() if (_Mutex == (void*)0x88) { OutputDebugString (str); - if (!entered) __asm int 3; + if (!entered) __debugbreak(); entered = false; } */ diff --git a/code/nel/src/misc/rgba.cpp b/code/nel/src/misc/rgba.cpp index 2ab5eabf3..822ee1006 100644 --- a/code/nel/src/misc/rgba.cpp +++ b/code/nel/src/misc/rgba.cpp @@ -298,7 +298,8 @@ void CRGBA::modulateColors(CRGBA *dest, const CRGBA *src1, const CRGBA *src2, ui uint64 blank = 0; /// well, this could be further optimized when stride is 4 if (dup == 1) - { __asm + { + __asm { push ebp movq mm2, blank @@ -733,17 +734,23 @@ void CRGBA::buildFromHLS(float h, float l, float s) CRGBA CRGBA::stringToRGBA( const char *ptr ) { - if (!ptr) - return NLMISC::CRGBA::White; + if (ptr) + { + int r = 255, g = 255, b = 255, a = 255; + + // we need at least 3 integer values to consider string is valid + if (sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a ) >= 3) + { + clamp( r, 0, 255 ); + clamp( g, 0, 255 ); + clamp( b, 0, 255 ); + clamp( a, 0, 255 ); - int r = 255, g = 255, b = 255, a = 255; - sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a ); - clamp( r, 0, 255 ); - clamp( g, 0, 255 ); - clamp( b, 0, 255 ); - clamp( a, 0, 255 ); - - return CRGBA( r,g,b,a ); + return CRGBA( r,g,b,a ); + } + } + + return NLMISC::CRGBA::White; } std::string CRGBA::toString() const diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 8524939c8..a5b78c08b 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -185,11 +185,12 @@ string CSystemInfo::getOS() typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); + typedef LONG (WINAPI* pRtlGetVersion)(OSVERSIONINFOEXA*); SYSTEM_INFO si; PGNSI pGNSI; PGPI pGPI; - OSVERSIONINFOEX osvi; + OSVERSIONINFOEXA osvi; BOOL bOsVersionInfoEx; const int BUFSIZE = 80; @@ -197,15 +198,26 @@ string CSystemInfo::getOS() // If that fails, try using the OSVERSIONINFO structure. ZeroMemory(&si, sizeof(SYSTEM_INFO)); - ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + ZeroMemory(&osvi, sizeof(osvi)); + osvi.dwOSVersionInfoSize = sizeof(osvi); - bOsVersionInfoEx = GetVersionExA ((OSVERSIONINFO *) &osvi); + HMODULE hNtDll = GetModuleHandleA("ntdll.dll"); + pRtlGetVersion RtlGetVersion = (pRtlGetVersion)GetProcAddress(hNtDll, "RtlGetVersion"); + + if (RtlGetVersion) + { + bOsVersionInfoEx = RtlGetVersion(&osvi) == 0; + } if(!bOsVersionInfoEx) { - osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (! GetVersionExA ( (OSVERSIONINFO *) &osvi) ) + bOsVersionInfoEx = GetVersionExA ((OSVERSIONINFOA *) &osvi); + } + + if(!bOsVersionInfoEx) + { + osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOA); + if (! GetVersionExA ( (OSVERSIONINFOA *) &osvi) ) return OSString+" Can't GetVersionEx()"; } @@ -223,13 +235,24 @@ string CSystemInfo::getOS() { OSString = "Microsoft"; - if ( osvi.dwMajorVersion > 6 ) + if ( osvi.dwMajorVersion > 10 ) { OSString += " Windows (not released)"; } + else if ( osvi.dwMajorVersion == 10 ) + { + OSString += " Windows 10"; + } else if ( osvi.dwMajorVersion == 6 ) { - if ( osvi.dwMinorVersion == 2 ) + if ( osvi.dwMinorVersion == 3 ) + { + if( osvi.wProductType == VER_NT_WORKSTATION ) + OSString += " Windows 8.1"; + else + OSString += " Windows Server 2012 R2"; + } + else if ( osvi.dwMinorVersion == 2 ) { if( osvi.wProductType == VER_NT_WORKSTATION ) OSString += " Windows 8"; diff --git a/code/nel/src/net/callback_net_base.cpp b/code/nel/src/net/callback_net_base.cpp index 661e47336..7a117f640 100644 --- a/code/nel/src/net/callback_net_base.cpp +++ b/code/nel/src/net/callback_net_base.cpp @@ -114,7 +114,7 @@ void *CCallbackNetBase::getUserData() */ void CCallbackNetBase::addCallbackArray (const TCallbackItem *callbackarray, sint arraysize) { - if (arraysize == 1 && callbackarray[0].Callback == NULL && string("") == callbackarray[0].Key) + if (arraysize == 1 && callbackarray[0].Callback == NULL && strlen(callbackarray[0].Key) == 0) { // it's an empty array, ignore it return; diff --git a/code/nel/src/pacs/global_retriever.cpp b/code/nel/src/pacs/global_retriever.cpp index 115fac0e6..27b32fbf1 100644 --- a/code/nel/src/pacs/global_retriever.cpp +++ b/code/nel/src/pacs/global_retriever.cpp @@ -752,7 +752,7 @@ sint32 NLPACS::CGlobalRetriever::getIdentifier(const string &id) const const string &NLPACS::CGlobalRetriever::getIdentifier(const NLPACS::UGlobalPosition &position) const { - static const string nullString = string(""); + static const string nullString; if (position.InstanceId == -1) return nullString; @@ -784,7 +784,7 @@ bool NLPACS::CGlobalRetriever::buildInstance(const string &id, const NLMISC::C const CRetrieverInstance &instance = makeInstance(retrieverId, 0, CVector(position)); // check make instance success - if (&instance == NULL || instance.getInstanceId() == -1 || instance.getRetrieverId() != retrieverId) + if (instance.getInstanceId() == -1 || instance.getRetrieverId() != retrieverId) return false; // links new instance to its neighbors diff --git a/code/nel/src/sound/audio_decoder.cpp b/code/nel/src/sound/audio_decoder.cpp index 74193949c..d8283c227 100644 --- a/code/nel/src/sound/audio_decoder.cpp +++ b/code/nel/src/sound/audio_decoder.cpp @@ -124,7 +124,12 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st /// Get audio/container extensions that are currently supported by the nel sound library. void IAudioDecoder::getMusicExtensions(std::vector &extensions) { - extensions.push_back("ogg"); + // only add ogg format if not already in extensions list + if (std::find(extensions.begin(), extensions.end(), "ogg") == extensions.end()) + { + extensions.push_back("ogg"); + } + // extensions.push_back("wav"); // TODO: Easy. } diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 3a75433f4..9ac90b3c7 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -54,6 +54,7 @@ #include "nel/sound/sound_bank.h" #include "nel/sound/group_controller.h" #include "nel/sound/containers.h" +#include "nel/sound/audio_decoder.h" using namespace std; using namespace NLMISC; @@ -2689,21 +2690,30 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res { std::string artist; std::string title; - if (_SoundDriver->getMusicInfo(filename, artist, title)) + + if (!_SoundDriver->getMusicInfo(filename, artist, title)) { - if (!title.empty()) - { - if (!artist.empty()) result = artist + " - " + title; - else result = title; - } - else if (!artist.empty()) - { - result = artist + " - " + CFile::getFilename(filename); - } - else result = CFile::getFilename(filename); - return true; + // use 3rd party libraries supported formats + IAudioDecoder::getInfo(filename, artist, title); } + + if (!title.empty()) + { + if (!artist.empty()) result = artist + " - " + title; + else result = title; + } + else if (!artist.empty()) + { + result = artist + " - " + CFile::getFilename(filename); + } + else + { + result = CFile::getFilename(filename); + } + + return true; } + result = "???"; return false; } @@ -2751,7 +2761,14 @@ bool CAudioMixerUser::isEventMusicEnded() /// Get audio/container extensions that are currently supported by nel or the used driver implementation. void CAudioMixerUser::getMusicExtensions(std::vector &extensions) { - _SoundDriver->getMusicExtensions(extensions); + if (_SoundDriver) + { + // add file formats supported by driver + _SoundDriver->getMusicExtensions(extensions); + } + + // add 3rd party libraries support file formats + IAudioDecoder::getMusicExtensions(extensions); } /// Add a reverb environment diff --git a/code/nel/src/sound/driver/openal/driver_openal.def b/code/nel/src/sound/driver/openal/driver_openal.def index a8b0c2781..cf5a0aaf2 100644 --- a/code/nel/src/sound/driver/openal/driver_openal.def +++ b/code/nel/src/sound/driver/openal/driver_openal.def @@ -1,4 +1,3 @@ -LIBRARY nel_drv_openal_win_r EXPORTS NLSOUND_createISoundDriverInstance NLSOUND_interfaceVersion diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.cpp b/code/nel/src/sound/driver/openal/sound_driver_al.cpp index 82f52b782..4aa358062 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.cpp +++ b/code/nel/src/sound/driver/openal/sound_driver_al.cpp @@ -630,7 +630,11 @@ void CSoundDriverAL::commit3DChanges() /// Write information about the driver to the output stream. void CSoundDriverAL::writeProfile(std::string& out) { - // TODO + out = toString("OpenAL\n"); + out += toString("Source size: %u\n", (uint32)_Sources.size()); + out += toString("Effects size: %u\n", (uint32)_Effects.size()); + + // TODO: write other useful information like OpenAL version and supported extensions } // Does not create a sound loader .. what does it do then? diff --git a/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def b/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def index 2a29a2d91..cf5a0aaf2 100644 --- a/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def +++ b/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def @@ -1,4 +1,3 @@ -LIBRARY nel_drv_xaudio2_win_r EXPORTS NLSOUND_createISoundDriverInstance NLSOUND_interfaceVersion diff --git a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp index b95735fc5..3cc7a7dd2 100644 --- a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp @@ -179,7 +179,7 @@ CSoundDriverXAudio2::CSoundDriverXAudio2(ISoundDriver::IStringMapperProvider * / uint32 flags = 0; #ifdef NL_DEBUG - flags |= XAUDIO2_DEBUG_ENGINE; // comment when done using this :) +// flags |= XAUDIO2_DEBUG_ENGINE; // comment when done using this :) #endif // XAudio2 diff --git a/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp index 21290951c..021935e50 100644 --- a/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp @@ -32,7 +32,7 @@ using namespace NLMISC; namespace NLSOUND { CSourceXAudio2::CSourceXAudio2(CSoundDriverXAudio2 *soundDriver) -: _SoundDriver(soundDriver), _SourceVoice(NULL), _StaticBuffer(NULL), _OperationSet(soundDriver->getUniqueOperationSet()), +: _SoundDriver(soundDriver), _SourceVoice(NULL), _StaticBuffer(NULL), _LastPreparedBuffer(NULL), _OperationSet(soundDriver->getUniqueOperationSet()), _Format(IBuffer::FormatUnknown), _Frequency(0), _PlayStart(0), _Doppler(1.0f), _Pos(0.0f, 0.0f, 0.0f), _Relative(false), _Alpha(1.0), _DirectDryVoice(NULL), _DirectFilterVoice(NULL), _EffectDryVoice(NULL), _EffectFilterVoice(NULL), @@ -407,6 +407,7 @@ void CSourceXAudio2::submitStreamingBuffer(IBuffer *buffer) uint32 frequency; buffer->getFormat(bufferFormat, channels, bitsPerSample, frequency); preparePlay(bufferFormat, channels, bitsPerSample, frequency); + _LastPreparedBuffer = NULL; } submitBuffer(static_cast(buffer)); @@ -455,7 +456,8 @@ void CSourceXAudio2::setLooping(bool l) if (FAILED(_SourceVoice->FlushSourceBuffers())) nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers"); // resubmit with updated looping settings - submitBuffer(_StaticBuffer); + if (_LastPreparedBuffer == _StaticBuffer) + submitBuffer(_StaticBuffer); } else { @@ -478,7 +480,8 @@ void CSourceXAudio2::setLooping(bool l) if (FAILED(_SourceVoice->FlushSourceBuffers())) nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers"); // queue buffer with correct looping parameters - submitBuffer(_StaticBuffer); + if (_LastPreparedBuffer == _StaticBuffer) + submitBuffer(_StaticBuffer); } } } @@ -635,6 +638,7 @@ bool CSourceXAudio2::play() _StaticBuffer->getChannels(), _StaticBuffer->getBitsPerSample(), _StaticBuffer->getFrequency()); + _LastPreparedBuffer = _StaticBuffer; submitBuffer(_StaticBuffer); _PlayStart = CTime::getLocalTime(); if (SUCCEEDED(_SourceVoice->Start(0))) _IsPlaying = true; @@ -663,6 +667,8 @@ void CSourceXAudio2::stop() // stop source voice and remove pending buffers _SoundDriver->getXAudio2()->CommitChanges(_OperationSet); + if (FAILED(_SourceVoice->ExitLoop())) + nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED ExitLoop"); if (FAILED(_SourceVoice->Stop(0))) nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Stop"); if (FAILED(_SourceVoice->FlushSourceBuffers())) diff --git a/code/nel/src/sound/driver/xaudio2/source_xaudio2.h b/code/nel/src/sound/driver/xaudio2/source_xaudio2.h index a2d542349..4e50774b2 100644 --- a/code/nel/src/sound/driver/xaudio2/source_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/source_xaudio2.h @@ -41,6 +41,8 @@ private: CSoundDriverXAudio2 *_SoundDriver; /// Buffer that should be playing. CBufferXAudio2 *_StaticBuffer; + /// Last buffer that was prepared for playing. + CBufferXAudio2 *_LastPreparedBuffer; // -- Pointers -- /// Source voice, can be NULL! diff --git a/code/nel/tools/3d/ig_elevation/main.cpp b/code/nel/tools/3d/ig_elevation/main.cpp index 3983dc4ec..f44015873 100644 --- a/code/nel/tools/3d/ig_elevation/main.cpp +++ b/code/nel/tools/3d/ig_elevation/main.cpp @@ -53,7 +53,7 @@ using namespace NL3D; // --------------------------------------------------------------------------- // Out a string to the stdout and log.log -void outString (string &sText) +void outString (const string &sText) { createDebug (); InfoLog->displayRaw(sText.c_str()); diff --git a/code/ryzom/client/client_default.cfg.in b/code/ryzom/client/client_default.cfg.in index ec699fe14..8dbd2855d 100644 --- a/code/ryzom/client/client_default.cfg.in +++ b/code/ryzom/client/client_default.cfg.in @@ -483,7 +483,7 @@ XMLR2EDInterfaceFiles = { "r2ed.xml", "r2_triggers.xml", - "r2_logic_entities.xml", + "r2_logic_entities.xml", "r2ed_acts.xml", "r2ed_scenario.xml", "r2ed_connect.xml" diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.lua b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.lua index b5ed493d7..5354e1cc7 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/game_config.lua +++ b/code/ryzom/client/data/gamedev/interfaces_v3/game_config.lua @@ -19,7 +19,7 @@ end ------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------ --- WIDGET TO CHOOSE A COLOR +-- WIDGET TO CHOOSE A COLOR ------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------ @@ -29,14 +29,14 @@ function game:mcwChooseColor(title, pal) local ui = getUICaller(); - -- get the color of the button and store it in temporary db location + -- get the color of the button and store it in temporary db location local rgba = ui.col_normal_rgba; game.ColorPicker.r = rgba.R; game.ColorPicker.g = rgba.G; game.ColorPicker.b = rgba.B; game.ColorPicker.button = ui; game.ColorPicker.pal = pal; - + -- setup the color picker window local uiModalWin = getUI('ui:interface:define_mcw_color'); if (game.ColorPicker.pal == 0) then @@ -64,8 +64,8 @@ end -- called when we have finished choosing the color in the modal window and the chosen color is valid function game:mcwValidateColor() - if (game.ColorPicker.button == nil) then - return; + if (game.ColorPicker.button == nil) then + return; end game.ColorPicker.button.col_normal = game.ColorPicker.r .. ' ' .. game.ColorPicker.g .. ' ' .. game.ColorPicker.b; --debugInfo(game.ColorPicker.button.col_normal) @@ -108,10 +108,10 @@ end -- hide all the pages of the config window function game:configHideAll() - local uiList = { + local uiList = { 'explanation', 'general', 'landscape', 'fx', 'char', 'hud', 'language', 'alpha_colors', - 'chat_colors', 'entity_colors', 'in_scene_user', 'in_scene_friend', 'in_scene_enemy', - 'in_scene_chat_messages', 'win_colors', 'win_colors_r2', 'mouse', 'keyb', 'vr', 'sound', 'landmark_colors', 'help' + 'chat_colors', 'entity_colors', 'in_scene_user', 'in_scene_friend', 'in_scene_enemy', + 'in_scene_chat_messages', 'win_colors', 'win_colors_r2', 'mouse', 'keyb', 'vr', 'sound', 'landmark_colors', 'help' }; for k,v in pairs(uiList) do @@ -127,19 +127,19 @@ function game:configShowOne(strUIToShow) game:configHideAll(); -- special case : if the display tab was shown, update the aspect ratio if needed local generalGrp = getUI('ui:interface:game_config:content:general'); - local uiGrp = getUI('ui:interface:game_config:content:' .. strUIToShow); + local uiGrp = getUI('ui:interface:game_config:content:' .. strUIToShow); -- Removed the following code to solve RT n°14720 - -- The 'game_config_change_screen_ratio_custom' action handler - -- should only be called if the user changed the apect ratio himself + -- The 'game_config_change_screen_ratio_custom' action handler + -- should only be called if the user changed the apect ratio himself -- (else the edit box containing the aspect ratio may not have been initiliazed here) - --if uiGrp ~= generalGrp then + --if uiGrp ~= generalGrp then -- runAH(nil, 'game_config_change_screen_ratio_custom', '') --end uiGrp.active = true; end ------------------------------------------------------------------------------------------------------------ --- +-- function game:configInit() -- init language @@ -187,9 +187,9 @@ function game:configInit() winActive("wc_r2_dialogs", r2WinOn) winActive("wc_r2_events", r2WinOn) winActive("wc_r2_activities", r2WinOn) - winActive("wc_r2_feature_help", r2WinOn) - winActive("wc_r2_connect", not r2WinOn) - winActive("wc_r2_session_browser", not r2WinOn) - winActive("wc_r2_scenario_control", true) + winActive("wc_r2_feature_help", r2WinOn) + winActive("wc_r2_connect", not r2WinOn) + winActive("wc_r2_session_browser", not r2WinOn) + winActive("wc_r2_scenario_control", true) winActive("wc_r2_player_tracking", r2WinOn) end diff --git a/code/ryzom/client/src/animation_fx.cpp b/code/ryzom/client/src/animation_fx.cpp index ee4016b67..7be1a79a9 100644 --- a/code/ryzom/client/src/animation_fx.cpp +++ b/code/ryzom/client/src/animation_fx.cpp @@ -61,8 +61,7 @@ void CAnimationFX::buildTrack(NL3D::UAnimationSet *as) nlassert(Sheet != NULL); if (!as) return; if (Sheet->TrajectoryAnim.empty()) return; - std::string animName = Sheet->TrajectoryAnim; - NLMISC::strlwr(animName); + std::string animName = NLMISC::toLower(Sheet->TrajectoryAnim); uint id = as->getAnimationIdByName(animName); NL3D::UAnimation *anim = NULL; if (id != NL3D::UAnimationSet::NotFound) diff --git a/code/ryzom/client/src/app_bundle_utils.cpp b/code/ryzom/client/src/app_bundle_utils.cpp index b42b00b98..42d1b61bc 100644 --- a/code/ryzom/client/src/app_bundle_utils.cpp +++ b/code/ryzom/client/src/app_bundle_utils.cpp @@ -17,53 +17,57 @@ #include "stdpch.h" #include "app_bundle_utils.h" -#if defined(NL_OS_MAC) +#ifdef NL_OS_MAC #include #endif std::string getAppBundlePath() { - static std::string cachedPathToBundle; + static std::string s_cachedPathToBundle; - if(cachedPathToBundle.size()) - return cachedPathToBundle; + if (!s_cachedPathToBundle.empty()) + return s_cachedPathToBundle; #if defined(NL_OS_MAC) // get the bundle CFBundleRef bundle = CFBundleGetMainBundle(); - if(bundle) + if (bundle) { // get the url to the bundles root CFURLRef url = CFBundleCopyBundleURL(bundle); - if(url) + if (url) { // get the file system path CFStringRef str; - str = CFURLCopyFileSystemPath( - CFURLCopyAbsoluteURL(url), kCFURLPOSIXPathStyle); + str = CFURLCopyFileSystemPath(CFURLCopyAbsoluteURL(url), kCFURLPOSIXPathStyle); CFRelease(url); - if(str) + if (str) { - cachedPathToBundle = CFStringGetCStringPtr( - str, CFStringGetSmallestEncoding(str)); + s_cachedPathToBundle = CFStringGetCStringPtr(str, CFStringGetSmallestEncoding(str)); CFRelease(str); } else + { nlerror("CFStringGetCStringPtr"); + } } else + { nlerror("CFBundleCopyBundleURL"); + } } else + { nlerror("CFBundleGetMainBundle"); + } #elif defined(NL_OS_WINDOWS) char buffer[MAX_PATH+1]; if (GetModuleFileNameA(NULL, buffer, MAX_PATH)) - cachedPathToBundle = NLMISC::CPath::standardizePath(NLMISC::CFile::getPath(buffer), false); + s_cachedPathToBundle = NLMISC::CPath::standardizePath(NLMISC::CFile::getPath(buffer), false); #endif // defined(NL_OS_MAC) - return cachedPathToBundle; + return s_cachedPathToBundle; } diff --git a/code/ryzom/client/src/auto_anim.cpp b/code/ryzom/client/src/auto_anim.cpp index 5776b285c..5cc21305a 100644 --- a/code/ryzom/client/src/auto_anim.cpp +++ b/code/ryzom/client/src/auto_anim.cpp @@ -81,7 +81,7 @@ void initAutoAnimation() file.getline(line, 512); // Read the animation file - string animName = strlwr (CFile::getFilenameWithoutExtension(line)); + string animName = toLower(CFile::getFilenameWithoutExtension(line)); uint id = AutoAnimSet->addAnimation (line, animName.c_str ()); if (id == UAnimationSet::NotFound) { diff --git a/code/ryzom/client/src/browse_faq.cpp b/code/ryzom/client/src/browse_faq.cpp index 8311087eb..3899a2960 100644 --- a/code/ryzom/client/src/browse_faq.cpp +++ b/code/ryzom/client/src/browse_faq.cpp @@ -24,21 +24,26 @@ void browseFAQ(NLMISC::CConfigFile &cf) std::string url; std::string languageCode = "wk"; CConfigFile::CVar *languageCodeVarPtr = cf.getVarPtr("LanguageCode"); + if (languageCodeVarPtr) { languageCode = languageCodeVarPtr->asString(); } + CConfigFile::CVar *helpPages = cf.getVarPtr("HelpPages"); + if (helpPages) { for (uint i = 0; i < helpPages->size(); ++i) { std::string entry = helpPages->asString(i); + if (entry.size() >= languageCode.size()) { if (nlstricmp(entry.substr(0, languageCode.size()), languageCode) == 0) { std::string::size_type pos = entry.find("="); + if (pos != std::string::npos) { url = entry.substr(pos + 1); diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index f4892eb70..029fd9486 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -610,7 +610,7 @@ uint32 CCharacterCL::buildEquipment(const CCharacterSheet::CEquipment &slot, SLO { // IS the item a valid one ? CSheetId itemId; - if(itemId.buildSheetId(NLMISC::strlwr(slot.getItem()))) + if(itemId.buildSheetId(NLMISC::toLower(slot.getItem()))) { // Is it stored in the database ? CEntitySheet *entitySheet = SheetMngr.get(itemId); @@ -1098,7 +1098,7 @@ string CCharacterCL::automatonType() const // virtual //----------------------------------------------- void CCharacterCL::computeAutomaton() { - _CurrentAutomaton = automatonType() + "_" + NLMISC::strlwr(MBEHAV::modeToString(_Mode)) + ".automaton"; + _CurrentAutomaton = automatonType() + "_" + NLMISC::toLower(MBEHAV::modeToString(_Mode)) + ".automaton"; }// computeAutomaton // diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index d3bb5254e..a312c3978 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -49,9 +49,6 @@ #define FINAL_VERSION 1 #endif // TEST_CRASH_COUNTER -// game share -#include "game_share/ryzom_version.h" - // Client #include "resource.h" #include "init.h" @@ -124,6 +121,12 @@ static void sigHandler(int Sig) //--------------------------------------------------- #ifdef NL_OS_WINDOWS +// enable optimus for NVIDIA cards +extern "C" +{ + _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; +} + void pump () { // Display the window @@ -363,6 +366,11 @@ int main(int argc, char **argv) // init the Nel context CApplicationContext *appContext = new CApplicationContext; + // disable nldebug messages in logs in Release +#ifdef NL_RELEASE + DisableNLDebug = true; +#endif + createDebug(); INelContext::getInstance().setWindowedApplication(true); @@ -443,10 +451,9 @@ int main(int argc, char **argv) if (string(cmdline) == "/crash") volatile int toto = *(int*)0; if (string(cmdline) == "/break") - __asm - { - int 3 - }; + { + __debugbreak(); + } #endif // TEST_CRASH_COUNTER HInstance = hInstance; @@ -513,7 +520,7 @@ int main(int argc, char **argv) uint i; for (i=0; i - /////////// // MACRO // /////////// @@ -295,8 +293,8 @@ CClientConfig::CClientConfig() SelectedSlot = 0; // Default is slot 0 Windowed = false; // Default is windowed mode. - Width = 800; // Default Width for the window. - Height = 600; // Default Height for the window. + Width = 0; // Default Width for the window (0 = current screen resolution). + Height = 0; // Default Height for the window (0 = current screen resolution). Depth = 32; // Default Bit per Pixel. Driver3D = DrvAuto; // Select best driver depending on hardware. Contrast = 0.f; // Default Monitor Contrast. @@ -431,6 +429,8 @@ CClientConfig::CClientConfig() WebIgMainDomain = "shard.ryzomcore.org"; WebIgTrustedDomains.push_back(WebIgMainDomain); + CurlMaxConnections = 2; + RingReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes_ring/index.php"; ReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes/index.php"; @@ -680,7 +680,6 @@ CClientConfig::CClientConfig() DamageShieldEnabled = false; AllowDebugLua = false; - LoadLuaDebugger = false; DisplayLuaDebugInfo = false; BeepWhenLaunched = false; @@ -1076,6 +1075,9 @@ void CClientConfig::setValues() // WEBIG // READ_STRING_FV(WebIgMainDomain); READ_STRINGVECTOR_FV(WebIgTrustedDomains); + READ_INT_FV(CurlMaxConnections); + if (ClientCfg.CurlMaxConnections < 0) + ClientCfg.CurlMaxConnections = 2; /////////////// // ANIMATION // @@ -1747,7 +1749,7 @@ void CClientConfig::setValues() // Allow warning display only first time. DisplayCFGWarning= false; - // If it is the load time, bkup the ClientCfg into LastClientCfg + // If it is the load time, backup the ClientCfg into LastClientCfg if(firstTimeSetValues) LastClientCfg = ClientCfg; @@ -1761,7 +1763,6 @@ void CClientConfig::setValues() READ_BOOL_DEV(DamageShieldEnabled) READ_BOOL_DEV(AllowDebugLua) - READ_BOOL_DEV(LoadLuaDebugger) READ_BOOL_DEV(DisplayLuaDebugInfo) READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled) @@ -1934,8 +1935,7 @@ void CClientConfig::init(const string &configFileName) nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ()); // get current locale - std::string lang = toLower(std::string(setlocale(LC_CTYPE, ""))); - lang = lang.substr(0, 2); + std::string lang = CI18N::getSystemLanguageCode(); const std::vector &languages = CI18N::getLanguageCodes(); diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 7d7f1c65d..8f96b4244 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -304,6 +304,7 @@ struct CClientConfig std::string WebIgMainDomain; std::vector WebIgTrustedDomains; + sint32 CurlMaxConnections; /////////////// // ANIMATION // @@ -765,7 +766,6 @@ struct CClientConfig /// Allow Lua commands (commands beginning with Lua) bool AllowDebugLua; - bool LoadLuaDebugger; bool LuaDebugInfoGotoButtonEnabled; std::string LuaDebugInfoGotoButtonTemplate; diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 90287955d..d7d0cb210 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -929,7 +929,7 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic" } else { - std::string type = NLMISC::strlwr(args[0]); + std::string type = NLMISC::toLower(args[0]); if (type == "none") Verbose = VerboseNone; else if(type == "magic") @@ -3913,20 +3913,12 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "") } -#if defined(NL_OS_WINDOWS) NLMISC_COMMAND (url, "launch a browser to the specified url", "") { if (args.size () != 1) return false; - HINSTANCE result = ShellExecute(NULL, "open", args[0].c_str(), NULL,NULL, SW_SHOW); - if ((intptr_t)result > 32) - return true; - else - { - log.displayNL ("ShellExecute failed %d", (uint32)(intptr_t)result); - return false; - } + return openURL(args[0].c_str()); } NLMISC_COMMAND( reconnect, "Reconnect to the same shard (self Far TP)", "") @@ -3949,8 +3941,6 @@ NLMISC_COMMAND( reconnect, "Reconnect to the same shard (self Far TP)", "") return true; } -#endif // !FINAL_VERSION - struct CItemSheetSort { const CItemSheet *IS; diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 3f3a3d809..a2d139294 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -187,7 +187,7 @@ bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos // Restore the video mode (fullscreen for example) after the connection (done in a window) -void connectionRestaureVideoMode () +void connectionRestoreVideoMode () { // Setup full screen if we have to UDriver::CMode mode; @@ -213,11 +213,11 @@ void connectionRestaureVideoMode () (ClientCfg.Width != mode.Width) || (ClientCfg.Height != mode.Height))) { - mode.Windowed = ClientCfg.Windowed; - mode.Depth = uint8(ClientCfg.Depth); - mode.Width = ClientCfg.Width; - mode.Height = ClientCfg.Height; - mode.Frequency= ClientCfg.Frequency; + mode.Windowed = ClientCfg.Windowed; + mode.Depth = uint8(ClientCfg.Depth); + mode.Width = ClientCfg.Width; + mode.Height = ClientCfg.Height; + mode.Frequency = ClientCfg.Frequency; setVideoMode(mode); } @@ -342,7 +342,7 @@ bool connection (const string &cookie, const string &fsaddr) // init the string manager cache. STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS #endif - connectionRestaureVideoMode (); + connectionRestoreVideoMode (); return true; } @@ -513,7 +513,7 @@ bool reconnection() // init the string manager cache. STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS #endif - connectionRestaureVideoMode (); + connectionRestoreVideoMode (); return true; } */ @@ -1266,10 +1266,10 @@ TInterfaceState globalMenu() } - // Restaure video mode + // Restore video mode if (ClientCfg.SelectCharacter == -1) { - connectionRestaureVideoMode (); + connectionRestoreVideoMode (); } // Skip intro next time @@ -2682,7 +2682,7 @@ class CAHScenarioControl : public IActionHandler // init current scenario name and parameters if(!R2::getEditor().isInitialized()) { - ScenarioFileName = string(""); + ScenarioFileName.clear(); // empty scenario CInterfaceElement *result = scenarioWnd->findFromShortId(string("scenario_value_text")); @@ -2950,7 +2950,7 @@ class CAHLoadScenario : public IActionHandler } // description - string description = string(""); + string description; result = scenarioWnd->findFromShortId(string("edit_small_description")); if(result) { diff --git a/code/ryzom/client/src/continent.cpp b/code/ryzom/client/src/continent.cpp index 4bebe5749..65bf11de7 100644 --- a/code/ryzom/client/src/continent.cpp +++ b/code/ryzom/client/src/continent.cpp @@ -522,7 +522,7 @@ void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress // Associate IGs with the ZC number or -1 if there is no ZC. for(uint i = 0; i this zone should be a ZC. - string outpostZone = strlwr(CFile::getFilenameWithoutExtension(ZCList[j].Name)); + string outpostZone = toLower(CFile::getFilenameWithoutExtension(ZCList[j].Name)); if(igZone == outpostZone) { nlctassert(RZ_MAX_BUILDING_PER_OUTPOST==4); @@ -788,7 +788,7 @@ void CContinent::reloadFogMap() const R2::CScenarioEntryPoints::CCompleteIsland *completeIsland = R2::CScenarioEntryPoints::getInstance().getCompleteIslandFromCoords(CVector2f((float) UserEntity->pos().x, (float) UserEntity->pos().y)); if (completeIsland) { - std::string islandName = strlwr(completeIsland->Island); + std::string islandName = toLower(completeIsland->Island); std::string::size_type lastPos = islandName.find_last_of("_"); if (lastPos != std::string::npos) { diff --git a/code/ryzom/client/src/continent_manager.cpp b/code/ryzom/client/src/continent_manager.cpp index 87172ce1a..ddc4bff89 100644 --- a/code/ryzom/client/src/continent_manager.cpp +++ b/code/ryzom/client/src/continent_manager.cpp @@ -183,7 +183,7 @@ void CContinentManager::preloadSheets() for (i = 0; i < ws->ContLocs.size(); ++i) { const SContLoc &clTmp = ws->ContLocs[i]; - std::string continentSheetName = NLMISC::strlwr(clTmp.ContinentName); + std::string continentSheetName = NLMISC::toLower(clTmp.ContinentName); if (continentSheetName.find(".continent") == std::string::npos) { continentSheetName += ".continent"; diff --git a/code/ryzom/client/src/cursor_functions.cpp b/code/ryzom/client/src/cursor_functions.cpp index 8c3bc3a32..f318784a6 100644 --- a/code/ryzom/client/src/cursor_functions.cpp +++ b/code/ryzom/client/src/cursor_functions.cpp @@ -572,7 +572,7 @@ void checkUnderCursor() selectedInstance.getMaterial(j).setShininess( 10.0f ); } selectedInstance = noSelectedInstance; - selectedInstanceURL = string(""); + selectedInstanceURL.clear(); } } SlotUnderCursor = CLFECOMMON::INVALID_SLOT; diff --git a/code/ryzom/client/src/debug_client.cpp b/code/ryzom/client/src/debug_client.cpp index 0af4207ae..79f8ae4a4 100644 --- a/code/ryzom/client/src/debug_client.cpp +++ b/code/ryzom/client/src/debug_client.cpp @@ -36,7 +36,7 @@ #include "user_entity.h" #include "view.h" #include "login.h" -#include "game_share/ryzom_version.h" +#include "user_agent.h" #include "interface_v3/interface_manager.h" #include "interface_v3/sphrase_manager.h" #include "entities.h" @@ -526,7 +526,7 @@ string getDebugInformation() str += toString("ConnectState: %s\n", NetMngr.getConnectionStateCStr()); str += toString("LocalAddress: %s\n", NetMngr.getAddress().asString().c_str()); str += toString("Language: %s\n", CI18N::getCurrentLanguageName().toString().c_str()); - str += toString("ClientVersion: "RYZOM_VERSION"\n"); + str += toString("ClientVersion: %s\n", getDebugVersion().c_str()); if (ClientCfg.R2Mode) { str += toString("PatchVersion: %s\n", R2ServerVersion.c_str()); diff --git a/code/ryzom/client/src/door_manager.cpp b/code/ryzom/client/src/door_manager.cpp index 8ac8aeeb5..543d7b415 100644 --- a/code/ryzom/client/src/door_manager.cpp +++ b/code/ryzom/client/src/door_manager.cpp @@ -248,8 +248,7 @@ void CDoorManager::SDoor::checkToClose() std::string CDoorManager::transformName (uint /* index */, const std::string &/* instanceName */, const std::string &shapeName) { if (shapeName.rfind('.') == string::npos) return shapeName; - string sExt = shapeName.substr(shapeName.rfind('.')+1,shapeName.size()); - sExt = strlwr(sExt); + string sExt = toLower(shapeName.substr(shapeName.rfind('.')+1,shapeName.size())); if (sExt != "pacs_prim") return shapeName; return ""; // Do not load a pacs prim as a mesh... } @@ -266,8 +265,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig) string sShapeName = ig->getShapeName(k); if (sShapeName.rfind('.') == string::npos) continue; - string sExt = sShapeName.substr(sShapeName.rfind('.')+1,sShapeName.size()); - sExt = strlwr(sExt); + string sExt = toLower(sShapeName.substr(sShapeName.rfind('.')+1,sShapeName.size())); if (sExt != "pacs_prim") continue; // Check if the pacs_prim is a door detection @@ -349,7 +347,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig) case SDoor::Matis3PartBourgeon: { string sDebug = ig->getShapeName(i); - sDebug = strlwr(sDebug.substr(sDebug.rfind('_')+1,sDebug.size())); + sDebug = toLower(sDebug.substr(sDebug.rfind('_')+1,sDebug.size())); if (sDebug == "gauche") pDoor->Instances[0] = i; else if (sDebug == "droite") @@ -362,7 +360,7 @@ void CDoorManager::loadedCallback (NL3D::UInstanceGroup *ig) case SDoor::Zorai2Part: { string sDebug = ig->getShapeName(i); - sDebug = strlwr(sDebug.substr(sDebug.rfind('_')+1,sDebug.size())); + sDebug = toLower(sDebug.substr(sDebug.rfind('_')+1,sDebug.size())); if (sDebug == "gauche") pDoor->Instances[0] = i; else if (sDebug == "droite") diff --git a/code/ryzom/client/src/entity_animation_manager.cpp b/code/ryzom/client/src/entity_animation_manager.cpp index db1eccb01..98a56cc3c 100644 --- a/code/ryzom/client/src/entity_animation_manager.cpp +++ b/code/ryzom/client/src/entity_animation_manager.cpp @@ -205,7 +205,7 @@ void CEntityAnimationManager::load(NLMISC::IProgressCallback &/* progress */, bo for (uint32 i = 0; i < pASLS->AnimSetList.size(); ++i) { CAnimationSet as; - string sTmp = strlwr(pASLS->AnimSetList[i].Name); + string sTmp = toLower(pASLS->AnimSetList[i].Name); sTmp = sTmp.substr(0,sTmp.rfind('.')); pair::iterator, bool> it; it = _AnimSet.insert(pair(sTmp,as)); diff --git a/code/ryzom/client/src/ground_fx_manager.cpp b/code/ryzom/client/src/ground_fx_manager.cpp index f13309183..c0650a38e 100644 --- a/code/ryzom/client/src/ground_fx_manager.cpp +++ b/code/ryzom/client/src/ground_fx_manager.cpp @@ -520,7 +520,7 @@ void CGroundFXManager::update(const NLMISC::CVectorD &camPos) } if (!fxName.empty()) { - stdFXName = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(fxName)); + stdFXName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fxName)); } // is an fx already attached to the entity ? if (_SortedInstances[k]->HasFX) diff --git a/code/ryzom/client/src/ig_callback.cpp b/code/ryzom/client/src/ig_callback.cpp index 410a690cd..49b790d77 100644 --- a/code/ryzom/client/src/ig_callback.cpp +++ b/code/ryzom/client/src/ig_callback.cpp @@ -197,7 +197,7 @@ void CIGCallback::CIGInstance::instanceGroupAdded() uint numInstances = _IG->getNumInstance(); for(uint k = 0; k < numInstances; ++k) { - TPacsPrimMap::iterator pbIt = PacsPrims.find(NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(_IG->getShapeName(k)))); + TPacsPrimMap::iterator pbIt = PacsPrims.find(NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(_IG->getShapeName(k)))); if (pbIt != PacsPrims.end()) { // compute orientation and position diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a6883eacd..6a6120d1c 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -48,8 +48,6 @@ // Std. #include #include -// Game Share -#include "game_share/ryzom_version.h" // Client #include "init.h" #include "input.h" @@ -89,6 +87,7 @@ #include "interface_v3/add_on_manager.h" #include "bg_downloader_access.h" +#include "user_agent.h" #include "nel/misc/check_fpu.h" @@ -506,8 +505,7 @@ void checkDriverVersion() uint i; for (i=0; i< sizeofarray(driversVersion); i++) { - string lwr = deviceName; - strlwr(lwr); + string lwr = toLower(deviceName); if ((lwr.find (driversTest[i])!=string::npos) && (driversNTest[i]==NULL || lwr.find (driversNTest[i])==string::npos)) { if (driverVersion < driversVersion[i]) @@ -837,11 +835,7 @@ void prelogInit() displayCPUInfo(); // Display the client version. -#if FINAL_VERSION - nlinfo("RYZOM VERSION : FV %s ("__DATE__" "__TIME__")", RYZOM_VERSION); -#else - nlinfo("RYZOM VERSION : DEV %s ("__DATE__" "__TIME__")", RYZOM_VERSION); -#endif + nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str()); FPU_CHECKER_ONCE @@ -953,6 +947,45 @@ void prelogInit() return; } + // used to determine screen default resolution + if (ClientCfg.Width < 800 || ClientCfg.Height < 600) + { + UDriver::CMode mode; + + CConfigFile::CVar *varPtr = NULL; + + if (!ClientCfg.Windowed && Driver->getCurrentScreenMode(mode)) + { + ClientCfg.Width = mode.Width; + ClientCfg.Height = mode.Height; + ClientCfg.Depth = mode.Depth; + ClientCfg.Frequency = mode.Frequency; + + // update client.cfg with detected depth and frequency + varPtr = ClientCfg.ConfigFile.getVarPtr("Depth"); + if(varPtr) + varPtr->forceAsInt(ClientCfg.Depth); + + varPtr = ClientCfg.ConfigFile.getVarPtr("Frequency"); + if(varPtr) + varPtr->forceAsInt(ClientCfg.Frequency); + } + else + { + ClientCfg.Width = 1024; + ClientCfg.Height = 768; + } + + // update client.cfg with detected resolution + varPtr = ClientCfg.ConfigFile.getVarPtr("Width"); + if(varPtr) + varPtr->forceAsInt(ClientCfg.Width); + + varPtr = ClientCfg.ConfigFile.getVarPtr("Height"); + if(varPtr) + varPtr->forceAsInt(ClientCfg.Height); + } + CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_VideoModeSetup, "login_step_video_mode_setup")); FPU_CHECKER_ONCE @@ -1256,7 +1289,7 @@ void initBotObjectSelection() { // IS the item a valid one ? CSheetId itemId; - if(itemId.buildSheetId(NLMISC::strlwr(strShape))) + if(itemId.buildSheetId(NLMISC::toLower(strShape))) { // Get this item sheet ? CItemSheet *itemSheet= dynamic_cast(SheetMngr.get(itemId)); diff --git a/code/ryzom/client/src/init_main_loop.cpp b/code/ryzom/client/src/init_main_loop.cpp index 390b82e15..48b970d11 100644 --- a/code/ryzom/client/src/init_main_loop.cpp +++ b/code/ryzom/client/src/init_main_loop.cpp @@ -97,7 +97,6 @@ // Sound #include "nel/sound/sound_anim_manager.h" // Game share -#include "game_share/ryzom_version.h" #include "game_share/light_cycle.h" #include "sound_manager.h" #include "precipitation_clip_grid.h" diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index b76bbce21..ca0860c11 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2990,12 +2990,15 @@ public: if (Driver == NULL) return; VideoModes.clear(); - vector stringModeList; + vector stringModeList, stringFreqList; + sint nFoundMode, nFoundFreq; - sint nFoundMode = getRyzomModes(VideoModes, stringModeList); + getRyzomModes(VideoModes, stringModeList, stringFreqList, nFoundMode, nFoundFreq); // Initialize interface combo box CInterfaceManager *pIM = CInterfaceManager::getInstance(); + + // resolutions CDBGroupComboBox *pCB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_MODES_COMBO )); if( pCB ) { @@ -3003,11 +3006,23 @@ public: for (sint j = 0; j < (sint)stringModeList.size(); j++) pCB->addText(ucstring(stringModeList[j])); } + + // frequencies + pCB= dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_FREQS_COMBO )); + if( pCB ) + { + pCB->resetTexts(); + for (sint j = 0; j < (sint)stringFreqList.size(); j++) + pCB->addText(ucstring(stringFreqList[j])); + } + // -1 is important to indicate we set this value in edit mode NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_MODE_DB )->setValue32(-1); - NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(-1); NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_MODE_DB )->setValue32(nFoundMode); + NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(-1); + NLGUI::CDBManager::getInstance()->getDbProp( GAME_CONFIG_VIDEO_FREQ_DB )->setValue32(nFoundFreq); + CCtrlBaseButton *pBut = dynamic_cast(CWidgetManager::getInstance()->getElementFromId( GAME_CONFIG_VIDEO_FULLSCREEN_BUTTON )); if (pBut) { diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 68ceb7bf0..f6385cb53 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -141,7 +141,7 @@ int CDBCtrlSheet::luaGetHpBuff(CLuaState &ls) uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet); CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId); - ls.push((double)itemInfo.HpBuff); + ls.push(itemInfo.HpBuff); return 1; } @@ -153,7 +153,7 @@ int CDBCtrlSheet::luaGetSapBuff(CLuaState &ls) uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet); CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId); - ls.push((double)itemInfo.SapBuff); + ls.push(itemInfo.SapBuff); return 1; } @@ -165,7 +165,7 @@ int CDBCtrlSheet::luaGetFocusBuff(CLuaState &ls) uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet); CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId); - ls.push((double)itemInfo.FocusBuff); + ls.push(itemInfo.FocusBuff); return 1; } @@ -177,7 +177,7 @@ int CDBCtrlSheet::luaGetStaBuff(CLuaState &ls) uint32 itemSlotId= getInventory().getItemSlotId(ctrlSheet); CClientItemInfo itemInfo = getInventory().getItemInfo(itemSlotId); - ls.push((double)itemInfo.StaBuff); + ls.push(itemInfo.StaBuff); return 1; } @@ -333,29 +333,29 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr prop = (char*) xmlGetProp( cur, (xmlChar*)"nature" ); if (prop) { - if (NLMISC::strlwr(prop.str()) == "item") + if (NLMISC::toLower(prop.str()) == "item") _Type = CCtrlSheetInfo::SheetType_Item; - else if (NLMISC::strlwr(prop.str()) == "pact") + else if (NLMISC::toLower(prop.str()) == "pact") _Type = CCtrlSheetInfo::SheetType_Pact; - else if (NLMISC::strlwr(prop.str()) == "skill") + else if (NLMISC::toLower(prop.str()) == "skill") _Type = CCtrlSheetInfo::SheetType_Skill; - else if (NLMISC::strlwr(prop.str()) == "auto") + else if (NLMISC::toLower(prop.str()) == "auto") _Type = CCtrlSheetInfo::SheetType_Auto; - else if (NLMISC::strlwr(prop.str()) == "macro") + else if (NLMISC::toLower(prop.str()) == "macro") _Type = CCtrlSheetInfo::SheetType_Macro; - else if (NLMISC::strlwr(prop.str()) == "guild_flag") + else if (NLMISC::toLower(prop.str()) == "guild_flag") _Type = CCtrlSheetInfo::SheetType_GuildFlag; - else if (NLMISC::strlwr(prop.str()) == "mission") + else if (NLMISC::toLower(prop.str()) == "mission") _Type = CCtrlSheetInfo::SheetType_Mission; - else if (NLMISC::strlwr(prop.str()) == "sbrick") + else if (NLMISC::toLower(prop.str()) == "sbrick") _Type = CCtrlSheetInfo::SheetType_SBrick; - else if (NLMISC::strlwr(prop.str()) == "sphraseid") + else if (NLMISC::toLower(prop.str()) == "sphraseid") _Type = CCtrlSheetInfo::SheetType_SPhraseId; - else if (NLMISC::strlwr(prop.str()) == "sphrase") + else if (NLMISC::toLower(prop.str()) == "sphrase") _Type = CCtrlSheetInfo::SheetType_SPhrase; - else if (NLMISC::strlwr(prop.str()) == "elevator_destination") + else if (NLMISC::toLower(prop.str()) == "elevator_destination") _Type = CCtrlSheetInfo::SheetType_ElevatorDestination; - else if (NLMISC::strlwr(prop.str()) == "outpost_building") + else if (NLMISC::toLower(prop.str()) == "outpost_building") _Type = CCtrlSheetInfo::SheetType_OutpostBuilding; } @@ -363,8 +363,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_noitem" ); if (prop) { - string TxName = (const char *) prop; - TxName = strlwr (TxName); + string TxName = toLower((const char *) prop); CViewRenderer &rVR = *CViewRenderer::getInstance(); _DispNoSheetBmpId = rVR.getTextureIdFromName (TxName); } @@ -410,27 +409,23 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_l" ); if (prop) { - string tmp = (const char *) prop; - _ListMenuLeft = strlwr(tmp); + _ListMenuLeft = toLower((const char *) prop); } prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" ); if (prop) { - string tmp = (const char *) prop; - _ListMenuRight = strlwr(tmp); + _ListMenuRight = toLower((const char *) prop); } prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r_empty_slot" ); if (prop) { - string tmp = (const char *) prop; - _ListMenuRightEmptySlot = strlwr(tmp); + _ListMenuRightEmptySlot = toLower((const char *) prop); } // list menu on both clicks prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_b" ); if (prop) { - string tmp = (const char *) prop; - setListMenuBoth(strlwr(tmp)); + setListMenuBoth(toLower((const char *) prop)); } // _BrickTypeBitField @@ -1745,7 +1740,7 @@ void CDBCtrlSheet::resetCharBitmaps() void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar, bool topDown) { // Use the optString for the Macro name - _OptString = strlwr(_OptString); + _OptString = toLower(_OptString); CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance(); diff --git a/code/ryzom/client/src/interface_v3/group_compas.cpp b/code/ryzom/client/src/interface_v3/group_compas.cpp index d4d0631ce..590bf916b 100644 --- a/code/ryzom/client/src/interface_v3/group_compas.cpp +++ b/code/ryzom/client/src/interface_v3/group_compas.cpp @@ -74,7 +74,7 @@ void CCompassTarget::serial(NLMISC::IStream &f) // for the name, try to save a string identifier if possible, because language may be changed between // save & reload f.serial(Name); - std::string language = strlwr(ClientCfg.LanguageCode); + std::string language = toLower(ClientCfg.LanguageCode); f.serial(language); f.serialEnum(_Type); if (_Type == PosTracker) @@ -100,7 +100,7 @@ void CCompassTarget::serial(NLMISC::IStream &f) // reset the compass to north to avoid incoherency if (f.isReading()) { - if (strlwr(ClientCfg.LanguageCode) != language) + if (toLower(ClientCfg.LanguageCode) != language) { *this = CCompassTarget(); } diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 2e0e4e3e7..a22c8dbc5 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -729,7 +729,7 @@ bool CDBGroupListAscensor::CSheetChildAscensor::isInvalidated(CDBGroupListSheetT { LIFT_ICONS::TLiftIcon li = (LIFT_ICONS::TLiftIcon)(icon & UINT64_CONSTANT(0x7FFFFFFFFFFFFFFF)); - string str = strlwr(LIFT_ICONS::toString(li)); + string str = toLower(LIFT_ICONS::toString(li)); Ctrl->setType(CCtrlSheetInfo::SheetType_Teleport_Location); Ctrl->setSlot("asc_"+str+".tga"); } diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp index 6acc2a17b..d7fec407b 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -294,7 +294,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"name")); string animName; if (ptr) - animName = strlwr (CFile::getFilenameWithoutExtension(ptr.str())); + animName = toLower(CFile::getFilenameWithoutExtension(ptr.str())); if (!animName.empty()) { @@ -539,7 +539,7 @@ void CInterface3DScene::draw () Driver->setViewport(oldVP); Driver->setFrustum(oldFrustum); - // Restaure render states + // Restore render states CViewRenderer::getInstance()->setRenderStates(); restoreClip (oldSciX, oldSciY, oldSciW, oldSciH); @@ -856,7 +856,7 @@ int CInterface3DCharacter::luaSetupCharacter3D(CLuaState &ls) const char *funcName = "setupCharacter3D"; CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); - setupCharacter3D((sint32) ls.toNumber(1)); + setupCharacter3D((sint32) ls.toInteger(1)); return 0; } @@ -1084,11 +1084,9 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) ptr = xmlGetProp (cur, (xmlChar*)"rot"); if (ptr) _Rot = convertVector(ptr); - string name; ptr = xmlGetProp (cur, (xmlChar*)"name"); - if (ptr) name = (const char*)ptr; + if (ptr) _Name = toLower((const char*)ptr); - _Name = strlwr(name); _IG = UInstanceGroup::createInstanceGroup(_Name); if (_IG == NULL) return true; // Create anyway @@ -1202,7 +1200,7 @@ std::string CInterface3DIG::getName() const // ---------------------------------------------------------------------------- void CInterface3DIG::setName (const std::string &ht) { - string lwrname = strlwr(ht); + string lwrname = toLower(ht); if (lwrname != _Name) { CInterface3DScene *pI3DS = dynamic_cast(_Parent); @@ -1248,11 +1246,9 @@ bool CInterface3DShape::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) ptr = xmlGetProp (cur, (xmlChar*)"rot"); if (ptr) _Rot = convertVector(ptr); - string name; ptr = xmlGetProp (cur, (xmlChar*)"name"); - if (ptr) name = (const char*)ptr; + if (ptr) _Name = toLower((const char*)ptr); - _Name = strlwr(name); _Instance = parentGroup->getScene()->createInstance(_Name); if (_Instance.empty()) return false; @@ -1529,11 +1525,8 @@ bool CInterface3DFX::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) ptr = xmlGetProp (cur, (xmlChar*)"rot"); if (ptr) _Rot = convertVector(ptr); - string name; ptr = xmlGetProp (cur, (xmlChar*)"name"); - if (ptr) name = (const char*)ptr; - - _Name = strlwr(name); + if (ptr) _Name = toLower((const char*)ptr); return true; } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 70be8abe4..a104dd01d 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -469,6 +469,7 @@ CInterfaceManager::CInterfaceManager() CGroupHTML::options.languageCode = ClientCfg.getHtmlLanguageCode(); CGroupHTML::options.appName = getUserAgentName(); CGroupHTML::options.appVersion = getUserAgentVersion(); + CGroupHTML::options.curlMaxConnections = ClientCfg.CurlMaxConnections; NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS ); interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater(); @@ -1760,6 +1761,8 @@ bool CInterfaceManager::loadConfig (const string &filename) // *** If saved resolution is different from the current one setuped, must fix positions in _Modes if(lastInGameScreenResLoaded) { + // Temporarily set screen to saved size so that positions are correctly calculated + CWidgetManager::getInstance()->setScreenWH(_LastInGameScreenW, _LastInGameScreenH); // NB: we are typically InGame here (even though the _InGame flag is not yet set) // Use the screen size of the config file. Don't update current UI, just _Modes CWidgetManager::getInstance()->moveAllWindowsToNewScreenSize(ClientCfg.Width, ClientCfg.Height, false); @@ -1950,8 +1953,14 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) nlctassert(CHARACTERISTICS::NUM_CHARACTERISTICS==8); for (uint i=0; igetDbProp(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i), false)); + if (!_CurrentPlayerCharacLeaf[i]) + _CurrentPlayerCharacLeaf[i] = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i), false); + + NLMISC::CCDBNodeLeaf *node = NULL; + + if (_CurrentPlayerCharacLeaf[i]) + node = &*_CurrentPlayerCharacLeaf[i]; + _CurrentPlayerCharac[i] = node ? node->getValue32() : 0; } @@ -2011,6 +2020,9 @@ void CInterfaceManager::updateDesktops( uint32 newScreenW, uint32 newScreenH ) CWidgetManager::getInstance()->getNewWindowCoordToNewScreenSize(gcCont.X, gcCont.Y, gcCont.W, gcCont.H ,newScreenW, newScreenH); } } + + _LastInGameScreenW = newScreenW; + _LastInGameScreenH = newScreenH; } class InvalidateTextVisitor : public CInterfaceElementVisitor @@ -2268,7 +2280,7 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat CRGBA color = CRGBA::White; - map::const_iterator it = ClientCfg.SystemInfoParams.find(strlwr(cat)); + map::const_iterator it = ClientCfg.SystemInfoParams.find(toLower(cat)); if (it != ClientCfg.SystemInfoParams.end()) { mode = it->second.Mode; @@ -2303,7 +2315,7 @@ void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat CRGBA CInterfaceManager::getSystemInfoColor(const std::string &cat) { CRGBA col = CRGBA::White; - map::const_iterator it = ClientCfg.SystemInfoParams.find(strlwr(cat)); + map::const_iterator it = ClientCfg.SystemInfoParams.find(toLower(cat)); if (it != ClientCfg.SystemInfoParams.end()) col = it->second.Color; return col; @@ -2482,7 +2494,8 @@ void CInterfaceManager::dumpUI(bool /* indent */) if (ig->getViews()[k]) { info += id; - info += toString(", type = %s, address=0x%p", typeid(*ig->getViews()[k]).name(), ig->getViews()[k]); + NLGUI::CViewBase *view = ig->getViews()[k]; + info += toString(", type = %s, address=0x%p", typeid(*view).name(), view); } else { @@ -2498,7 +2511,8 @@ void CInterfaceManager::dumpUI(bool /* indent */) if (ig->getControls()[k]) { info += id; - info += toString(", type = %s, address=0x%p", typeid(*ig->getControls()[k]).name(), ig->getControls()[k]); + NLGUI::CCtrlBase *control = ig->getControls()[k]; + info += toString(", type = %s, address=0x%p", typeid(*control).name(), control); } else { @@ -3313,11 +3327,17 @@ void CInterfaceManager::getLuaValueInfo(std::string &str, sint index) sint type= ls.type(index); if(type==LUA_TNIL) + { str= "nil"; + } else if(type==LUA_TNUMBER) - str= NLMISC::toString(ls.toNumber(index)); + { + str= NLMISC::toString(ls.isInteger(index) ? ls.toInteger(index):ls.toNumber(index)); + } else if(type==LUA_TBOOLEAN) + { str= ls.toBoolean(index)?"true":"false"; + } else if(type==LUA_TSTRING) { ls.toString(index, str); diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 7a56e470e..f886bc3e9 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3488,7 +3488,7 @@ CItemImage &CInventoryManager::getServerItem(uint inv, uint index) // *************************************************************************** CInventoryManager::TInvType CInventoryManager::invTypeFromString(const string &str) { - string sTmp = strlwr(str); + string sTmp = toLower(str); if (sTmp == "inv_bag") return InvBag; if (sTmp == "inv_pa0") return InvPA0; if (sTmp == "inv_pa1") return InvPA1; diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index fe4c6a716..87ee0c44d 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -220,15 +220,22 @@ static DECLARE_INTERFACE_USER_FCT(lua) } else if(type==LUA_TNUMBER) { - // get and pop - double val= ls.toNumber(); - ls.pop(); - // set double or integer? - if(val==floor(val)) - result.setInteger(sint64(floor(val))); + if (ls.isInteger()) + { + // get and pop + sint64 val= ls.toInteger(); + ls.pop(); + result.setInteger(val); + ok= true; + } else + { + // get and pop + double val= ls.toNumber(); + ls.pop(); result.setDouble(val); - ok= true; + ok= true; + } } else if(type==LUA_TSTRING) { @@ -309,7 +316,7 @@ int CLuaIHMRyzom::luaClientCfgIndex(CLuaState &ls) switch(v->Type) { case CConfigFile::CVar::T_REAL: - ls.push((double) v->asDouble()); + ls.push(v->asDouble()); return 1; break; case CConfigFile::CVar::T_STRING: @@ -318,7 +325,7 @@ int CLuaIHMRyzom::luaClientCfgIndex(CLuaState &ls) break; default: // handle both T_INT && T_BOOL case CConfigFile::CVar::T_INT: - ls.push((double) v->asInt()); + ls.push(v->asInt()); return 1; break; } @@ -1003,7 +1010,7 @@ int CLuaIHMRyzom::hideAllNonSavableWindows(CLuaState &/* ls */) int CLuaIHMRyzom::getDesktopIndex(CLuaState &ls) { //H_AUTO(Lua_CLuaIHM_getDesktopIndex) - ls.push((double) CInterfaceManager::getInstance()->getMode()); + ls.push(CInterfaceManager::getInstance()->getMode()); return 1; } @@ -1020,7 +1027,7 @@ int CLuaIHMRyzom::setLuaBreakPoint(CLuaState &ls) #ifdef LUA_NEVRAX_VERSION if (LuaDebuggerIDE) { - LuaDebuggerIDE->setBreakPoint(ls.toString(1), (int) ls.toNumber(2)); + LuaDebuggerIDE->setBreakPoint(ls.toString(1), (int) ls.toInteger(2)); } #endif @@ -1043,7 +1050,7 @@ int CLuaIHMRyzom::getCharSlot(CLuaState &ls) //H_AUTO(Lua_CLuaIHM_getCharSlot) const char *funcName = "getCharSlot"; CLuaIHM::checkArgCount(ls, funcName, 0); - ls.push(double(PlayerSelectedSlot)); + ls.push(PlayerSelectedSlot); return 1; } @@ -1053,7 +1060,7 @@ int CLuaIHMRyzom::getServerSeason(CLuaState &ls) const char *funcName = "getServerSeason"; CLuaIHM::checkArgCount(ls, funcName, 0); extern uint8 ServerSeasonValue; - ls.push((double) ServerSeasonValue); + ls.push(ServerSeasonValue); return 1; } @@ -1062,7 +1069,7 @@ int CLuaIHMRyzom::computeCurrSeason(CLuaState &ls) //H_AUTO(Lua_CLuaIHM_computeCurrSeason) const char *funcName = "computeCurrSeason"; CLuaIHM::checkArgCount(ls, funcName, 0); - ls.push((double) (::computeCurrSeason() + 1)); + ls.push((sint)(::computeCurrSeason() + 1)); return 1; } @@ -1071,7 +1078,7 @@ int CLuaIHMRyzom::getAutoSeason(CLuaState &ls) //H_AUTO(Lua_CLuaIHM_getAutoSeason) const char *funcName = "getAutoSeason"; CLuaIHM::checkArgCount(ls, funcName, 0); - ls.push((double) (StartupSeason + 1)); + ls.push((sint)(StartupSeason + 1)); return 1; } @@ -1144,7 +1151,7 @@ int CLuaIHMRyzom::getPlayerDirection(CLuaState &ls) int CLuaIHMRyzom::getPlayerGender(CLuaState &ls) { CLuaIHM::checkArgCount(ls, "getPlayerGender", 0); - ls.push((lua_Number)(UserEntity->getGender())); + ls.push((uint8)UserEntity->getGender()); return 1; } @@ -1210,7 +1217,7 @@ int CLuaIHMRyzom::getTargetGender(CLuaState &ls) CLuaIHM::checkArgCount(ls, "getTargetGender", 0); CCharacterCL* target = (CCharacterCL*)getTargetEntity(); if (!target) return (int)GSGENDER::unknown; - ls.push((lua_Number)(target->getGender())); + ls.push((uint8)target->getGender()); return 1; } @@ -1344,14 +1351,14 @@ int CLuaIHMRyzom::getSheet2idx(CLuaState &ls) CLuaIHM::checkArgType(ls, "getSheet2idx", 2, LUA_TNUMBER); const std::string & sheedtName = ls.toString(1); - uint32 slotId = (uint32)ls.toNumber(2); + uint32 slotId = (uint32)ls.toInteger(2); NLMISC::CSheetId sheetId; if (sheetId.buildSheetId(sheedtName)) { uint32 idx = CVisualSlotManager::getInstance()->sheet2Index(sheetId, (SLOTTYPE::EVisualSlot)slotId); - ls.push((lua_Number)idx); + ls.push(idx); } else return 0; @@ -1362,7 +1369,7 @@ int CLuaIHMRyzom::getSheet2idx(CLuaState &ls) int CLuaIHMRyzom::getTargetSlot(CLuaState &ls) { uint32 slot = (uint32)getTargetSlotNr(); - ls.push((lua_Number)slot); + ls.push(slot); return 1; } @@ -1372,7 +1379,7 @@ int CLuaIHMRyzom::getSlotDataSetId(CLuaState &ls) CLuaIHM::checkArgCount(ls, "getSlotDataSetId", 1); CLuaIHM::checkArgType(ls, "getSlotDataSetId", 1, LUA_TNUMBER); - uint32 slot = (uint32)ls.toNumber(1); + uint32 slot = (uint32)ls.toInteger(1); CEntityCL *e = getSlotEntity(slot); string id = toString(e->dataSetId()); ls.push(id); @@ -1394,7 +1401,7 @@ int CLuaIHMRyzom::getClientCfgVar(CLuaState &ls) switch(v->Type) { case CConfigFile::CVar::T_REAL: - ls.push((double) v->asDouble()); + ls.push(v->asDouble()); return 1; break; case CConfigFile::CVar::T_STRING: @@ -1403,7 +1410,7 @@ int CLuaIHMRyzom::getClientCfgVar(CLuaState &ls) break; default: // handle both T_INT && T_BOOL case CConfigFile::CVar::T_INT: - ls.push((double) v->asInt()); + ls.push(v->asInt()); return 1; break; } @@ -1420,7 +1427,7 @@ int CLuaIHMRyzom::getClientCfgVar(CLuaState &ls) } for(uint i = 0; iIntValues.size(); i++) { - result.setValue(toString(count).c_str(), (double)v->IntValues[i]); + result.setValue(toString(count).c_str(), (sint32)v->IntValues[i]); count++; } for(uint i = 0; iRealValues.size(); i++) @@ -1514,9 +1521,9 @@ int CLuaIHMRyzom::getIndexInDB(CLuaState &ls) // get the index in db if(pCS) - ls.push((double)pCS->getIndexInDB()); + ls.push(pCS->getIndexInDB()); else - ls.push(0.0); + ls.push((sint)0); return 1; } @@ -1676,7 +1683,7 @@ int CLuaIHMRyzom::displayBubble(CLuaState &ls) strs.push_back(it.nextKey().toString()); } - InSceneBubbleManager.webIgChatOpen((uint32)ls.toNumber(1), ls.toString(2), strs, links); + InSceneBubbleManager.webIgChatOpen((uint32)ls.toInteger(1), ls.toString(2), strs, links); return 1; } @@ -1745,10 +1752,10 @@ int CLuaIHMRyzom::getCompleteIslands(CLuaState &ls) ls.newTable(); CLuaObject islandTable(ls); islandTable.setValue("continent", island->Continent); - islandTable.setValue("xmin", (double)island->XMin); - islandTable.setValue("ymin", (double)island->YMin); - islandTable.setValue("xmax", (double)island->XMax); - islandTable.setValue("ymax", (double)island->YMax); + islandTable.setValue("xmin", island->XMin); + islandTable.setValue("ymin", island->YMin); + islandTable.setValue("xmax", island->XMax); + islandTable.setValue("ymax", island->YMax); ls.newTable(); CLuaObject entrypointsTable(ls); @@ -1758,8 +1765,8 @@ int CLuaIHMRyzom::getCompleteIslands(CLuaState &ls) const CScenarioEntryPoints::CShortEntryPoint & entryPoint = island->EntryPoints[e]; ls.newTable(); CLuaObject entrypointTable(ls); - entrypointTable.setValue("x", (double)entryPoint.X); - entrypointTable.setValue("y", (double)entryPoint.Y); + entrypointTable.setValue("x", entryPoint.X); + entrypointTable.setValue("y", entryPoint.Y); entrypointsTable.setValue(entryPoint.Location, entrypointTable); } @@ -1784,7 +1791,7 @@ int CLuaIHMRyzom::getIslandId(CLuaState &ls) CScenarioEntryPoints scenarioEntryPoints = CScenarioEntryPoints::getInstance(); uint32 id = scenarioEntryPoints.getIslandId(ls.toString(1)); - ls.push((double)id); + ls.push(id); return 1; } diff --git a/code/ryzom/client/src/interface_v3/music_player.cpp b/code/ryzom/client/src/interface_v3/music_player.cpp index cfa23540f..39aeea825 100644 --- a/code/ryzom/client/src/interface_v3/music_player.cpp +++ b/code/ryzom/client/src/interface_v3/music_player.cpp @@ -83,7 +83,7 @@ void CMusicPlayer::play () CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:mp3_player:screen:text")); if (pVT) - pVT->setText (_Songs[_CurrentSong].Title); + pVT->setText (ucstring::makeFromUtf8(_Songs[_CurrentSong].Title)); } } @@ -181,6 +181,12 @@ public: if (Params == "play_songs") { + std::vector extensions; + SoundMngr->getMixer()->getMusicExtensions(extensions); + + // no format supported + if (extensions.empty()) return; + #ifdef NL_OS_WINDOWS // Backup the current directory string currentPath = CPath::getCurrentPath (); @@ -195,13 +201,68 @@ public: } else { - static char szFilter[] = - "All Supported Files\0*.mp3;*.mp2;*.mp1;*.ogg;*.m3u\0" - "MPEG Audio Files (*.mp3;*.mp2;*.mp1)\0*.mp3;*.mp2;*.mp1\0" - "Vorbis Files (*.ogg)\0*.ogg\0" - "Playlist Files (*.m3u)\0*.m3u\0" - "All Files (*.*)\0*.*\0" - "\0"; + bool oggSupported = false; + bool mp3Supported = false; + + for(uint i = 0; i < extensions.size(); ++i) + { + if (extensions[i] == "ogg") + { + oggSupported = true; + } + else if (extensions[i] == "mp3") + { + mp3Supported = true; + } + } + + std::vector filters; + + // supported formats + filters.push_back("All Supported Files"); + + std::string filter; + if (mp3Supported) filter += "*.mp3;*.mp2;*.mp1;"; + if (oggSupported) filter += "*.ogg;"; + filter += "*.m3u"; + + filters.push_back(filter); + + // mp3 format + if (mp3Supported) + { + filters.push_back("MPEG Audio Files (*.mp3;*.mp2;*.mp1)"); + filters.push_back("*.mp3;*.mp2;*.mp1"); + } + + // ogg format + if (oggSupported) + { + filters.push_back("Vorbis Files (*.ogg)"); + filters.push_back("*.ogg"); + } + + // playlist + filters.push_back("Playlist Files (*.m3u)"); + filters.push_back("*.m3u"); + + // all files + filters.push_back("All Files (*.*)"); + filters.push_back("*.*"); + + filters.push_back(""); + + static char szFilter[1024] = { '\0' }; + + uint offset = 0; + + for(uint i = 0; i < filters.size(); ++i) + { + strcpy(szFilter + offset, filters[i].c_str()); + + // move offset to string length + 1 for \0 + offset += filters[i].length() + 1; + } // Filename buffer char buffer[65535]; @@ -243,7 +304,7 @@ public: while (*bufferPtr) { // Concat the directory name with the filename - if (strlwr (CFile::getExtension(bufferPtr)) == "m3u") + if (toLower(CFile::getExtension(bufferPtr)) == "m3u") playlists.push_back (path+bufferPtr); else filenames.push_back (path+bufferPtr); @@ -291,11 +352,11 @@ public: Driver->endDialogMode(); } - // Restaure mouse + // Restore mouse InitMouseWithCursor (wasHardware); Driver->showCursor (wasHardware); - // Restaure current path + // Restore current path CPath::setCurrentPath (currentPath.c_str()); #endif // NL_OS_WINDOWS } diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index c2167358f..3433d1154 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -155,10 +155,10 @@ bool CPeopleList::create(const CPeopleListDesc &desc, const CChatWindowDesc *cha //================================================================== sint CPeopleList::getIndexFromName(const ucstring &name) const { - string sNameIn = strlwr(name.toString()); + string sNameIn = toLower(name.toString()); for(uint k = 0; k < _Peoples.size(); ++k) { - string sPeopleName = strlwr(_Peoples[k].getName().toString()); + string sPeopleName = toLower(_Peoples[k].getName().toString()); if (sPeopleName == sNameIn) return k; } return -1; diff --git a/code/ryzom/client/src/interface_v3/sbrick_manager.cpp b/code/ryzom/client/src/interface_v3/sbrick_manager.cpp index 036a50052..86946e2e1 100644 --- a/code/ryzom/client/src/interface_v3/sbrick_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sbrick_manager.cpp @@ -404,8 +404,7 @@ void CSBrickManager::compileBrickProperties() string::size_type pos = prop.Text.find(':'); if (pos != string::npos) { - string key = prop.Text.substr(0, pos); - strlwr(key); + string key = toLower(prop.Text.substr(0, pos)); string value = prop.Text.substr(pos + 1); // get key id. if (_BrickPropIdMap.find(key) == _BrickPropIdMap.end()) @@ -501,12 +500,12 @@ void CSBrickManager::compileBrickProperties() k++; } // get the key and replace text with value - if(key.size()) + if (!key.empty()) { // Parse all the brick properties if match the key float value= 0.f; // get the wanted prop id - strlwr(key); + key = toLower(key); uint propId= getBrickPropId(key); // if propid exist if(propId) diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp index d214d1150..c7e5e380b 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -4563,14 +4563,14 @@ int CSPhraseComAdpater::luaGetCastTime(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push(0.0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); float castTime; float castTimeMalus; pPM->getPhraseCastTime(Phrase, pPM->getTotalActionMalus(Phrase), castTime, castTimeMalus); - ls.push((double) (castTime + castTimeMalus)); + ls.push(castTime + castTimeMalus); return 1; } @@ -4579,14 +4579,14 @@ int CSPhraseComAdpater::luaGetCastRange(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push((sint)0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); sint range; - sint rangeMalus; + sint rangeMalus; pPM->getPhraseMagicRange(this->Phrase, pPM->getTotalActionMalus(Phrase), range, rangeMalus); - ls.push((double) (range + rangeMalus)); + ls.push(range + rangeMalus); return 1; } @@ -4595,14 +4595,14 @@ int CSPhraseComAdpater::luaGetHpCost(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push((sint)0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); sint hpCost; sint hpCostMalus; pPM->getPhraseHpCost(this->Phrase, pPM->getTotalActionMalus(Phrase), hpCost, hpCostMalus); - ls.push((double) (hpCost + hpCostMalus)); + ls.push(hpCost + hpCostMalus); return 1; } @@ -4611,14 +4611,14 @@ int CSPhraseComAdpater::luaGetSapCost(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push((sint)0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); sint sapCost; sint sapCostMalus; pPM->getPhraseSapCost(this->Phrase, pPM->getTotalActionMalus(Phrase), sapCost, sapCostMalus); - ls.push((double) (sapCost + sapCostMalus)); + ls.push(sapCost + sapCostMalus); return 1; } @@ -4627,11 +4627,11 @@ int CSPhraseComAdpater::luaGetSuccessRate(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push((sint)0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); ; - ls.push((double) pPM->getPhraseSuccessRate(this->Phrase)); + ls.push(pPM->getPhraseSuccessRate(this->Phrase)); return 1; } @@ -4641,14 +4641,14 @@ int CSPhraseComAdpater::luaGetFocusCost(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push((sint)0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); sint focusCost; sint focusCostMalus; pPM->getPhraseFocusCost(this->Phrase, pPM->getTotalActionMalus(Phrase), focusCost, focusCostMalus); - ls.push((double) (focusCost + focusCostMalus)); + ls.push(focusCost + focusCostMalus); return 1; } @@ -4657,14 +4657,14 @@ int CSPhraseComAdpater::luaGetStaCost(CLuaState &ls) { if (Phrase.Bricks.empty()) { - ls.push((double) 0); + ls.push((sint)0); return 1; } CSPhraseManager *pPM = CSPhraseManager::getInstance(); sint staCost; sint staCostMalus; pPM->getPhraseStaCost(this->Phrase, pPM->getTotalActionMalus(Phrase), staCost, staCostMalus); - ls.push((double) (staCost + staCostMalus)); + ls.push(staCost + staCostMalus); return 1; } @@ -4756,7 +4756,7 @@ int CSPhraseComAdpater::luaIsPowerPhrase(CLuaState &ls) int CSPhraseComAdpater::luaGetRegenTime(CLuaState &ls) { CSPhraseManager *pPM = CSPhraseManager::getInstance(); - ls.push((double) pPM->getRegenTime(Phrase)); + ls.push((sint)pPM->getRegenTime(Phrase)); return 1; } @@ -4764,7 +4764,7 @@ int CSPhraseComAdpater::luaGetRegenTime(CLuaState &ls) int CSPhraseComAdpater::luaGetTotalRegenTime(CLuaState &ls) { CSPhraseManager *pPM = CSPhraseManager::getInstance(); - ls.push((double) pPM->getTotalRegenTime(Phrase)); + ls.push((sint)pPM->getTotalRegenTime(Phrase)); return 1; } @@ -4772,7 +4772,7 @@ int CSPhraseComAdpater::luaGetTotalRegenTime(CLuaState &ls) int CSPhraseComAdpater::luaGetPowerDisableTime(CLuaState &ls) { CSPhraseManager *pPM = CSPhraseManager::getInstance(); - ls.push((double) pPM->getPowerDisableTime(Phrase)); + ls.push((sint)pPM->getPowerDisableTime(Phrase)); return 1; } diff --git a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp index d59a89235..212ceebeb 100644 --- a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp +++ b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp @@ -59,8 +59,7 @@ bool CViewBitmapFaberMp::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) prop = (char*) xmlGetProp( cur, (xmlChar*)"tx_noitem" ); if (prop) { - _TextureNoItemName = (const char *) prop; - _TextureNoItemName = strlwr (_TextureNoItemName); + _TextureNoItemName = toLower((const char *) prop); _TextureNoItemId = -2; } diff --git a/code/ryzom/client/src/interface_v3/view_radar.cpp b/code/ryzom/client/src/interface_v3/view_radar.cpp index 5ebb7fd64..073318ec8 100644 --- a/code/ryzom/client/src/interface_v3/view_radar.cpp +++ b/code/ryzom/client/src/interface_v3/view_radar.cpp @@ -95,8 +95,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) prop = (char*) xmlGetProp( cur, (xmlChar*)spotTextureNames[i] ); if (prop) { - txName = (const char *) prop; - txName = strlwr (txName); + txName = toLower((const char *) prop); } _SpotDescriptions[i].TextureId.setTexture(txName.c_str()); rVR.getTextureSizeFromId (_SpotDescriptions[i].TextureId, _SpotDescriptions[i].TxW, _SpotDescriptions[i].TxH); @@ -105,8 +104,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) prop = (char*) xmlGetProp( cur, (xmlChar*)spotMiniTextureNames[i] ); if (prop) { - txName = (const char *) prop; - txName = strlwr (txName); + txName = toLower((const char *) prop); } _SpotDescriptions[i].MiniTextureId.setTexture(txName.c_str()); rVR.getTextureSizeFromId (_SpotDescriptions[i].MiniTextureId, _SpotDescriptions[i].MTxW, _SpotDescriptions[i].MTxH); diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 091e24a80..aacc37053 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -1922,7 +1922,7 @@ class CAHOpenURL : public IActionHandler url += "language=" + ClientCfg.LanguageCode; openURL(url.c_str()); - nlinfo("openURL %s",url.c_str()); + nlinfo("openURL %s", url.c_str()); } }; REGISTER_ACTION_HANDLER (CAHOpenURL, "open_url"); @@ -1945,7 +1945,10 @@ class CAHInitResLod : public IActionHandler VideoModes.clear(); StringModeList.clear(); - CurrentMode = getRyzomModes(VideoModes, StringModeList); + std::vector stringFreqList; + sint currentFreq; + + getRyzomModes(VideoModes, StringModeList, stringFreqList, CurrentMode, currentFreq); // getRyzomModes() expects empty list, so we need to insert 'Windowed' after mode list is filled StringModeList.insert(StringModeList.begin(), "uiConfigWindowed"); @@ -2452,7 +2455,7 @@ class CAHCreateAccountRules : public IActionHandler if(Params==rules[i]) { if(rulesGr) - rulesGr->setActive(text->getText() != ucstring("")); + rulesGr->setActive(!text->getText().empty()); } } } diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 9b39c53c9..c0beba4c1 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -50,7 +50,6 @@ #include "game_share/brick_types.h" #include "game_share/light_cycle.h" #include "game_share/time_weather_season/time_and_season.h" -#include "game_share/ryzom_version.h" #include "game_share/bot_chat_types.h" // PACS #include "nel/pacs/u_global_position.h" @@ -2016,7 +2015,7 @@ bool mainLoop() } // Temp for weather test - if (ClientCfg.ManualWeatherSetup && ContinentMngr.cur() && ContinentMngr.cur()->WeatherFunction) + if (ClientCfg.ManualWeatherSetup) { H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) static float displayHourDelta = 0.04f; // static for edition during debug.. diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp index 992325c54..cc19ab478 100644 --- a/code/ryzom/client/src/main_loop_debug.cpp +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -20,8 +20,6 @@ #include #include -#include "game_share/ryzom_version.h" - #include "global.h" #include "client_cfg.h" #include "user_entity.h" @@ -43,6 +41,9 @@ #include "fog_map.h" #include "misc.h" #include "interface_v3/interface_manager.h" +#include "actions_client.h" +#include "user_agent.h" + using namespace NLMISC; using namespace NL3D; @@ -241,15 +242,7 @@ void displayDebug() //-----------// TextContext->setHotSpot(UTextContext::TopLeft); line = 1.f; - string str; -#if FINAL_VERSION - str = "FV"; -#else - str = "DEV"; -#endif - if(ClientCfg.ExtendedCommands) - str += "_E"; - str += " "RYZOM_VERSION; + string str = getDisplayVersion(); TextContext->printfAt(0.f, line, "Version %s", str.c_str()); // TOP MIDDLE // @@ -699,10 +692,27 @@ REGISTER_ACTION_HANDLER( CHandlerDebugUiDumpElementUnderMouse, "debug_ui_inspect //----------------------------------------------- #define DISP_TEXT(x, text) \ /* Display the text at the right place */ \ - TextContext->printfAt(x, line, text); \ + TextContext->printfAt(x, line, std::string(text).c_str()); \ /* Change the line */ \ line += lineStep; \ +//--------------------------------------------------- +// getActionKey : +// Return action key binding as string. +static std::string getActionKey(const char* name, const char* param = "") +{ + std::string category; + + CActionsManager *pAM = &Actions; + const CActionsManager::TActionComboMap &acmap = pAM->getActionComboMap(); + + CActionsManager::TActionComboMap::const_iterator ite = acmap.find(CAction::CName(name, param)); + if (ite != acmap.end()) + return ite->second.toUCString().toString(); + + return CI18N::get("uiNotAssigned").toString(); +} + //--------------------------------------------------- // displayHelp : // Display an Help. @@ -720,54 +730,53 @@ void displayHelp() // Set the text color TextContext->setColor(ClientCfg.HelpFontColor); - line = 1.f; TextContext->setHotSpot(UTextContext::TopLeft); - DISP_TEXT(0.0f, "SHIFT + F1 : This Menu") - DISP_TEXT(0.0f, "SHIFT + F2 : Display Debug Infos") - DISP_TEXT(0.0f, "SHIFT + F3 : Wire mode"); - DISP_TEXT(0.0f, "SHIFT + F4 : Do not Render the Scene"); - DISP_TEXT(0.0f, "SHIFT + F5 : Toogle Display OSD interfaces"); + DISP_TEXT(0.0f, getActionKey("toggle_help") + " : This Menu"); + DISP_TEXT(0.0f, getActionKey("display_infos") + " : Display Debug Infos"); + DISP_TEXT(0.0f, getActionKey("render_mode") + " : Wire mode"); + DISP_TEXT(0.0f, getActionKey("toggle_render") + " : Do not Render the Scene"); + DISP_TEXT(0.0f, getActionKey("toggle_chat") + " : Toggle Display OSD interfaces"); // DISP_TEXT(0.0f, "SHIFT + F6 : Not used"); - DISP_TEXT(0.0f, "SHIFT + F7 : Compass Mode (User/Camera)"); - DISP_TEXT(0.0f, "SHIFT + F8 : Camera Mode (INSERT to change your position)"); - DISP_TEXT(0.0f, "SHIFT + F9 : Free Mouse"); - DISP_TEXT(0.0f, "SHIFT + F10 : Take a Screen Shot (+CTRL) for jpg"); + DISP_TEXT(0.0f, getActionKey("change_compass_mode") + " : Compass Mode (User/Camera)"); + DISP_TEXT(0.0f, getActionKey("toggle_fly") + " : Camera Mode (" + getActionKey("debug", "set_pos") + " to change your position)"); + DISP_TEXT(0.0f, getActionKey("free_mouse") + " : Free Mouse"); + DISP_TEXT(0.0f, getActionKey("screen_shot") + " : Take a Screen Shot (TGA), " + getActionKey("screen_shot_jpg") + " for jpg, " + getActionKey("screen_shot_png") + " for png"); // DISP_TEXT(0.0f, "SHIFT + F11 : Test"); - DISP_TEXT(0.0f, "SHIFT + ESCAPE : Quit"); - DISP_TEXT(0.0f, "SHIFT + C : First/Third Person View"); + DISP_TEXT(0.0f, getActionKey("enter_modal", "group=ui:interface:quit_dialog") + " : Quit"); + DISP_TEXT(0.0f, getActionKey("toggle_camera") + " : First/Third Person View"); line = 1.f; TextContext->setHotSpot(UTextContext::TopRight); - DISP_TEXT(1.0f, "UP : FORWARD"); - DISP_TEXT(1.0f, "DOWN : BACKWARD"); - DISP_TEXT(1.0f, "LEFT : ROTATE LEFT"); - DISP_TEXT(1.0f, "RIGHT : ROTATE RIGHT"); - DISP_TEXT(1.0f, "CTRL + LEFT : STRAFE LEFT"); - DISP_TEXT(1.0f, "CTRL + RIGHT : STRAFE RIGHT"); - DISP_TEXT(1.0f, "END : Auto Walk"); - DISP_TEXT(1.0f, "DELETE : Walk/Run"); - DISP_TEXT(1.0f, "PG UP : Look Up"); - DISP_TEXT(1.0f, "PG DOWN : Look Down"); -// DISP_TEXT(1.0f, "CTRL + I : Inventory"); -// DISP_TEXT(1.0f, "CTRL + C : Spells composition interface"); -// DISP_TEXT(1.0f, "CTRL + S : Memorized Spells interface"); - DISP_TEXT(1.0f, "CTRL + B : Show/Hide PACS Borders"); - DISP_TEXT(1.0f, "CTRL + P : Player target himself"); - DISP_TEXT(1.0f, "CTRL + D : Unselect target"); - DISP_TEXT(1.0f, "CTRL + TAB : Next Chat Mode (say/shout"); - DISP_TEXT(1.0f, "CTRL + R : Reload Client.cfg File"); + DISP_TEXT(1.0f, getActionKey("forward") + " : FORWARD"); + DISP_TEXT(1.0f, getActionKey("backward") + " : BACKWARD"); + DISP_TEXT(1.0f, getActionKey("turn_left") + " : ROTATE LEFT"); + DISP_TEXT(1.0f, getActionKey("turn_right") + " : ROTATE RIGHT"); + DISP_TEXT(1.0f, getActionKey("strafe_left") + " : STRAFE LEFT"); + DISP_TEXT(1.0f, getActionKey("strafe_right") + " : STRAFE RIGHT"); + DISP_TEXT(1.0f, getActionKey("toggle_auto_walk") + " : Auto Walk"); + DISP_TEXT(1.0f, getActionKey("toggle_run_walk") + " : Walk/Run"); + DISP_TEXT(1.0f, getActionKey("look_up") + " : Look Up"); + DISP_TEXT(1.0f, getActionKey("look_down") + " : Look Down"); +// DISP_TEXT(1.0f, getActionKey("show_hide", "inventory") + " : Inventory"); +// DISP_TEXT(1.0f, getActionKey("show_hide", "phrase_book") + " : Spells composition interface"); +// DISP_TEXT(1.0f, getActionKey("show_hide", "gestionsets") + " : Memorized Spells interface"); + DISP_TEXT(1.0f, getActionKey("pacs_borders") + " : Show/Hide PACS Borders"); + DISP_TEXT(1.0f, getActionKey("self_target") + " : Player target himself"); + DISP_TEXT(1.0f, getActionKey("no_target") + " : Unselect target"); +// DISP_TEXT(1.0f, "CTRL + TAB : Next Chat Mode (say/shout"); +// DISP_TEXT(1.0f, "CTRL + R : Reload Client.cfg File"); // DISP_TEXT(1.0f, "CTRL + N : Toggle Night / Day lighting"); - DISP_TEXT(1.0f, "CTRL + F2 : Profile on / off"); - DISP_TEXT(1.0f, "CTRL + F3 : Movie Shooter record / stop"); - DISP_TEXT(1.0f, "CTRL + F4 : Movie Shooter replay"); - DISP_TEXT(1.0f, "CTRL + F5 : Movie Shooter save"); + DISP_TEXT(1.0f, getActionKey("profile") + " : Profile on / off"); + DISP_TEXT(1.0f, getActionKey("toggle_movie_recorder") + " : Movie Shooter record / stop"); + DISP_TEXT(1.0f, getActionKey("replay_movie") + " : Movie Shooter replay"); + DISP_TEXT(1.0f, getActionKey("save_movie") + " : Movie Shooter save"); #ifndef NL_USE_DEFAULT_MEMORY_MANAGER - DISP_TEXT(1.0f, "CTRL + F6 : Save memory stat report"); + DISP_TEXT(1.0f, getActionKey("memory_report") + " : Save memory stat report"); #endif // NL_USE_DEFAULT_MEMORY_MANAGER - DISP_TEXT(1.0f, "CTRL + F7 : Show / hide prim file"); - DISP_TEXT(1.0f, "CTRL + F8 : Change prim file UP"); - DISP_TEXT(1.0f, "CTRL + F9 : Change prim file DOWN"); + DISP_TEXT(1.0f, getActionKey("toggle_primitive") + " : Show / hide prim file"); + DISP_TEXT(1.0f, getActionKey("primitive_up") + " : Change prim file UP"); + DISP_TEXT(1.0f, getActionKey("primitive_down") + " : Change prim file DOWN"); // No more shadow when displaying a text. TextContext->setShaded(false); @@ -780,4 +789,4 @@ void displayHelp() // ******************************************************************** // ******************************************************************** -/* end of file */ \ No newline at end of file +/* end of file */ diff --git a/code/ryzom/client/src/mesh_camera_col_manager.cpp b/code/ryzom/client/src/mesh_camera_col_manager.cpp index 00cff5652..7a4452e38 100644 --- a/code/ryzom/client/src/mesh_camera_col_manager.cpp +++ b/code/ryzom/client/src/mesh_camera_col_manager.cpp @@ -108,7 +108,7 @@ void CMeshCameraColManager::instanceGroupAdded(NL3D::UInstanceGroup *ig) bool avoidCollisionInside= ig->dontCastShadowForInterior(i); bool avoidCollisionOutside= ig->dontCastShadowForExterior(i); // very special patch for the matis serre (grrrrrrrrrrrrr) - avoidCollisionOutside= avoidCollisionOutside || strlwr(shapeName)== "ma_serre_interieur.shape"; + avoidCollisionOutside= avoidCollisionOutside || toLower(shapeName)== "ma_serre_interieur.shape"; // then send the result to the collision manager, and keep the mesh col id if succeed uint32 meshId= CollisionManager->addMeshInstanceCollision(colMesh, mat, avoidCollisionInside, avoidCollisionOutside); diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index 7e018a576..bb3625c4b 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -1392,58 +1392,118 @@ bool isWindowMaximized() screenMode.Width == width && screenMode.Height == height); } -sint getRyzomModes(std::vector &videoModes, std::vector &stringModeList) +bool getRyzomModes(std::vector &videoModes, std::vector &stringModeList, std::vector &stringFreqList, sint &nFoundStringMode, sint &nFoundStringFreq) { + // default values + nFoundStringMode = -1; + nFoundStringFreq = -1; + + // mode index in original video modes + sint nFoundMode = -1; + // **** Init Video Modes Driver->getModes(videoModes); + // Remove modes under 800x600 and get the unique strings - sint i, j, nFoundMode = -1; - for (i=0; i < (sint)videoModes.size(); ++i) + sint i, j; + for (i = 0; i < (sint)videoModes.size(); ++i) { if ((videoModes[i].Width < 800) || (videoModes[i].Height < 600)) { + // discard modes under 800x600 videoModes.erase(videoModes.begin()+i); --i; } else { bool bFound = false; - string tmp = toString(videoModes[i].Width)+" x "+toString(videoModes[i].Height); + + // create string format with width and height + string res = toString(videoModes[i].Width)+" x "+toString(videoModes[i].Height); + + // check if video mode already found in list for (j = 0; j < (sint)stringModeList.size(); ++j) { - if (stringModeList[j] == tmp) + if (stringModeList[j] == res) { bFound = true; break; } } + + // if not found if (!bFound) { - stringModeList.push_back(tmp); + // add it to the list + stringModeList.push_back(res); + + // process all screen sizes less or equal to desired one if ((videoModes[i].Width <= ClientCfg.Width) && (videoModes[i].Height <= ClientCfg.Height)) { - if (nFoundMode == -1) + // take first one by default + if (nFoundStringMode == -1) { - nFoundMode = j; + nFoundStringMode = j; + nFoundMode = i; } else { + // then take the largest one if ((videoModes[i].Width >= videoModes[nFoundMode].Width) && (videoModes[i].Height >= videoModes[nFoundMode].Height)) - nFoundMode = j; + { + nFoundStringMode = j; + nFoundMode = i; + } } } } } } - + // If no modes are available, fallback to windowed mode - if (nFoundMode == -1) + if (nFoundStringMode == -1) { nlwarning("Mode %ux%u not found, fall back to windowed", (uint)ClientCfg.Width, (uint)ClientCfg.Height); ClientCfg.Windowed = true; ClientCfg.writeInt("FullScreen", 0); } + else + { + // add frequencies to frequencies list + for (i = 0; i < (sint)videoModes.size(); ++i) + { + // only take exact screen sizes + if (videoModes[i].Width == videoModes[nFoundMode].Width && videoModes[i].Height == videoModes[nFoundMode].Height) + { + uint freq = videoModes[i].Frequency; + std::string freqStr = toString(freq); - return nFoundMode; + bool bFound = false; + + // check if frequency already found in list + for (j = 0; j < (sint)stringFreqList.size(); ++j) + { + if (stringFreqList[j] == freqStr) + { + bFound = true; + break; + } + } + + if (!bFound) + { + // if frequency is 0, take the first one else use the exact one + if (nFoundStringFreq == -1 && ((ClientCfg.Frequency == 0) || (freq == ClientCfg.Frequency))) + { + nFoundStringFreq = stringFreqList.size(); + } + + stringFreqList.push_back(freqStr); + } + } + } + } + + return nFoundStringMode > -1; } diff --git a/code/ryzom/client/src/misc.h b/code/ryzom/client/src/misc.h index 7fba7204c..d7b86755d 100644 --- a/code/ryzom/client/src/misc.h +++ b/code/ryzom/client/src/misc.h @@ -228,7 +228,7 @@ uint getCurrentColorDepth(); bool isWindowMaximized(); // get all supported video modes -sint getRyzomModes(std::vector &videoModes, std::vector &stringModeList); +bool getRyzomModes(std::vector &videoModes, std::vector &stringModeList, std::vector &stringFreqList, sint &nFoundMode, sint &nFoundFreq); #endif // CL_MISC_H diff --git a/code/ryzom/client/src/motion/modes/mount_mode.cpp b/code/ryzom/client/src/motion/modes/mount_mode.cpp index d2c808fe2..f52d5c9ba 100644 --- a/code/ryzom/client/src/motion/modes/mount_mode.cpp +++ b/code/ryzom/client/src/motion/modes/mount_mode.cpp @@ -93,7 +93,7 @@ void CUserControls::mountModeStart() //----------------------------------------------- void CUserControls::mountModeStop() { - // Restaure la hauteur des yeux. + // Restore eyes height. UserEntity->eyesHeight(ClientCfg.EyesHeight); // \todo GUIGUI : remove this after the UBI Demo. diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index ecadce14e..ead456a81 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -692,7 +692,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if (!stringCategory.empty() && stringCategory != "SYS") { map::const_iterator it; - it = ClientCfg.SystemInfoParams.find(strlwr(stringCategory)); + it = ClientCfg.SystemInfoParams.find(toLower(stringCategory)); if (it != ClientCfg.SystemInfoParams.end()) { col = it->second.Color; @@ -723,7 +723,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c if( !stringCategory.empty() ) { map::const_iterator it; - it = ClientCfg.SystemInfoParams.find( strlwr(stringCategory) ); + it = ClientCfg.SystemInfoParams.find( toLower(stringCategory) ); if( it != ClientCfg.SystemInfoParams.end() ) { if( !(*it).second.SysInfoFxName.empty() ) @@ -923,7 +923,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u bool windowVisible; ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName); - + // The sender part is up to and including the first ":" after the goodSenderName ucstring::size_type pos = finalString.find(goodSenderName); pos = finalString.find(':', pos); @@ -3288,7 +3288,7 @@ private: contentStr = ""; i = digitStart; } - } + } else if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W') { uint i; @@ -3883,30 +3883,67 @@ bool CNetManager::update() CInterfaceManager *im = CInterfaceManager::getInstance(); if (im) { - CCDBNodeLeaf *node = m_PingLeaf ? &*m_PingLeaf - : &*(m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false)); - if (node) - node->setValue32(getPing()); - node = m_UploadLeaf ? &*m_UploadLeaf - : &*(m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false)); - if (node) - node->setValue32((sint32)(getMeanUpload()*1024.f/8.f)); - node = m_DownloadLeaf ? &*m_DownloadLeaf - : &*(m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false)); - if (node) - node->setValue32((sint32)(getMeanDownload()*1024.f/8.f)); - node = m_PacketLostLeaf ? &* m_PacketLostLeaf - : &*(m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false)); - if (node) - node->setValue32((sint32)getMeanPacketLoss()); - node = m_ServerStateLeaf ? &*m_ServerStateLeaf - : &*(m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false)); - if (node) - node->setValue32((sint32)getConnectionState()); - node = m_ConnectionQualityLeaf ? &*m_ConnectionQualityLeaf - : &*(m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false)); - if (node) - node->setValue32((sint32)getConnectionQuality()); + CCDBNodeLeaf *node = NULL; + + if (!m_PingLeaf) + m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false); + + if (m_PingLeaf) + { + node = &*m_PingLeaf; + if (node) + node->setValue32(getPing()); + } + + if (!m_UploadLeaf) + m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false); + + if (m_UploadLeaf) + { + node = &*m_UploadLeaf; + if (node) + node->setValue32((sint32)(getMeanUpload()*1024.f/8.f)); + } + + if (!m_DownloadLeaf) + m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false); + + if (m_DownloadLeaf) + { + node = &*m_DownloadLeaf; + if (node) + node->setValue32((sint32)(getMeanDownload()*1024.f/8.f)); + } + + if (!m_PacketLostLeaf) + m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false); + + if (m_PacketLostLeaf) + { + node = &*m_PacketLostLeaf; + if (node) + node->setValue32((sint32)getMeanPacketLoss()); + } + + if (!m_ServerStateLeaf) + m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false); + + if (m_ServerStateLeaf) + { + node = &*m_ServerStateLeaf; + if (node) + node->setValue32((sint32)getConnectionState()); + } + + if (!m_ConnectionQualityLeaf) + m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false); + + if (m_ConnectionQualityLeaf) + { + node = &*m_ConnectionQualityLeaf; + if (node) + node->setValue32((sint32)getConnectionQuality()); + } } } diff --git a/code/ryzom/client/src/outpost.cpp b/code/ryzom/client/src/outpost.cpp index 4968b8968..b345d36cb 100644 --- a/code/ryzom/client/src/outpost.cpp +++ b/code/ryzom/client/src/outpost.cpp @@ -99,7 +99,7 @@ void COutpost::initOutpost () for (i=0; i::const_iterator igIt = IGLoaded.find(strlwr(strPos)); + std::map::const_iterator igIt = IGLoaded.find(toLower(strPos)); if (igIt != IGLoaded.end()) { return igIt->second; @@ -188,7 +188,7 @@ void releaseLandscapeIGCallbacks() void addPacsPrim(const std::string &fileName) { - std::string ppName = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(fileName)); + std::string ppName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fileName)); if (PacsPrims.find(ppName) != PacsPrims.end()) { nlwarning(("Pacs primitive " + ppName + " already has been inserted").c_str()); diff --git a/code/ryzom/client/src/progress.cpp b/code/ryzom/client/src/progress.cpp index 2631984e7..2766c60d2 100644 --- a/code/ryzom/client/src/progress.cpp +++ b/code/ryzom/client/src/progress.cpp @@ -21,7 +21,6 @@ #include "global.h" #include "nel/misc/events.h" #include "nel/3d/u_texture.h" -#include "game_share/ryzom_version.h" #include "nel/misc/i18n.h" #include "continent.h" #include "weather.h" @@ -31,6 +30,7 @@ #include "release.h" #include "net_manager.h" #include "client_cfg.h" +#include "user_agent.h" #include "bg_downloader_access.h" #include "nel/misc/system_utils.h" #include "nel/3d/stereo_hmd.h" @@ -277,13 +277,7 @@ void CProgress::internalProgress (float value) // Display the build version. TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setHotSpot(UTextContext::TopRight); - string str; -#if FINAL_VERSION - str = "FV "; -#else - str = "DEV "; -#endif - str += RYZOM_VERSION; + string str = getDisplayVersion(); TextContext->printfAt(1.0f,1.0f, str.c_str()); // Display the tips of the day. diff --git a/code/ryzom/client/src/r2/config_var.h b/code/ryzom/client/src/r2/config_var.h index 238cd9c3c..828f67768 100644 --- a/code/ryzom/client/src/r2/config_var.h +++ b/code/ryzom/client/src/r2/config_var.h @@ -144,9 +144,9 @@ typedef CConfigVar CConfigVarDouble; inline std::string getConfigVarTypename(const sint32 &/* dummy */) { return "sint32"; } inline bool getConfigVarValue(CLuaObject &luaValue, sint32 &dest) { - if (luaValue.isNumber()) + if (luaValue.isInteger()) { - dest = (sint32) luaValue.toNumber(); + dest = (sint32) luaValue.toInteger(); return true; } return false; diff --git a/code/ryzom/client/src/r2/displayer_visual_entity.cpp b/code/ryzom/client/src/r2/displayer_visual_entity.cpp index 5bc8638f0..2e9eeef7a 100644 --- a/code/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -968,7 +968,7 @@ void CDisplayerVisualEntity::updateName() ucName = CI18N::get("uiR2EDNoName"); } - std::string actName=std::string(""); + std::string actName; // If entity is in an additionnal act, then postfix its name with the name of the act if (getDisplayedInstance()->getParentAct() != getEditor().getBaseAct()) diff --git a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp index 5d00cdc2b..8e2cb5695 100644 --- a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -1869,8 +1869,8 @@ void CClientEditionModule::onKicked(NLNET::IModuleProxy * /* sender */, uint32 t { //H_AUTO(R2_CClientEditionModule_onKicked) - R2::getEditor().getLua().push((double)timeBeforeDisconnection); - R2::getEditor().getLua().push((bool)mustKick); + R2::getEditor().getLua().push(timeBeforeDisconnection); + R2::getEditor().getLua().push(mustKick); R2::getEditor().callEnvFunc( "onKicked", 2, 0); } @@ -2019,9 +2019,9 @@ void CClientEditionModule::onAnimationModePlayConnected(NLNET::IModuleProxy * /* void CClientEditionModule::scheduleStartAct(NLNET::IModuleProxy * /* sender */, uint32 errorId, uint32 actId, uint32 nbSeconds) { //H_AUTO(R2_CClientEditionModule_scheduleStartAct) - R2::getEditor().getLua().push((double)errorId); - R2::getEditor().getLua().push((double)actId); - R2::getEditor().getLua().push((double)nbSeconds); + R2::getEditor().getLua().push(errorId); + R2::getEditor().getLua().push(actId); + R2::getEditor().getLua().push(nbSeconds); R2::getEditor().callEnvFunc( "onScheduleStartAct", 3, 0); } @@ -2475,7 +2475,7 @@ void CClientEditionModule::loadScenarioSucceded(const std::string& filename, con } if (CFile::fileExists(filename)) { - CFile::copyFile("save/r2_buffer.dat", filename.c_str()); + CFile::copyFile("save/r2_buffer.dat", filename); } } diff --git a/code/ryzom/client/src/r2/dmc/com_lua_module.cpp b/code/ryzom/client/src/r2/dmc/com_lua_module.cpp index b73813786..439265734 100644 --- a/code/ryzom/client/src/r2/dmc/com_lua_module.cpp +++ b/code/ryzom/client/src/r2/dmc/com_lua_module.cpp @@ -403,10 +403,10 @@ sint CComLuaModule::luaSaveUserComponentFile(lua_State* state) luaL_checktype(state, 1, LUA_TSTRING); luaL_checktype(state, 2, LUA_TNUMBER); std::string filename( lua_tostring(state, 1) ); - double mustCompress( lua_tonumber(state, 2) ); + bool mustCompress(lua_tointeger(state, 2) != 0); CComLuaModule* this2 = getInstance(state); - this2->_Client->getEditionModule().saveUserComponentFile(filename, mustCompress != 0); + this2->_Client->getEditionModule().saveUserComponentFile(filename, mustCompress); return 0; } @@ -425,7 +425,7 @@ sint CComLuaModule::luaUpdateUserComponentsInfo(lua_State* state) std::string filename( lua_tostring(state, 1) ); std::string name( lua_tostring(state, 2) ); std::string description( lua_tostring(state, 3) ); - uint32 timestamp( static_cast(lua_tonumber(state, 3) )); + uint32 timestamp( static_cast(lua_tointeger(state, 3) )); std::string md5Id( lua_tostring(state, 3) ); CComLuaModule* this2 = getInstance(state); @@ -441,7 +441,7 @@ sint CComLuaModule::luaGetSheetIdName(lua_State* state) CComLuaModule* this2 = getInstance(state); nlassert(this2); - uint32 sheetIdValue = static_cast( lua_tonumber(state, 1) ); + uint32 sheetIdValue = static_cast( lua_tointeger(state, 1) ); NLMISC::CSheetId sheetId(sheetIdValue); if(sheetId != NLMISC::CSheetId::Unknown) @@ -538,7 +538,7 @@ sint CComLuaModule::luaRequestSetWeather(lua_State* state) { //H_AUTO(R2_CComLuaModule_luaRequestSetWeather) luaL_checktype(state, 1, LUA_TNUMBER); - uint16 weatherValue = (uint16) lua_tonumber(state, 1); + uint16 weatherValue = (uint16) lua_tointeger(state, 1); CComLuaModule* this2 = getInstance(state); nlassert(this2); this2->_Client->getEditionModule().requestSetWeather(weatherValue); @@ -550,7 +550,7 @@ sint CComLuaModule::luaRequestSetSeason(lua_State* state) { //H_AUTO(R2_CComLuaModule_luaRequestSetSeason) luaL_checktype(state, 1, LUA_TNUMBER); - uint8 season = (uint8) lua_tonumber(state, 1); + uint8 season = (uint8) lua_tointeger(state, 1); CComLuaModule* this2 = getInstance(state); nlassert(this2); this2->_Client->getEditionModule().requestSetSeason(season); @@ -572,7 +572,7 @@ sint CComLuaModule::luaRequestStartAct(lua_State* state) { //H_AUTO(R2_CComLuaModule_luaRequestStartAct) luaL_checktype(state, 1, LUA_TNUMBER); - uint32 actId(static_cast(lua_tonumber(state, 1))); + uint32 actId(static_cast(lua_tointeger(state, 1))); CComLuaModule* this2 = getInstance(state); nlassert(this2); this2->_Client->getEditionModule().requestStartAct(actId); @@ -712,7 +712,7 @@ sint CComLuaModule::luaRequestMapConnection(lua_State* state) CHECK_LUA_ARG_COUNT(1, "requestMapConnection"); luaL_checktype(state, 1, LUA_TNUMBER); - uint32 adventureId = static_cast( lua_tonumber(state, 1) ); + uint32 adventureId = static_cast( lua_tointeger(state, 1) ); CComLuaModule* this2 = getInstance(state); nlassert(this2); @@ -751,7 +751,7 @@ sint CComLuaModule::requestInsertNode(lua_State* state, bool isGhost) std::string instanceId(lua_tostring(state, 1)); std::string attrName(lua_tostring(state, 2)); - sint position(static_cast(lua_tonumber(state, 3))); + sint position(static_cast(lua_tointeger(state, 3))); std::string key(lua_tostring(state, 4)); CObject* value = getObjectFromLua(state, 5); value->setGhost(isGhost); @@ -837,7 +837,7 @@ sint CComLuaModule::luaRequestEraseNode(lua_State* state) std::string attrName; sint position = -1; if (args>1){ attrName = lua_tostring(state, 2);} - if (args>2){ position = static_cast(lua_tonumber(state, 3));} + if (args>2){ position = static_cast(lua_tointeger(state, 3));} CComLuaModule* this2 = getInstance(state); nlassert(this2); this2->_Client->requestEraseNode( instanceId, attrName, position); @@ -863,11 +863,11 @@ sint CComLuaModule::luaRequestMoveNode(lua_State* state) std::string instanceId(lua_tostring(state, 1)); std::string attrName(lua_tostring(state, 2)); - sint position = static_cast(lua_tonumber(state, 3)); + sint position = static_cast(lua_tointeger(state, 3)); std::string instanceId2(lua_tostring(state, 4)); std::string attrName2(lua_tostring(state, 5)); - sint position2 = static_cast(lua_tonumber(state, 6)); + sint position2 = static_cast(lua_tointeger(state, 6)); CComLuaModule* this2 = getInstance(state); nlassert(this2); @@ -967,7 +967,7 @@ sint CComLuaModule::luaRequestNewMultiAction(lua_State* state) sint args = lua_gettop(state); CHECK_LUA_ARG_COUNT(2, funcName); luaL_checktype(state, 2, LUA_TNUMBER); - uint count = (uint) lua_tonumber(state, 2); + uint count = (uint) lua_tointeger(state, 2); lua_pop(state, 1); return luaRequestNewAction(state, false, count); } @@ -979,7 +979,7 @@ sint CComLuaModule::luaRequestNewPendingMultiAction(lua_State* state) sint args = lua_gettop(state); CHECK_LUA_ARG_COUNT(2, funcName); luaL_checktype(state, 2, LUA_TNUMBER); - uint count = (uint) lua_tonumber(state, 2); + uint count = (uint) lua_tointeger(state, 2); lua_pop(state, 1); return luaRequestNewAction(state, true, count); } @@ -1049,6 +1049,13 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object) lua_pushnil(state); return; } + + if ( object->isInteger() ) + { + lua_pushinteger(state, object->toInteger()); + return; + } + if ( object->isNumber() ) { lua_pushnumber(state, object->toNumber()); @@ -1226,9 +1233,20 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx) { case LUA_TNUMBER: { - double value = lua_tonumber(state, -1); - lua_pop(state, 1); - return new CObjectNumber(value); +#if LUA_VERSION_NUM >= 503 + if (lua_isinteger(state, -1) != 0) + { + sint64 value = lua_tointeger(state, -1); + lua_pop(state, 1); + return new CObjectInteger(value); + } + else +#endif + { + double value = lua_tonumber(state, -1); + lua_pop(state, 1); + return new CObjectNumber(value); + } } break; @@ -1738,8 +1756,8 @@ sint CComLuaModule::luaTriggerUserTrigger(lua_State* state) //H_AUTO(R2_CComLuaModule_luaTriggerUserTrigger) CComLuaModule* this2 = getInstance(state); nlassert(this2); - uint32 actId( static_cast(lua_tonumber(state, 1) ) ); - uint32 id( static_cast(lua_tonumber(state, 2) )); + uint32 actId( static_cast(lua_tointeger(state, 1) ) ); + uint32 id( static_cast(lua_tointeger(state, 2) )); this2->_Client->getEditionModule().requestTriggerUserTrigger(actId, id); return 0; @@ -1869,7 +1887,7 @@ sint CComLuaModule::luaReserveIdRange(lua_State* state) CHECK_LUA_ARG_COUNT(1, "reserveIdRange"); luaL_checktype(state, 1, LUA_TNUMBER); - uint32 range=static_cast( lua_tonumber(state, 1) ); + uint32 range=static_cast( lua_tointeger(state, 1) ); this2->_Client->getEditionModule().reserveIdRange(range); @@ -1897,7 +1915,7 @@ sint CComLuaModule::luaRequestTpToEntryPoint(lua_State* state) CHECK_LUA_ARG_COUNT(1, "requestTpToEntryPoint"); luaL_checktype(state, 1, LUA_TNUMBER); - uint32 actIndex = static_cast( lua_tonumber(state, 1) ); + uint32 actIndex = static_cast( lua_tointeger(state, 1) ); this2->_Client->getEditionModule().requestTpToEntryPoint(actIndex); return 0; @@ -1914,7 +1932,7 @@ sint CComLuaModule::luaRequestSetStartingAct(lua_State* state) CHECK_LUA_ARG_COUNT(1, "requestSetStartingAct"); luaL_checktype(state, 1, LUA_TNUMBER); - uint32 actIndex = static_cast( lua_tonumber(state, 1) ); + uint32 actIndex = static_cast( lua_tointeger(state, 1) ); this2->_Client->getEditionModule().requestSetStartingAct(actIndex); return 0; @@ -1993,7 +2011,7 @@ sint CComLuaModule::luaSetDisplayInfo(lua_State* state) std::string formName( lua_tostring(state, 1) ); - bool displayInfo = static_cast(lua_tonumber(state, 2) == 0); + bool displayInfo = lua_tointeger(state, 2) != 0; //this2->_Client->getEditionModule().reserveIdRange(range); this2->_Client->getEditionModule().setDisplayInfo(formName, displayInfo); @@ -2024,7 +2042,7 @@ sint CComLuaModule::luaSetStartingActIndex(lua_State* state) sint args = lua_gettop(state); CHECK_LUA_ARG_COUNT(1, "setStartingActIndex"); luaL_checktype(state, 1, LUA_TNUMBER); - this2->_Client->getEditionModule().setStartingActIndex( static_cast(lua_tonumber(state, 1)) ); + this2->_Client->getEditionModule().setStartingActIndex( static_cast(lua_tointeger(state, 1)) ); return 0; } @@ -2229,12 +2247,12 @@ sint CComLuaModule::luaUpdateScenarioAck(lua_State* state) { std::string key = object->getKey(i); CObject* value = object->getValue(i); - if (value->isNumber()) + if (value->isInteger()) { if (key.size() == 1) { - level[key] = static_cast(value->toNumber()); + level[key] = static_cast(value->toInteger()); } } } diff --git a/code/ryzom/client/src/r2/dmc/property_accessor.cpp b/code/ryzom/client/src/r2/dmc/property_accessor.cpp index a6faf17b5..d8f7a1290 100644 --- a/code/ryzom/client/src/r2/dmc/property_accessor.cpp +++ b/code/ryzom/client/src/r2/dmc/property_accessor.cpp @@ -46,6 +46,14 @@ double CPropertyAccessor::getValueAsNumber(CObject* component, const std::string return object->toNumber(); } +sint64 CPropertyAccessor::getValueAsInteger(CObject* component, const std::string& attrName) const +{ + //H_AUTO(R2_CPropertyAccessor_getValueAsInteger) + const CObject* object=getPropertyValue((const CObject *) component, attrName); + if (!object || !object->isInteger()) { return 0; } + return object->toInteger(); +} + bool CPropertyAccessor::hasValueInBase(CObject *component, const std::string& attrName) { //H_AUTO(R2_CPropertyAccessor_hasValueInBase) diff --git a/code/ryzom/client/src/r2/dmc/property_accessor.h b/code/ryzom/client/src/r2/dmc/property_accessor.h index 062ce5829..4f4cbe862 100644 --- a/code/ryzom/client/src/r2/dmc/property_accessor.h +++ b/code/ryzom/client/src/r2/dmc/property_accessor.h @@ -46,6 +46,7 @@ namespace R2 //get The propertyValue as number or 0 if not found double getValueAsNumber(CObject* component, const std::string& attrName) const; + sint64 getValueAsInteger(CObject* component, const std::string& attrName) const; const CObject* getPropertyValue(const CObject* component, const std::string& attrName) const; diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index aa5995b05..dae1a5fb8 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -1009,9 +1009,9 @@ int CEditor::luaSnapPosToGround(CLuaState &ls) if (gpos.InstanceId != -1) { CVector snappedPos = GR->getGlobalPosition(gpos); - ls.push((double) snappedPos.x); - ls.push((double) snappedPos.y); - ls.push((double) snappedPos.z); + ls.push(snappedPos.x); + ls.push(snappedPos.y); + ls.push(snappedPos.z); return 3; } else @@ -1025,9 +1025,9 @@ int CEditor::luaSnapPosToGround(CLuaState &ls) CVector inter; if (CTool::computeWorldMapIntersection((float) ls.toNumber(2), (float) ls.toNumber(3), inter) != CTool::NoIntersection) { - ls.push((double) inter.x); - ls.push((double) inter.y); - ls.push((double) inter.z); + ls.push(inter.x); + ls.push(inter.y); + ls.push(inter.z); return 3; } else @@ -1045,9 +1045,9 @@ int CEditor::luaGetUserEntityPosition(CLuaState &ls) CHECK_EDITOR const char *funcName = "getUserEntityPosition"; CLuaIHM::checkArgCount(ls, funcName, 1); - ls.push((double) UserEntity->pos().x); - ls.push((double) UserEntity->pos().y); - ls.push((double) UserEntity->pos().z); + ls.push(UserEntity->pos().x); + ls.push(UserEntity->pos().y); + ls.push(UserEntity->pos().z); return 3; } @@ -1058,8 +1058,8 @@ int CEditor::luaGetUserEntityFront(CLuaState &ls) CHECK_EDITOR const char *funcName = "getUserEntityPosition"; CLuaIHM::checkArgCount(ls, funcName, 1); - ls.push((double) UserEntity->front().x); - ls.push((double) UserEntity->front().y); + ls.push(UserEntity->front().x); + ls.push(UserEntity->front().y); return 2; } @@ -1297,13 +1297,13 @@ int CEditor::luaSetPlotItemInfos(CLuaState &ls) CLuaIHM::checkArgTypeUCString(ls, funcName, 3); CLuaIHM::checkArgTypeUCString(ls, funcName, 4); CLuaIHM::checkArgTypeUCString(ls, funcName, 5); - CItemSheet *item = dynamic_cast(SheetMngr.get(CSheetId((uint32) ls.toNumber(2)))); + CItemSheet *item = dynamic_cast(SheetMngr.get(CSheetId((uint32) ls.toInteger(2)))); if (!item || item->Family != ITEMFAMILY::SCROLL_R2) { CLuaIHM::fails(ls, "%s : bad sheet, r2 plot item required", funcName); } R2::TMissionItem mi; - mi.SheetId = (uint32) ls.toNumber(2); + mi.SheetId = (uint32) ls.toInteger(2); CLuaIHM::getUCStringOnStack(ls, 3, mi.Name); CLuaIHM::getUCStringOnStack(ls, 4, mi.Description); CLuaIHM::getUCStringOnStack(ls, 5, mi.Comment); @@ -1383,7 +1383,7 @@ int CEditor::luaKickCharacter(CLuaState &ls) CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance(); sb.kickCharacter(sb.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(), - (uint32)ls.toNumber(2)); + (uint32)ls.toInteger(2)); if(!sb.waitOneMessage(sb.getMessageName("on_invokeResult"))) nlwarning("kickCharacter callback return false"); @@ -1401,7 +1401,7 @@ int CEditor::luaUnkickCharacter(CLuaState &ls) CSessionBrowserImpl &sb = CSessionBrowserImpl::getInstance(); sb.unkickCharacter(sb.getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(), - (uint32)ls.toNumber(2)); + (uint32)ls.toInteger(2)); if(!sb.waitOneMessage(sb.getMessageName("on_invokeResult"))) nlwarning("unkickCharacter callback return false"); @@ -1419,7 +1419,7 @@ int CEditor::luaTeleportToCharacter(CLuaState &ls) CClientEditionModule & cem = R2::getEditor().getDMC().getEditionModule(); cem.requestTeleportOneCharacterToAnother(cem.getCurrentAdventureId(), CSessionBrowserImpl::getInstance().getCharId(), - (uint32)ls.toNumber(2)); + (uint32)ls.toInteger(2)); return 0; } @@ -1443,7 +1443,7 @@ int CEditor::luaIsScenarioUpdating(CLuaState &ls) //H_AUTO(R2_CEditor_luaIsScenarioUpdating) const char *funcName = "isScenarioUpdating"; CLuaIHM::checkArgCount(ls, funcName, 1); // method with no args - ls.push( (double)getEditor()._UpdatingScenario ); + ls.push( getEditor()._UpdatingScenario ); return 1; } @@ -1487,9 +1487,9 @@ int CEditor::luaIsValidPosition(CLuaState &ls) if (gpos.InstanceId != -1) { CVector snappedPos = GR->getGlobalPosition(gpos); - ls.push((double) snappedPos.x); - ls.push((double) snappedPos.y); - ls.push((double) snappedPos.z); + ls.push(snappedPos.x); + ls.push(snappedPos.y); + ls.push(snappedPos.z); return 3; } else @@ -1503,9 +1503,9 @@ int CEditor::luaIsValidPosition(CLuaState &ls) CVector inter; if (CTool::computeWorldMapIntersection((float) ls.toNumber(2), (float) ls.toNumber(3), inter) != CTool::NoIntersection) { - ls.push((double) inter.x); - ls.push((double) inter.y); - ls.push((double) inter.z); + ls.push(inter.x); + ls.push(inter.y); + ls.push(inter.z); } @@ -1540,7 +1540,7 @@ int CEditor::luaGetUserEntityName(CLuaState &ls) if (UserEntity) { ucstring name = UserEntity->getEntityName()+PlayerSelectedHomeShardNameWithParenthesis; - ls.push( std::string( name.toUtf8() ) ); + ls.push( name.toUtf8() ); } else { @@ -1928,7 +1928,7 @@ void CInstanceObserverLua::onAttrModified(CInstance &instance, const std::string if (_Receiver["onAttrModified"].isNil()) return; // no-op if not handled getEditor().projectInLua(instance.getObjectTable()); getEditor().getLua().push(attrName); - getEditor().getLua().push((double) attrIndex); + getEditor().getLua().push(attrIndex); _Receiver.callMethodByNameNoThrow("onAttrModified", 3, 0); } @@ -1942,7 +1942,7 @@ int CEditor::luaAddInstanceObserver(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); // instance id CLuaIHM::checkArgType(ls, funcName, 3, LUA_TTABLE); // receiver CLuaObject receiver(ls); // pop the receiver - ls.push((double) getEditor().addInstanceObserver(ls.toString(2), new CInstanceObserverLua(receiver))); + ls.push(getEditor().addInstanceObserver(ls.toString(2), new CInstanceObserverLua(receiver))); return 1; } @@ -1954,17 +1954,17 @@ int CEditor::luaRemoveInstanceObserver(CLuaState &ls) const char *funcName = "removeInstanceObserver"; CLuaIHM::checkArgCount(ls, funcName, 2); // this is a method (self + 1 params) CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); // instance id - IInstanceObserver *observer = getEditor().getInstanceObserver((TInstanceObserverHandle) ls.toNumber(2)); + IInstanceObserver *observer = getEditor().getInstanceObserver((TInstanceObserverHandle) ls.toInteger(2)); if (observer == NULL) { - CLuaIHM::fails(ls, "Instance observer not found for handle = %d", (int) ls.toNumber(2)); + CLuaIHM::fails(ls, "Instance observer not found for handle = %d"NL_I64, ls.toInteger(2)); } CInstanceObserverLua *luaObserver = dynamic_cast(observer); if (luaObserver == NULL) { - CLuaIHM::fails(ls, "Instance observer found for handle %d, but has bad type, it wasn't registered from lua.", (int) ls.toNumber(2)); + CLuaIHM::fails(ls, "Instance observer found for handle %d"NL_I64", but has bad type, it wasn't registered from lua.", ls.toInteger(2)); } - getEditor().removeInstanceObserver((TInstanceObserverHandle) ls.toNumber(2)); + getEditor().removeInstanceObserver((TInstanceObserverHandle) ls.toInteger(2)); CLuaObject receiver = luaObserver->getReceiver(); delete luaObserver; receiver.push(); @@ -2214,11 +2214,11 @@ void CEditor::setUIMode(uint8 mode) if (_ForceDesktopReset[mode]) { // force to call reset when reloading the ui - getLua().push((double) mode); + getLua().push(mode); callEnvMethod("resetDesktop", 1, 0); _ForceDesktopReset[mode] = false; } - getLua().push((double) mode); + getLua().push(mode); callEnvMethod("onChangeDesktop", 1, 0); } @@ -3221,10 +3221,10 @@ void CEditor::initObjectProjectionMetatable() throw ELuaWrappedFunctionException(&ls, "Attempt to access an erased object"); } - if (ls.isNumber(2)) + if (ls.isInteger(2)) { - // index is a number - const CObject *other = obj->getValue((uint32) ls.toNumber(2)); + // index is an integer + const CObject *other = obj->getValue((uint32) ls.toInteger(2)); if (other) { pushValue(ls, other); @@ -3293,11 +3293,11 @@ void CEditor::initObjectProjectionMetatable() sint32 index = obj->getParent()->findIndex(obj); if (obj->getParent()->getKey(index).empty()) { - ls.push((double) index); + ls.push(index); } else { - ls.push((double) -1); + ls.push(-1); } return 1; } @@ -3311,7 +3311,7 @@ void CEditor::initObjectProjectionMetatable() { if (obj->isTable()) { - ls.push((double) obj->getSize()); + ls.push(obj->getSize()); } else { @@ -3481,6 +3481,10 @@ void CEditor::initObjectProjectionMetatable() { ls.push(obj->toString()); } + else if (obj->isInteger()) + { + ls.push(obj->toInteger()); + } else if (obj->isNumber()) { ls.push(obj->toNumber()); @@ -3505,7 +3509,7 @@ void CEditor::initObjectProjectionMetatable() } if (obj->getKey(index).empty()) { - ls.push((double) index); + ls.push(index); } else { @@ -3574,9 +3578,9 @@ void CEditor::initObjectProjectionMetatable() // continuation of traversal // -> retrieve index from the key sint32 index; - if (ls.isNumber(2)) + if (ls.isInteger(2)) { - index = (uint32) ls.toNumber(2); + index = (uint32) ls.toInteger(2); } else { @@ -5384,12 +5388,12 @@ sint CEditor::getLeftQuota() CLuaState &ls = getLua(); CLuaStackChecker lsc(&ls); callEnvMethod("getLeftQuota", 0, 1); - if (!ls.isNumber(-1)) + if (!ls.isInteger(-1)) { ls.pop(1); return 0; } - sint result = (sint) ls.toNumber(-1); + sint result = (sint) ls.toInteger(-1); ls.pop(1); return result; } @@ -5419,7 +5423,7 @@ bool CEditor::verifyRoomLeft(uint aiCost, uint staticCost) if (aiCost) { CLuaStackChecker lsc(&ls); - getEditor().getLua().push((lua_Number)aiCost); + getEditor().getLua().push(aiCost); callEnvMethod("checkAiQuota", 1, 1); if (!ls.isBoolean(-1)) { @@ -5433,7 +5437,7 @@ bool CEditor::verifyRoomLeft(uint aiCost, uint staticCost) if (staticCost) { CLuaStackChecker lsc(&ls); - getEditor().getLua().push((lua_Number)staticCost); + getEditor().getLua().push(staticCost); callEnvMethod("checkStaticQuota", 1, 1); if (!ls.isBoolean(-1)) { @@ -5781,7 +5785,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct // teleport in good island if (ClientCfg.Local) { - sint locationId = (uint) _ScenarioInstance->getLuaProjection()["Description"]["LocationId"].toNumber(); + sint locationId = (uint) _ScenarioInstance->getLuaProjection()["Description"]["LocationId"].toInteger(); CScenarioEntryPoints &sep = CScenarioEntryPoints::getInstance(); _IslandCollision.loadEntryPoints(); @@ -6647,10 +6651,16 @@ std::string getString(const CObject *obj, const std::string &attrName) double getNumber(const CObject *obj, const std::string &attrName) { obj = getObject(obj, attrName); - if (!obj) return 0; - return obj->isNumber() ? obj->toNumber() : 0; + if (!obj) return 0.0; + return obj->isNumber() ? obj->toNumber() : 0.0; } +sint64 getInteger(const CObject *obj, const std::string &attrName) +{ + obj = getObject(obj, attrName); + if (!obj) return 0; + return obj->isInteger() ? obj->toInteger() : 0; +} bool isEditionCurrent() { @@ -6703,7 +6713,7 @@ bool CEditor::getVisualPropertiesFromObject(CObject* object, SPropVisualA& vA, S //-------------------------random init npc visual properties - std::map< std::string, double > visualProps; + std::map< std::string, sint64 > visualProps; static const char* keys[] = { "GabaritHeight", "GabaritTorsoWidth", "GabaritArmsWidth", "GabaritLegsWidth", "GabaritBreastSize" @@ -6719,7 +6729,7 @@ bool CEditor::getVisualPropertiesFromObject(CObject* object, SPropVisualA& vA, S unsigned int last = sizeof(keys) / sizeof(keys[0]); for (; first != last; ++first) { - visualProps[keys[first]] = getNumber(object, keys[first]); + visualProps[keys[first]] = getInteger(object, keys[first]); } //vA.PropertySubData.Sex = (uint) visualProps["Sex"]; @@ -7054,10 +7064,10 @@ class CAHCreateEntity : public IActionHandler if (getEditor().getEnv().callMethodByNameNoThrow("randomNPCProperties", 2, 1)) { CLuaObject result(getEditor().getLua()); - std::map< std::string, double > visualProps; + std::map< std::string, sint64 > visualProps; ENUM_LUA_TABLE(result, it) { - visualProps[it.nextKey().toString()] = it.nextValue().toNumber(); + visualProps[it.nextKey().toString()] = it.nextValue().toInteger(); } // visual property A depends on the type of the entity diff --git a/code/ryzom/client/src/r2/instance.cpp b/code/ryzom/client/src/r2/instance.cpp index 7bb2087fe..2baec8431 100644 --- a/code/ryzom/client/src/r2/instance.cpp +++ b/code/ryzom/client/src/r2/instance.cpp @@ -650,9 +650,9 @@ sint CInstance::getSelectedSequence() const //H_AUTO(R2_CInstance_getSelectedSequence) CLuaObject selected = const_cast(this)->getLuaProjection()["User"]["SelectedSequence"]; sint index = 0; - if (selected.isNumber()) + if (selected.isInteger()) { - index = (sint) selected.toNumber(); + index = (sint) selected.toInteger(); } return index; } diff --git a/code/ryzom/client/src/r2/prim_render.cpp b/code/ryzom/client/src/r2/prim_render.cpp index 246f3f98e..e714b979a 100644 --- a/code/ryzom/client/src/r2/prim_render.cpp +++ b/code/ryzom/client/src/r2/prim_render.cpp @@ -43,7 +43,7 @@ void readFromLua(const CLuaObject &table, const char *key, float &dest) } void readFromLua(const CLuaObject &table, const char *key, uint &dest) { - if (table[key].isNumber()) dest = (uint) table[key].toNumber(); + if (table[key].isInteger()) dest = (uint) table[key].toInteger(); } void readFromLua(const CLuaObject &table, const char *key, std::string &dest) { diff --git a/code/ryzom/client/src/r2/tool_select_move.cpp b/code/ryzom/client/src/r2/tool_select_move.cpp index 67d166652..46c83d83e 100644 --- a/code/ryzom/client/src/r2/tool_select_move.cpp +++ b/code/ryzom/client/src/r2/tool_select_move.cpp @@ -66,17 +66,17 @@ bool CToolSelectMove::checkAdditionnalRoomLeftFor(CInstance &instance) CLuaStackRestorer lsr(&ls, 0); // check ai & static cost : if they are too big, can't create the duplicate if (!luaProj.callMethodByNameNoThrow("getAiCost", 0, 1) - || !ls.isNumber(-1)) + || !ls.isInteger(-1)) { return false; } - uint aiCost = (uint) ls.toNumber(-1); + uint aiCost = (uint) ls.toInteger(-1); ls.pop(); if (!luaProj.callMethodByNameNoThrow("getStaticObjectCost", 0, 1)) { return false; } - uint staticCost = (uint) ls.toNumber(-1); + uint staticCost = (uint) ls.toInteger(-1); ls.pop(); if (!getEditor().verifyRoomLeft(aiCost, staticCost)) { diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index f88849197..e2a96c397 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -659,7 +659,7 @@ void release() CInterfaceExpr::release(); CPdrTokenRegistry::releaseInstance(); NLNET::IModuleManager::releaseInstance(); - delete &CLuaManager::getInstance(); + CLuaManager::releaseInstance(); NLGUI::CDBManager::release(); CWidgetManager::release(); diff --git a/code/ryzom/client/src/ryzom.ico b/code/ryzom/client/src/ryzom.ico index 5f4f39ed3..3470b6c16 100644 Binary files a/code/ryzom/client/src/ryzom.ico and b/code/ryzom/client/src/ryzom.ico differ diff --git a/code/ryzom/client/src/session_browser_impl.cpp b/code/ryzom/client/src/session_browser_impl.cpp index 1802aefbf..9e82a6d15 100644 --- a/code/ryzom/client/src/session_browser_impl.cpp +++ b/code/ryzom/client/src/session_browser_impl.cpp @@ -65,6 +65,7 @@ void CSessionBrowserImpl::init(CLuaState *ls) game.setValue("checkRingAccess", luaCheckRingAccess); game.setValue("getFileHeader", luaGetFileHeader); } + if (!ClientCfg.Local) { CSessionBrowserImpl::getInstance().setAuthInfo(getCookie()); @@ -76,8 +77,8 @@ void CSessionBrowserImpl::init(CLuaState *ls) _LastAuthorRating = 0; _LastAMRating = 0; _LastMasterlessRating = 0; - _LastRingPoints = string(""); - _LastMaxRingPoints = string(""); + _LastRingPoints.clear(); + _LastMaxRingPoints.clear(); } @@ -194,7 +195,7 @@ int CSessionBrowserImpl::luaUpdateScenarioScores(CLuaState &ls) if (R2::getEditor().getMode() != R2::CEditor::NotInitialized) { CSessionBrowserImpl::getInstance().setPlayerRating(getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(), - (uint32) ls.toNumber(1), (uint32) ls.toNumber(2), (uint32) ls.toNumber(3), (uint32) ls.toNumber(4), (uint32) ls.toNumber(5)); + (uint32) ls.toInteger(1), (uint32) ls.toInteger(2), (uint32) ls.toInteger(3), (uint32) ls.toInteger(4), (uint32) ls.toInteger(5)); } return 0; @@ -210,7 +211,7 @@ int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls) CInterfaceManager *pIM = CInterfaceManager::getInstance(); CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance(); - sessionBrowser.joinSession(getCharId(), (TSessionId)(uint32) ls.toNumber(1), ClientCfg.ConfigFile.getVar("Application").asString(0)); + sessionBrowser.joinSession(getCharId(), (TSessionId)(uint32) ls.toInteger(1), ClientCfg.ConfigFile.getVar("Application").asString(0)); if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_joinSessionResult"))) { @@ -373,34 +374,36 @@ void CSessionBrowserImpl::fill(const std::vector &session const RSMGR::TSessionDesc &sd = sessions[k]; _Lua->newTable(); CLuaObject session(*_Lua); - session.setValue("Id", (double) sd.getSessionId().asInt()); - session.setValue("Owner", sd.getOwnerName()); - session.setValue("Title", sd.getTitle()); - session.setValue("Desc", sd.getDescription()); - session.setValue("Level", (double) sd.getSessionLevel().getValue()); - session.setValue("Language", sd.getLanguage()); + session.setValue("Id", sd.getSessionId().asInt()); + session.setValue("Owner", sd.getOwnerName()); + session.setValue("Title", sd.getTitle()); + session.setValue("Desc", sd.getDescription()); + session.setValue("Level", (uint32) sd.getSessionLevel().getValue()); + session.setValue("Language", sd.getLanguage()); + uint flags = (sd.getAnimMode().getValue() == RSMGR::TAnimMode::am_dm ? (uint) 1 : 0) | (sd.getRequesterCharInvited() ? (uint) 2 : 0); if(sd.getRequesterCharKicked()) flags = (uint) 4; - session.setValue("Flags", (double) flags); - session.setValue("PlayerCount", (double) sd.getNbConnectedPlayer()); - session.setValue("AllowFreeTrial", (double) sd.getAllowFreeTrial()); - session.setValue("NbRating", (double) sd.getNbRating()); - session.setValue("RateFun", (double) sd.getRateFun()); - session.setValue("RateDifficulty", (double) sd.getRateDifficulty()); - session.setValue("RateAccessibility", (double) sd.getRateAccessibility()); - session.setValue("RateOriginality", (double) sd.getRateOriginality()); - session.setValue("RateDirection", (double) sd.getRateDirection()); + session.setValue("Flags", flags); + session.setValue("PlayerCount", sd.getNbConnectedPlayer()); + session.setValue("AllowFreeTrial", sd.getAllowFreeTrial()); - session.setValue("ScenarioRRPTotal", (double) sd.getScenarioRRPTotal()); + session.setValue("NbRating", sd.getNbRating()); + session.setValue("RateFun", sd.getRateFun()); + session.setValue("RateDifficulty", sd.getRateDifficulty()); + session.setValue("RateAccessibility", sd.getRateAccessibility()); + session.setValue("RateOriginality", sd.getRateOriginality()); + session.setValue("RateDirection", sd.getRateDirection()); - session.setValue("AuthorRating", (double) _LastAuthorRating); + session.setValue("ScenarioRRPTotal", sd.getScenarioRRPTotal()); + + session.setValue("AuthorRating", _LastAuthorRating); if(sd.getAnimMode().getValue() == RSMGR::TAnimMode::am_dm) - session.setValue("OwnerRating", (double) _LastAMRating); + session.setValue("OwnerRating", _LastAMRating); else - session.setValue("OwnerRating", (double) _LastMasterlessRating); + session.setValue("OwnerRating", _LastMasterlessRating); // calculate the difference between local time and gmt time_t rawtime; @@ -418,9 +421,9 @@ void CSessionBrowserImpl::fill(const std::vector &session // convert GMT time value from server to local time time_t adjustedTime= sd.getLaunchDate() + localTime - gmtTime; - session.setValue("LaunchDate", (double) adjustedTime); + session.setValue("LaunchDate", (sint64)adjustedTime); - session.setValue("ScenarioType", (double) sd.getOrientation().getValue()); + session.setValue("ScenarioType", (uint32)sd.getOrientation().getValue()); session.push(); _Lua->rawSetI(-2, k +1); // set in session list } @@ -442,12 +445,12 @@ void CSessionBrowserImpl::playerRatingFill(bool scenarioRated, uint32 rateFun, u _Lua->newTable(); CLuaObject scores(*_Lua); - scores.setValue("ScenarioRated", (double) scenarioRated); - scores.setValue("RateFun", (double) rateFun); - scores.setValue("RateDifficulty", (double) rateDifficulty); - scores.setValue("RateAccessibility", (double) rateAccessibility); - scores.setValue("RateOriginality", (double) rateOriginality); - scores.setValue("RateDirection", (double) rateDirection); + scores.setValue("ScenarioRated", scenarioRated); + scores.setValue("RateFun", rateFun); + scores.setValue("RateDifficulty", rateDifficulty); + scores.setValue("RateAccessibility", rateAccessibility); + scores.setValue("RateOriginality", rateOriginality); + scores.setValue("RateDirection", rateDirection); scores.push(); @@ -469,13 +472,13 @@ void CSessionBrowserImpl::averageScoresFill(bool scenarioRated, uint32 rateFun, _Lua->newTable(); CLuaObject scores(*_Lua); - scores.setValue("ScenarioRated", (double) scenarioRated); - scores.setValue("RateFun", (double) rateFun); - scores.setValue("RateDifficulty", (double) rateDifficulty); - scores.setValue("RateAccessibility", (double) rateAccessibility); - scores.setValue("RateOriginality", (double) rateOriginality); - scores.setValue("RateDirection", (double) rateDirection); - scores.setValue("RRPTotal", (double) rrpTotal); + scores.setValue("ScenarioRated", scenarioRated); + scores.setValue("RateFun", rateFun); + scores.setValue("RateDifficulty", rateDifficulty); + scores.setValue("RateAccessibility", rateAccessibility); + scores.setValue("RateOriginality", rateOriginality); + scores.setValue("RateDirection", rateDirection); + scores.setValue("RRPTotal", rrpTotal); scores.push(); @@ -560,13 +563,13 @@ void CSessionBrowserImpl::on_scenarioAverageScores(NLNET::TSockId /* from */, bo _Lua->newTable(); CLuaObject scores(*_Lua); - scores.setValue("ScenarioRated", (double) scenarioRated); - scores.setValue("RateFun", (double) rateFun); - scores.setValue("RateDifficulty", (double) rateDifficulty); - scores.setValue("RateAccessibility", (double) rateAccessibility); - scores.setValue("RateOriginality", (double) rateOriginality); - scores.setValue("RateDirection", (double) rateDirection); - scores.setValue("RRPTotal", (double) rrpTotal); + scores.setValue("ScenarioRated", scenarioRated); + scores.setValue("RateFun", rateFun); + scores.setValue("RateDifficulty", rateDifficulty); + scores.setValue("RateAccessibility", rateAccessibility); + scores.setValue("RateOriginality", rateOriginality); + scores.setValue("RateDirection", rateDirection); + scores.setValue("RRPTotal", rrpTotal); scores.push(); @@ -612,11 +615,11 @@ void CSessionBrowserImpl::charsFill(const std::vector &chars { _Lua->newTable(); CLuaObject luaChar(*_Lua); - luaChar.setValue("Id", (double) cd.getCharId()); + luaChar.setValue("Id", cd.getCharId()); luaChar.setValue("Char", cd.getCharName()); luaChar.setValue("Guild", cd.getGuildName()); - luaChar.setValue("Race", (double) cd.getRace().getValue()); - luaChar.setValue("Religion", (double) cd.getCult().getValue()); + luaChar.setValue("Race", (uint32) cd.getRace().getValue()); + luaChar.setValue("Religion", (uint32) cd.getCult().getValue()); string shardName = toString(cd.getShardId()); for(uint l = 0; l < Mainlands.size(); ++l) @@ -630,7 +633,7 @@ void CSessionBrowserImpl::charsFill(const std::vector &chars luaChar.setValue("Shard", shardName); // note: we do 'level-1' because the TSessionLevel enum starts at 1 - luaChar.setValue("Level", (double) (cd.getLevel().getValue()-1)); + luaChar.setValue("Level", (uint32) (cd.getLevel().getValue()-1)); /* uint32 flags = 0; if (cd.getConnected()) { flags += 1; } @@ -639,7 +642,7 @@ void CSessionBrowserImpl::charsFill(const std::vector &chars uint32 flags = cd.getConnected(); if (cd.getKicked()){ flags = 2; } - luaChar.setValue("Flags", (double) flags); + luaChar.setValue("Flags", flags); luaChar.push(); _Lua->rawSetI(-2, k +1); // set in chars list } @@ -655,14 +658,14 @@ void CSessionBrowserImpl::charsFill(const std::vector &chars // **************************************************************************** -inline double ecoRingPoints(const std::string & ecoPoints, const char * c) +inline uint32 ecoRingPoints(const std::string & ecoPoints, const char * c) { std::string::size_type cPlace = ecoPoints.find(c); if(cPlace==string::npos) return 0; std::string::size_type sepPlace = ecoPoints.find(":", cPlace); std::string points = ecoPoints.substr(cPlace+1, sepPlace); - double ret; + uint32 ret; fromString(points, ret); return ret; } @@ -678,9 +681,9 @@ void CSessionBrowserImpl::ringStatsFill() CLuaObject luaRingPoints(*_Lua); - luaRingPoints.setValue("AuthorRating", (double) _LastAuthorRating); - luaRingPoints.setValue("AMRating", (double) _LastAMRating); - luaRingPoints.setValue("MasterlessRating", (double) _LastMasterlessRating); + luaRingPoints.setValue("AuthorRating", _LastAuthorRating); + luaRingPoints.setValue("AMRating", _LastAMRating); + luaRingPoints.setValue("MasterlessRating", _LastMasterlessRating); luaRingPoints.setValue("MaxBasicRingPoints", ecoRingPoints(_LastMaxRingPoints, "A")); luaRingPoints.setValue("BasicRingPoints", ecoRingPoints(_LastRingPoints, "A")); diff --git a/code/ryzom/client/src/sky.cpp b/code/ryzom/client/src/sky.cpp index 855ab3387..5d66c2d70 100644 --- a/code/ryzom/client/src/sky.cpp +++ b/code/ryzom/client/src/sky.cpp @@ -281,7 +281,7 @@ CBitmap *buildSharedBitmap(const std::string &filename, { alreadyBuilt = false; if (filename.empty()) return NULL; - std::string lcBMFilename = strlwr(CFile::getFilenameWithoutExtension(filename)); + std::string lcBMFilename = toLower(CFile::getFilenameWithoutExtension(filename)); std::map::iterator it = bitmapByName.find(lcBMFilename); if (it != bitmapByName.end()) { diff --git a/code/ryzom/client/src/sky_object.cpp b/code/ryzom/client/src/sky_object.cpp index 9d4ada303..ad6b7615f 100644 --- a/code/ryzom/client/src/sky_object.cpp +++ b/code/ryzom/client/src/sky_object.cpp @@ -396,7 +396,7 @@ bool CSkyObject::setup(const CClientDate &date, const CClientDate &animationDate for(uint k = 0; k < SKY_MAX_NUM_STAGE; ++k) { if (TexPanner[k].U != 0.f || TexPanner[k].V != 0.f || - OffsetUBitmap != NULL || OffsetVBitmap != NULL ) + OffsetUBitmap[k] != NULL || OffsetVBitmap[k] != NULL ) { //nlinfo("global date = %f", animTime); // there's tex panning for that stage diff --git a/code/ryzom/client/src/streamable_ig.cpp b/code/ryzom/client/src/streamable_ig.cpp index f73df6126..e93b62c4c 100644 --- a/code/ryzom/client/src/streamable_ig.cpp +++ b/code/ryzom/client/src/streamable_ig.cpp @@ -291,10 +291,8 @@ bool CStreamableIG::setIG(uint ig, const std::string &name, const std::string &p } // Load this IG - _IGs[ig].Name = NLMISC::CFile::getFilenameWithoutExtension(name); - _IGs[ig].ParentName = NLMISC::CFile::getFilenameWithoutExtension(parentName); - NLMISC::strlwr(_IGs[ig].Name); - NLMISC::strlwr(_IGs[ig].ParentName); + _IGs[ig].Name = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(name)); + _IGs[ig].ParentName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(parentName)); _IGs[ig].IG = NULL; _IGs[ig].Loading = false; _Linked = false; @@ -308,10 +306,8 @@ void CStreamableIG::addIG(const std::string &name,const std::string &parentName, { H_AUTO_USE(RZ_StremableIG) _IGs.push_back(CIGNode ()); - _IGs.back().Name = NLMISC::CFile::getFilenameWithoutExtension(name); - _IGs.back().ParentName = NLMISC::CFile::getFilenameWithoutExtension(parentName); - NLMISC::strlwr(_IGs.back().Name); - NLMISC::strlwr(_IGs.back().ParentName); + _IGs.back().Name = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(name)); + _IGs.back().ParentName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(parentName)); _IGs.back().IG = NULL; _IGs.back().Loading = false; _IGs.back().Pos = pos; @@ -376,7 +372,7 @@ void CStreamableIG::addLoadedIGToMap() if (_IGs[k].IG && _IGs[k].IG != (NL3D::UInstanceGroup *)-1) // is this a successfully loaded ig ? { // insert the new ig if it hasn't before.. - if( _IGMap->insert(std::make_pair(NLMISC::strlwr(_IGs[k].Name), _IGs[k].IG)).second ) + if( _IGMap->insert(std::make_pair(NLMISC::toLower(_IGs[k].Name), _IGs[k].IG)).second ) // if inserted, must notify IG Added, else already notifiyed by loadAsync() this->notifyIGAdded(_IGs[k].IG); } diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index 71ca87ad8..da2fef260 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1413,8 +1413,7 @@ const ucchar * CStringManagerClient::getSpecialWord(const std::string &label, bo // avoid case problems static std::string lwrLabel; - lwrLabel = label; - strlwr(lwrLabel); + lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) { @@ -1464,8 +1463,7 @@ const ucchar * CStringManagerClient::getSpecialDesc(const std::string &label) // avoid case problems static std::string lwrLabel; - lwrLabel= label; - strlwr(lwrLabel); + lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) { @@ -1498,8 +1496,7 @@ const ucchar * CStringManagerClient::getSpecialDesc2(const std::string &label) // avoid case problems static std::string lwrLabel; - lwrLabel= label; - strlwr(lwrLabel); + lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) { @@ -1703,8 +1700,7 @@ void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const ucstring // avoid case problems static std::string lwrLabel; - lwrLabel= label; - strlwr(lwrLabel); + lwrLabel = toLower(label); if (_SpecItem_MemoryCompressed) { diff --git a/code/ryzom/client/src/user_agent.cpp b/code/ryzom/client/src/user_agent.cpp index 1452aa584..e1c364eef 100644 --- a/code/ryzom/client/src/user_agent.cpp +++ b/code/ryzom/client/src/user_agent.cpp @@ -18,10 +18,11 @@ #include "stdpch.h" #include "user_agent.h" +#include "client_cfg.h" #include "game_share/ryzom_version.h" -#if defined(RYZOM_COMPATIBILITY_VERSION) && defined(HAVE_REVISION_H) +#ifdef HAVE_REVISION_H #include "revision.h" #endif @@ -60,17 +61,57 @@ std::string getUserAgentVersion() if (s_userAgent.empty()) { - char buffer[256]; - -#if defined(REVISION) && defined(RYZOM_COMPATIBILITY_VERSION) - // we don't need RYZOM_VERSION if we already have a numeric form a.b.c, we just need to append revision to it - sprintf(buffer, "%s.%s-%s-%s", RYZOM_COMPATIBILITY_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH); +#ifdef REVISION + s_userAgent = NLMISC::toString("%s.%s-%s-%s", RYZOM_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH); #else - sprintf(buffer, "%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH); + s_userAgent = NLMISC::toString("%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH); #endif - - s_userAgent = buffer; } return s_userAgent; } + +std::string getVersion() +{ + return RYZOM_VERSION; +} + +std::string getDisplayVersion() +{ + static std::string s_version; + + if (s_version.empty()) + { +#if FINAL_VERSION + s_version = "FV "; +#else + s_version = "DEV "; +#endif + if (ClientCfg.ExtendedCommands) s_version += "_E"; + + s_version += getVersion(); + +#ifdef REVISION + s_version += NLMISC::toString(".%s", REVISION); +#endif + } + + return s_version; +} + +std::string getDebugVersion() +{ + static std::string s_version; + + if (s_version.empty()) + { + s_version = getDisplayVersion(); +#ifdef BUILD_DATE + s_version += NLMISC::toString(" (%s)", BUILD_DATE); +#else + s_version += NLMISC::toString(" (%s %s)", __DATE__, __TIME__); +#endif + } + + return s_version; +} diff --git a/code/ryzom/client/src/user_agent.h b/code/ryzom/client/src/user_agent.h index bc508273d..a7c59af28 100644 --- a/code/ryzom/client/src/user_agent.h +++ b/code/ryzom/client/src/user_agent.h @@ -21,6 +21,10 @@ std::string getUserAgent(); std::string getUserAgentName(); std::string getUserAgentVersion(); +std::string getVersion(); +std::string getDisplayVersion(); +std::string getDebugVersion(); + #endif // CL_USER_AGENT_H /* End of user_agent.h */ diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 62d45f330..dcf0ccf41 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -755,7 +755,7 @@ bool CUserEntity::mode(MBEHAV::EMode m) break; // Leave DEATH Mode case MBEHAV::DEATH: - // Restaure the last view. + // Restore the last view. viewMode(viewMode()); break; case MBEHAV::SWIM: diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index ffcdc42e5..21b967e8a 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -479,7 +479,7 @@ public: ucstring getLoginName() { - if (_LoginName == ucstring("")) + if (_LoginName.empty()) _LoginName = getDisplayName(); return _LoginName; diff --git a/code/ryzom/common/data_common/r2/r2_ui_event_handlers.lua b/code/ryzom/common/data_common/r2/r2_ui_event_handlers.lua index 431d89eae..f043db5d9 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_event_handlers.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_event_handlers.lua @@ -832,7 +832,7 @@ function r2:onActChanged(previousAct, currentAct) -- update the select bar r2.SelectBar:touch() - if r2:isScenarioUpdating() == 1 then + if r2:isScenarioUpdating() then return end diff --git a/code/ryzom/common/src/game_share/fame.cpp b/code/ryzom/common/src/game_share/fame.cpp index ca226ecdc..51f80114e 100644 --- a/code/ryzom/common/src/game_share/fame.cpp +++ b/code/ryzom/common/src/game_share/fame.cpp @@ -359,8 +359,7 @@ void CStaticFames::loadStaticFame( const string& filename ) // 1st, build the index table for (uint i=1; idoIsInteger(); + } + return doIsInteger(); +} + bool CObject::isString(const std::string & prop) const { //H_AUTO(R2_CObject_isString) @@ -239,6 +257,12 @@ bool CObject::doIsNumber() const return false; } +bool CObject::doIsInteger() const +{ + //H_AUTO(R2_CObject_doIsInteger) + return false; +} + bool CObject::doIsString() const { //H_AUTO(R2_CObject_doIsString) @@ -272,6 +296,20 @@ double CObject::toNumber(const std::string & prop) const return doToNumber(); } +sint64 CObject::toInteger(const std::string & prop) const +{ + //H_AUTO(R2_CObject_toInteger) + if (!prop.empty()) + { + CObject* attr = getAttr(prop); + if (!attr) + { + BOMB("Try to use the method toInteger() on a NULL Object", return 0); + } + return attr->doToInteger(); + } + return doToInteger(); +} std::string CObject::toString(const std::string & prop) const { @@ -328,6 +366,14 @@ double CObject::doToNumber() const } +sint64 CObject::doToInteger() const +{ + //H_AUTO(R2_CObject_doToInteger) + BOMB("Try to convert an objet to integer without being allowed", return 0); + return 0; + +} + std::string CObject::doToString() const { //H_AUTO(R2_CObject_doToString) @@ -366,11 +412,18 @@ bool CObject::set(const std::string& /* key */, const std::string & /* value */) return false; } -bool CObject::set(const std::string& /* key */, double /* value */){ +bool CObject::set(const std::string& /* key */, double /* value */) +{ BOMB("Try to set the value of an object with a double on an object that does not allowed it", return false); return false; } +bool CObject::set(const std::string& /* key */, sint64 /* value */) +{ + BOMB("Try to set the value of an object with an integer on an object that does not allowed it", return false); + return false; +} + bool CObject::setObject(const std::string& /* key */, CObject* /* value */) { BOMB("Try to set the value of an object with an object that does not allowed it", return false); @@ -602,7 +655,7 @@ bool CObjectString::set(const std::string& key, const std::string & value) bool CObjectString::setObject(const std::string& key, CObject* value) { //H_AUTO(R2_CObjectString_setObject) - BOMB_IF( !key.empty() || ! (value->isString() || value->isNumber()) , "Try to set the a sub value of an object that does not allowed it", return false); + BOMB_IF( !key.empty() || ! (value->isString() || value->isNumber() || value->isInteger()) , "Try to set the a sub value of an object that does not allowed it", return false); bool canSet = set(key, value->toString()); if (canSet) { @@ -732,7 +785,7 @@ void CObjectNumber::inPlaceCopy(const CObjectNumber &src) } -std::string CObjectNumber::doToString() const { return NLMISC::toString("%d", _Value);} +std::string CObjectNumber::doToString() const { return NLMISC::toString("%lf", _Value);} void CObjectNumber::doSerialize(std::string& out, CSerializeContext& /* context */) const { @@ -767,9 +820,6 @@ bool CObjectNumber::set(const std::string& key, const std::string & value) //H_AUTO(R2_CObjectNumber_set) //XXX BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); -// std::stringstream ss ; -// ss << value; -// ss >> _Value; NLMISC::fromString(value, _Value); return true; } @@ -806,11 +856,106 @@ bool CObjectNumber::equal(const CObject* other) const //H_AUTO(R2_CObjectNumber_equal) if (!other || !other->isNumber()) return false; double otherValue = other->toNumber(); - if (_Value == otherValue ) return true; - /* - fabs + epsilon trick - */ - return false; + if (_Value == otherValue) return true; + + // if difference between 2 values less than epsilon, we consider they are equals + return fabs(_Value - otherValue) <= std::numeric_limits::epsilon(); +} + + +//----------------------- CObjectInteger ---------------------------------------- + + +CObjectInteger::CObjectInteger(sint64 value) : CObject(), _Value(value){} + +const char *CObjectInteger::getTypeAsString() const +{ + return "Integer"; +} + +void CObjectInteger::visitInternal(IObjectVisitor &visitor) +{ + //H_AUTO(R2_CObjectInteger_visit) + visitor.visit(*this); +} + + +void CObjectInteger::inPlaceCopyTo(CObject &dest) const +{ + //H_AUTO(R2_CObjectInteger_inPlaceCopyTo) + dest.inPlaceCopy(*this); +} + +void CObjectInteger::inPlaceCopy(const CObjectInteger &src) +{ + //H_AUTO(R2_CObjectInteger_inPlaceCopy) + _Value = src._Value; + setGhost(src.getGhost()); +} + + +std::string CObjectInteger::doToString() const { return NLMISC::toString("%d"NL_I64, _Value); } + +void CObjectInteger::doSerialize(std::string& out, CSerializeContext& /* context */) const +{ + //H_AUTO(R2_CObjectInteger_doSerialize) + nlassert(!getGhost()); + out += NLMISC::toString(_Value); +} + +bool CObjectInteger::set(const std::string& key, sint64 value) +{ + //H_AUTO(R2_CObjectInteger_set) + + BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); + + _Value = value; + return true; +} + + +bool CObjectInteger::set(const std::string& key, const std::string & value) +{ + //H_AUTO(R2_CObjectInteger_set) + //XXX + BOMB_IF(key != "", "Try to set an element of a table on an object that is not a table", return false); + NLMISC::fromString(value, _Value); + return true; +} + + +sint64 CObjectInteger::doToInteger() const { return _Value; } + +CObject* CObjectInteger::clone() const +{ + //H_AUTO(R2_CObjectInteger_clone) + CObjectInteger *result = new CObjectInteger(_Value); + result->setGhost(getGhost()); + return result; +} + +bool CObjectInteger::doIsInteger() const { return true;} + + + +bool CObjectInteger::setObject(const std::string& /* key */, CObject* value) +{ + //H_AUTO(R2_CObjectInteger_setObject) + BOMB_IF(!value->isInteger(), NLMISC::toString("Try to set an element of a type '%s' with a value of type '%s' on an object that is not an integer", this->getTypeAsString(), value->getTypeAsString()), return false); + + _Value = value->toInteger(); + setGhost(value->getGhost()); + return true; +} + + + +bool CObjectInteger::equal(const CObject* other) const +{ + //H_AUTO(R2_CObjectInteger_equal) + if (!other || !other->isInteger()) return false; + sint64 otherValue = other->toInteger(); + return _Value == otherValue; } @@ -1756,7 +1901,7 @@ CObject* CObjectGenerator::instanciate(CObjectFactory* factory) const { CObject*defaultInBase = found->getAttr("DefaultInBase"); - if (!defaultInBase || (defaultInBase->isNumber() && defaultInBase->toNumber() != 1)) + if (!defaultInBase || (defaultInBase->isInteger() && defaultInBase->toInteger() != 1)) { std::string type = found->toString("Type"); @@ -1824,7 +1969,15 @@ void CObjectNumber::dump(const std::string prefix, uint depth) const { //H_AUTO(R2_CObjectNumber_dump) std::string result(depth * 4, ' '); - result += NLMISC::toString("%sNumber, ptr = 0x%p, value = %f, ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false"); + result += NLMISC::toString("%sNumber, ptr = 0x%p, value = %lf, ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false"); + nlwarning(result.c_str()); +} + +void CObjectInteger::dump(const std::string prefix, uint depth) const +{ + //H_AUTO(R2_CObjectInteger_dump) + std::string result(depth * 4, ' '); + result += NLMISC::toString("%sInteger, ptr = 0x%p, value = %d"NL_I64", ghost = %s", prefix.c_str(), this, _Value, _Ghost ? "true" : "false"); nlwarning(result.c_str()); } @@ -1929,96 +2082,169 @@ std::string CObject::uint32ToInstanceId(uint32 id) static void writeNumber( NLMISC::IStream& stream, double theValue) { - double value = theValue; - double absValue = fabs(value); - uint8 type; + double value = theValue; + double absValue = fabs(value); + uint8 type; - // It's 0 - if (absValue <= std::numeric_limits::epsilon()) + // It's 0 + if (absValue <= std::numeric_limits::epsilon()) + { + type = ObjectNumberZero; + stream.serial(type); + return; + } + + double integral; + + double fractional = modf(absValue, &integral); + + // It is an integral type (no fractional part) + if ( fractional <= std::numeric_limits::epsilon() ) + { + bool pos = 0.0 <= value; + // positif + if (pos) { - type = ObjectNumberZero; + if (integral <= uint8Max) + { + uint8 uint8value = static_cast(value); + type = ObjectNumberUInt8; + stream.serial(type); + stream.serial( uint8value); + return; + } + + if (integral <= uint16Max) + { + uint16 uint16value = static_cast(value); + type = ObjectNumberUInt16; + stream.serial(type); + stream.serial(uint16value); + return; + } + + if (integral <= uint32Max) + { + uint32 uint32value = static_cast(value); + type = ObjectNumberUInt32; + stream.serial(type); + stream.serial(uint32value); + return; + } + } + //negatif + else + { + if ( sint8Min <= integral && integral <= sint8Max) + { + sint8 sint8value = static_cast(value); + type = ObjectNumberSInt8; + stream.serial(type); + stream.serial( sint8value); + return; + } + + if ( sint16Min <= integral && integral <= sint16Max) + { + sint16 sint16value = static_cast(value); + type = ObjectNumberSInt16; + stream.serial(type); + stream.serial( sint16value); + return; + } + + if ( sint32Min <= integral && integral <= sint32Max) + { + sint32 sint32value = static_cast(value); + type = ObjectNumberSInt32; + stream.serial(type); + stream.serial( sint32value); + return; + } + + } + + } + + //Default case + // Float are evil: you loose too much precision + type = ObjectNumberDouble; + double fValue = value; + stream.serial(type); + stream.serial(fValue); +} + +static void writeInteger( NLMISC::IStream& stream, sint64 theValue) +{ + sint64 value = theValue; + uint8 type; + + // It's 0 + if (value == 0) + { + type = ObjectNumberZero; + stream.serial(type); + return; + } + + bool pos = value >= 0; + // positif + if (pos) + { + if (value <= uint8Max) + { + uint8 uint8value = static_cast(value); + type = ObjectNumberUInt8; stream.serial(type); + stream.serial( uint8value); return; } - double integral; - - double fractional = modf(absValue, &integral); - - // It is an integral type (no fractional part) - if ( fractional <= std::numeric_limits::epsilon() ) + if (value <= uint16Max) { - bool pos = 0.0 <= value; - // positif - if (pos) - { - if (integral <= uint8Max) - { - uint8 uint8value = static_cast(value); - type = ObjectNumberUInt8; - stream.serial(type); - stream.serial( uint8value); - return; - } - - if (integral <= uint16Max) - { - uint16 uint16value = static_cast(value); - type = ObjectNumberUInt16; - stream.serial(type); - stream.serial(uint16value); - return; - } - - if (integral <= uint32Max) - { - uint32 uint32value = static_cast(value); - type = ObjectNumberUInt32; - stream.serial(type); - stream.serial(uint32value); - return; - } - } - //negatif - else - { - if ( sint8Min <= integral && integral <= sint8Max) - { - sint8 sint8value = static_cast(value); - type = ObjectNumberSInt8; - stream.serial(type); - stream.serial( sint8value); - return; - } - - if ( sint16Min <= integral && integral <= sint16Max) - { - sint16 sint16value = static_cast(value); - type = ObjectNumberSInt16; - stream.serial(type); - stream.serial( sint16value); - return; - } - - if ( sint32Min <= integral && integral <= sint32Max) - { - sint32 sint32value = static_cast(value); - type = ObjectNumberSInt32; - stream.serial(type); - stream.serial( sint32value); - return; - } - - } - + uint16 uint16value = static_cast(value); + type = ObjectNumberUInt16; + stream.serial(type); + stream.serial(uint16value); + return; } - //Default case - // Float are evil: you loose too much precision - type = ObjectNumberDouble; - double fValue = value; - stream.serial(type); - stream.serial(fValue); + if (value <= uint32Max) + { + uint32 uint32value = static_cast(value); + type = ObjectNumberUInt32; + stream.serial(type); + stream.serial(uint32value); + return; + } + } + //negatif + else + { + if ( sint8Min <= value && value <= sint8Max) + { + sint8 sint8value = static_cast(value); + type = ObjectNumberSInt8; + stream.serial(type); + stream.serial( sint8value); + return; + } + + if ( sint16Min <= value && value <= sint16Max) + { + sint16 sint16value = static_cast(value); + type = ObjectNumberSInt16; + stream.serial(type); + stream.serial( sint16value); + return; + } + } + + // Default case + type = ObjectNumberSInt32; + sint32 fValue = (sint32)value; + stream.serial(type); + stream.serial(fValue); } static void serialStringInstanceId( NLMISC::IStream& stream, CObject*& data) @@ -2940,6 +3166,13 @@ void CObjectSerializerImpl::serialImpl(NLMISC::IStream& stream, CObject*& data, uint endLength = stream.getPos(); if (serializer->Log) { nldebug("R2NET: (%u) Null sent %u bytes", serializer->Level, endLength - initLength);} } + else if (data->isInteger()) + { + uint initLength = stream.getPos(); + writeInteger(stream, data->toInteger()); + uint endLength = stream.getPos(); + if (serializer->Log) { nldebug("R2NET: (%u) Integer sent %u bytes", serializer->Level, endLength - initLength); } + } else if (data->isNumber()) { uint initLength = stream.getPos(); diff --git a/code/ryzom/common/src/game_share/object.h b/code/ryzom/common/src/game_share/object.h index 41edf9087..71a30f32d 100644 --- a/code/ryzom/common/src/game_share/object.h +++ b/code/ryzom/common/src/game_share/object.h @@ -38,6 +38,7 @@ class CObjectTable; class CObjectString; class CObjectRefId; class CObjectNumber; +class CObjectInteger; class CSerializeContext; @@ -49,6 +50,7 @@ struct IObjectVisitor virtual void visit(CObjectRefId &/* obj */) {} virtual void visit(CObjectString &/* obj */) {} virtual void visit(CObjectNumber &/* obj */) {} + virtual void visit(CObjectInteger &/* obj */) {} virtual void visit(CObjectTable &/* obj */) {} }; @@ -82,6 +84,8 @@ public: // test type bool isNumber(const std::string & prop="") const; + bool isInteger(const std::string & prop="") const; + bool isString(const std::string & prop="") const; bool isTable(const std::string & prop="") const; @@ -93,6 +97,8 @@ public: // to Value double toNumber(const std::string & prop="") const; + sint64 toInteger(const std::string & prop="") const; + std::string toString(const std::string & prop="") const; CObjectTable* toTable(const std::string & prop="") const; @@ -127,12 +133,16 @@ public: void add(const std::string& key, double value); + void add(const std::string& key, sint64 value); + // set Value virtual bool set(const std::string& key, const std::string & value); virtual bool set(const std::string& key, double value); + virtual bool set(const std::string& key, sint64 value); + virtual bool setObject(const std::string& key, CObject* value); CObject* getParent() const; @@ -172,6 +182,8 @@ protected: virtual bool doIsNumber() const; + virtual bool doIsInteger() const; + virtual bool doIsString() const; virtual bool doIsTable() const; @@ -180,6 +192,8 @@ protected: virtual double doToNumber() const; + virtual sint64 doToInteger() const; + virtual std::string doToString() const; virtual CObjectTable* doToTable() const; @@ -192,6 +206,7 @@ public: virtual void inPlaceCopyTo(CObject &dest) const = 0; virtual void inPlaceCopy(const CObjectString &src); virtual void inPlaceCopy(const CObjectNumber &src); + virtual void inPlaceCopy(const CObjectInteger &src); virtual void inPlaceCopy(const CObjectTable &src); protected: void copyMismatchMsg(const CObject &src); @@ -307,6 +322,45 @@ private: }; +class CObjectInteger : public CObject +{ + +public: + explicit CObjectInteger(sint64 value); + + virtual const char *getTypeAsString() const; + + virtual bool set(const std::string& key, sint64 value); + virtual bool set(const std::string& key, const std::string &value); + + virtual bool setObject(const std::string& key, CObject* value); + + virtual CObject* clone() const; + + sint64 getValue() const { return _Value; } + + virtual void dump(const std::string prefix = "", uint depth = 0) const; + + virtual bool equal(const CObject* other) const; + +protected: + virtual void doSerialize(std::string& out, CSerializeContext& context) const; + + virtual bool doIsInteger() const; + + virtual sint64 doToInteger() const; + + virtual std::string doToString() const; + + virtual void inPlaceCopyTo(CObject &dest) const; + virtual void inPlaceCopy(const CObjectInteger &src); + + virtual void visitInternal(IObjectVisitor &visitor); + +private: + sint64 _Value; +}; + class CObjectTable: public CObject { diff --git a/code/ryzom/common/src/game_share/scenario_entry_points.cpp b/code/ryzom/common/src/game_share/scenario_entry_points.cpp index 7c01af145..e97adb84c 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -372,7 +372,7 @@ void CScenarioEntryPoints::loadFromXMLFile() //entry points and package TShortEntryPoints entryPoints; - std::string package = std::string(""); + std::string package; for(uint e=0; e<_EntryPoints.size(); e++) { const CEntryPoint & entryPoint = _EntryPoints[e]; diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 3d3548d54..794d88212 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -609,9 +609,9 @@ public: void setAttributeAsBool(const std::string & attrName, const std::string& propName) { CObject* attr = _Object->getAttr(attrName); - if (attr && attr->isNumber()) + if (attr && attr->isInteger()) { - sint value = static_cast(attr->toNumber()); + sint value = static_cast(attr->toInteger()); _Primitive->addPropertyByName(propName.c_str(), new CPropertyString(value?"true":"false")); } } @@ -1093,7 +1093,7 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string CObject* weight = action->getAttr("Weight"); if(weight) { - uint32 w = (int)weight->toNumber(); + uint32 w = (int)weight->toInteger(); std::string weightStr = toString(w); pAction->addPropertyByName("Weight", new CPropertyString(weightStr)); } @@ -1381,7 +1381,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C animSession->Acts[actId] = rtAct; - if ( act->isNumber("LocationId") + if ( act->isInteger("LocationId") && act->isString("Name") && act->isString("ActDescription") && act->isString("PreActDescription") @@ -1390,7 +1390,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C rtAct->Name = act->toString("Name"); rtAct->ActDescription = act->toString("ActDescription"); rtAct->PreActDescription = act->toString("PreActDescription"); - rtAct->LocationId = static_cast(act->toNumber("LocationId")); + rtAct->LocationId = static_cast(act->toInteger("LocationId")); } else { @@ -1508,9 +1508,9 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C a2pAiState.setAttributeAsStringArray("Keywords", "keywords"); bool isTriggerZone = false; - if ( aiState->isNumber("IsTriggerZone") ) + if ( aiState->isInteger("IsTriggerZone") ) { - isTriggerZone = static_cast(aiState->toNumber("IsTriggerZone")) == 1; + isTriggerZone = aiState->toInteger("IsTriggerZone") == 1; } if (isTriggerZone) { @@ -1550,7 +1550,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C npc_group->addPropertyByName("name", new CPropertyString(prefix+component->toString("Id"))); npc_group->addPropertyByName("ai_type", new CPropertyString("GROUP_NPC")); // AJM - if (component->isNumber("AutoSpawn") && component->toNumber("AutoSpawn")==0) + if (component->isInteger("AutoSpawn") && component->toInteger("AutoSpawn")==0) { npc_group->addPropertyByName("autoSpawn", new CPropertyString("false")); } @@ -1740,9 +1740,9 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C npc_bot->insertChild(npc_bot_alias); // nlinfo("R2Anim: Bot %u %s", npc_bot_alias->getFullAlias(), std::string(prefix+objectNpc->toString("Id")).c_str()); uint32 dmProperty = 0; - if (objectNpc->isNumber("DmProperty")) + if (objectNpc->isInteger("DmProperty")) { - dmProperty = static_cast< uint32 > (objectNpc->toNumber("DmProperty")); + dmProperty = static_cast< uint32 > (objectNpc->toInteger("DmProperty")); } CRtNpc* rtNpc = new CRtNpc(npc_bot_alias->getFullAlias(), objectNpc, npc_group_alias->getFullAlias(), dmProperty); @@ -1770,9 +1770,9 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C CObject* eventObject = events->getValue(firstEvent); bool isTriggerZone = false; - if ( eventObject->isNumber("IsTriggerZone") ) + if ( eventObject->isInteger("IsTriggerZone") ) { - isTriggerZone = static_cast(eventObject->toNumber("IsTriggerZone")) == 1; + isTriggerZone = static_cast(eventObject->toInteger("IsTriggerZone")) == 1; } if (isTriggerZone) { @@ -1788,7 +1788,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C CObject *weatherValue = act->getAttr("WeatherValue"); if (weatherValue) { - animSession->Acts[actId]->WeatherValue = (uint16) weatherValue->toNumber(); + animSession->Acts[actId]->WeatherValue = (uint16) weatherValue->toInteger(); } @@ -1901,7 +1901,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi CObject* plotItem = plotItems->getValue(firstPlotItem); if (!plotItem || !plotItem->isTable() - || !plotItem->isNumber("SheetId") + || !plotItem->isInteger("SheetId") || !plotItem->isString("Name") || !plotItem->isString("Description") || !plotItem->isString("Comment") @@ -1911,7 +1911,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi return false; } - uint32 sheetIdAsInt = static_cast(plotItem->toNumber("SheetId")); + uint32 sheetIdAsInt = static_cast(plotItem->toInteger("SheetId")); CSheetId plotItemSheetId( sheetIdAsInt ); @@ -1958,7 +1958,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi CObject* location = locations->getValue(firstLocation); if (!location || !location->isTable() - || !location->isNumber("Season") + || !location->isInteger("Season") || !location->isString("Island") || !location->isString("EntryPoint") @@ -1969,7 +1969,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi } CRtLocation locationItem; - locationItem.Season = static_cast(location->toNumber("Season")); + locationItem.Season = static_cast(location->toInteger("Season")); locationItem.Island = location->toString("Island"); locationItem.EntryPoint = location->toString("EntryPoint"); animSession->Locations.push_back(locationItem); diff --git a/code/ryzom/common/src/game_share/small_string_manager.cpp b/code/ryzom/common/src/game_share/small_string_manager.cpp index 5d07ecb63..e57d7d17b 100644 --- a/code/ryzom/common/src/game_share/small_string_manager.cpp +++ b/code/ryzom/common/src/game_share/small_string_manager.cpp @@ -113,7 +113,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager) return; } CObject* texts = textManager->getAttr("Texts"); - uint32 maxId = static_cast(textManager->getAttr("MaxId")->toNumber()); + uint32 maxId = static_cast(textManager->getAttr("MaxId")->toInteger()); CObject* unused = textManager->getAttr("UnusedIds"); uint32 max = unused->getSize(); @@ -123,7 +123,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager) //unused ids for(uint32 i=0;i(unused->getValue(i)->toNumber()); + uint32 id = static_cast(unused->getValue(i)->toInteger()); _FreeIds.insert(id); } @@ -133,8 +133,8 @@ CSmallStringManager::CSmallStringManager(CObject* textManager) { CObject* entry = texts->getValue(i); std::string text = entry->getAttr("Text")->toString(); - uint32 textId = static_cast(entry->getAttr("TextId")->toNumber()); - uint32 textCount = static_cast(entry->getAttr("Count")->toNumber()); + uint32 textId = static_cast(entry->getAttr("TextId")->toInteger()); + uint32 textCount = static_cast(entry->getAttr("Count")->toInteger()); _StringToId.insert(std::pair(text, textId)); _IdToString.insert( std::pair >(textId, std::pair(text, textCount) ) ); } diff --git a/code/ryzom/common/src/game_share/time_weather_season/weather_manager.cpp b/code/ryzom/common/src/game_share/time_weather_season/weather_manager.cpp index 15445a0e6..7d2f42aa7 100644 --- a/code/ryzom/common/src/game_share/time_weather_season/weather_manager.cpp +++ b/code/ryzom/common/src/game_share/time_weather_season/weather_manager.cpp @@ -35,7 +35,7 @@ void CWeatherManager::init(const std::vector &sh { if (sheets[k]) { - std::string id = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(sheetNames[k])); + std::string id = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(sheetNames[k])); CWeatherSetup *ws = newWeatherSetup(); if (ws) { @@ -70,7 +70,7 @@ void CWeatherManager::release() //================================================================================================ const CWeatherSetup *CWeatherManager::getSetup(const char *name) const { - std::string id = NLMISC::strlwr(CFile::getFilenameWithoutExtension(name)); + std::string id = NLMISC::toLower(CFile::getFilenameWithoutExtension(name)); TWeatherSetupMap::const_iterator it = _WeatherSetupMap.find(id); if (it == _WeatherSetupMap.end()) return NULL; return it->second; diff --git a/code/ryzom/common/src/game_share/time_weather_season/weather_setup_sheet_base.cpp b/code/ryzom/common/src/game_share/time_weather_season/weather_setup_sheet_base.cpp index 6d868741d..345b0e4a2 100644 --- a/code/ryzom/common/src/game_share/time_weather_season/weather_setup_sheet_base.cpp +++ b/code/ryzom/common/src/game_share/time_weather_season/weather_setup_sheet_base.cpp @@ -85,7 +85,7 @@ void CWeatherStateSheet::build(const NLGEORGES::UFormElm &item) GetWeatherFormValue(item, fxName, "FXName"); if (!fxName.empty()) { - fxName = NLMISC::strlwr(NLMISC::CFile::getFilenameWithoutExtension(fxName)); + fxName = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fxName)); if (!fxName.empty()) { FXInfos.resize(1); @@ -192,7 +192,7 @@ void CWeatherSetupSheetBase::build(const NLGEORGES::UFormElm &item) CloudState.build(item); std::string setupName; GetWeatherFormValue(item, setupName, "SetupName"); - SetupName = NLMISC::CStringMapper::map(NLMISC::strlwr(setupName)); + SetupName = NLMISC::CStringMapper::map(NLMISC::toLower(setupName)); } //================================================================================== @@ -203,7 +203,7 @@ void CWeatherSetupSheetBase::serial(class NLMISC::IStream &f) throw(NLMISC::EStr { std::string setupName; f.serial(setupName); - SetupName = NLMISC::CStringMapper::map(NLMISC::strlwr(setupName)); + SetupName = NLMISC::CStringMapper::map(NLMISC::toLower(setupName)); } else { diff --git a/code/ryzom/common/src/game_share/utils.h b/code/ryzom/common/src/game_share/utils.h index 56ac05e0f..a93c68a4d 100644 --- a/code/ryzom/common/src/game_share/utils.h +++ b/code/ryzom/common/src/game_share/utils.h @@ -425,7 +425,8 @@ inline void CCallStackSingleton::setTopStackEntry(ICallStackEntry* newEntry) inline void CCallStackSingleton::display(NLMISC::CLog *log) { nlassert(log!=NULL); - getTopStackEntry()->displayStack(*log); + ICallStackEntry *entry = getTopStackEntry(); + if (entry) entry->displayStack(*log); log->displayNL(""); } @@ -468,15 +469,13 @@ inline ICallStackEntry::~ICallStackEntry() inline void ICallStackEntry::displayStack(NLMISC::CLog& log) const { // stop recursing when we reach a NULL object - // (this is implemented in this way in order to ximplify call code) - if (this==NULL) - return; + // (this is implemented in this way in order to simplify call code) // display this entry displayEntry(log); // recurse through call stack - _Next->displayStack(log); + if (_Next) _Next->displayStack(log); } diff --git a/code/ryzom/server/src/frontend_service/client_id_lookup.h b/code/ryzom/server/src/frontend_service/client_id_lookup.h index 9c63a60a6..c08524c99 100644 --- a/code/ryzom/server/src/frontend_service/client_id_lookup.h +++ b/code/ryzom/server/src/frontend_service/client_id_lookup.h @@ -116,7 +116,7 @@ private: struct CIdHash { - enum { bucket_size = 4, min_buckets = 8, }; + enum { bucket_size = 4, min_buckets = 8 }; size_t operator () (NLMISC::CEntityId id) const { return (uint32)id.getShortId(); } bool operator() (const NLMISC::CEntityId& left, const NLMISC::CEntityId& right) { return left < right; } }; diff --git a/code/ryzom/server/src/frontend_service/fe_types.h b/code/ryzom/server/src/frontend_service/fe_types.h index d63ef1e42..b015a2d0e 100644 --- a/code/ryzom/server/src/frontend_service/fe_types.h +++ b/code/ryzom/server/src/frontend_service/fe_types.h @@ -71,7 +71,7 @@ typedef uint32 TUid; */ struct CInetAddressHashMapTraits { - enum { bucket_size = 4, min_buckets = 8, }; + enum { bucket_size = 4, min_buckets = 8 }; inline size_t operator() ( const NLNET::CInetAddress& x ) const { //return x.port(); diff --git a/code/ryzom/server/src/gpm_service/world_position_manager.h b/code/ryzom/server/src/gpm_service/world_position_manager.h index 81209357c..31030a582 100644 --- a/code/ryzom/server/src/gpm_service/world_position_manager.h +++ b/code/ryzom/server/src/gpm_service/world_position_manager.h @@ -139,7 +139,7 @@ public: struct CEntityIdHash { - enum { bucket_size = 4, min_buckets = 8, }; + enum { bucket_size = 4, min_buckets = 8 }; size_t operator () (const NLMISC::CEntityId &id) const { return (uint32)id.getShortId(); } size_t operator () (const NLMISC::CEntityId &left, const NLMISC::CEntityId &right) const { return left < right; } }; diff --git a/code/ryzom/server/src/pd_lib/pd_utils.h b/code/ryzom/server/src/pd_lib/pd_utils.h index 85a183753..45cf2025b 100644 --- a/code/ryzom/server/src/pd_lib/pd_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_utils.h @@ -490,7 +490,7 @@ typedef std::vector TIndexList; struct CColumnIndexHashMapTraits { - enum { bucket_size = 4, min_buckets = 8, }; + enum { bucket_size = 4, min_buckets = 8 }; CColumnIndexHashMapTraits() { } size_t operator() (const CColumnIndex &id) const {