Compare commits
92 Commits
master
...
stable-5.2
Author | SHA1 | Date |
---|---|---|
Martin Plicht | cf18d82e36 | |
Martin Plicht | 2c597ba56d | |
Martin Plicht | a28cad6947 | |
Martin Plicht | 1bb87d2b60 | |
Martin Plicht | 6d64a1a138 | |
Martin Plicht | 39caae97c6 | |
Martin Plicht | 7ee45e13d8 | |
Martin Plicht | 597af907cb | |
Günther Brammer | 1904bffbd4 | |
Armin Burgmeier | e0817719b8 | |
Günther Brammer | df0282fc72 | |
Günther Brammer | 0367dabb63 | |
Günther Brammer | b660f093fc | |
Günther Brammer | a135349703 | |
Günther Brammer | 0e65c78185 | |
Nicolas Hake | bc1f569616 | |
Günther Brammer | 6728ab7992 | |
Günther Brammer | 3790390347 | |
Nicolas Hake | bfdf1ec8c8 | |
Armin Burgmeier | af7788f4f4 | |
Armin Burgmeier | 76baf72dfa | |
Nicolas Hake | 8f0a3a6d5c | |
Günther Brammer | 2847569a12 | |
Günther Brammer | 8baf5d7ced | |
Günther Brammer | 6b484eb2e5 | |
Günther Brammer | dd7a9eb0e4 | |
Günther Brammer | 03d6d785b9 | |
Armin Burgmeier | 387446c57d | |
Armin Burgmeier | fc598e79dc | |
Armin Burgmeier | a2fb35c985 | |
Armin Burgmeier | 031db9d065 | |
Julius Michaelis | 5d46424208 | |
Armin Burgmeier | 40df45eb02 | |
Armin Burgmeier | 8ceac9e3d2 | |
Armin Burgmeier | df710e6c41 | |
Peter Wortmann | d5cf613cc1 | |
Peter Wortmann | d795f983bb | |
Nicolas Hake | 0fe9cb41cd | |
Armin Burgmeier | a5db0007c6 | |
Nicolas Hake | c502ff6091 | |
Armin Burgmeier | 0b2e7d6230 | |
Maikel de Vries | 01e79fa307 | |
Armin Burgmeier | 1687665806 | |
Günther Brammer | 5de72042fe | |
Günther Brammer | fd4bf9caa5 | |
Günther Brammer | 24a146daa6 | |
Günther Brammer | d5ba2f4b2e | |
Nicolas Hake | 3ac1d08465 | |
Armin Burgmeier | 283c6f2a94 | |
Armin Burgmeier | 801b10881b | |
Charles Spurrill | 1f78d57516 | |
Günther Brammer | ef7dcac3ba | |
Charles Spurrill | 82d97e122b | |
Charles Spurrill | 7df4f31118 | |
Julius Michaelis | 79ac14ac5d | |
Maikel de Vries | d21a1197e8 | |
Maikel de Vries | d3007f0bb3 | |
Maikel de Vries | 5df61780d4 | |
Peter Wortmann | 7b3ff34eea | |
Günther Brammer | bb957295b2 | |
Nicolas Hake | c9568b26fe | |
Peter Wortmann | b45ad749dd | |
Günther Brammer | d084c05841 | |
Charles Spurrill | 408eba7ba6 | |
Sven Eberhardt | f392a5e673 | |
Günther Brammer | 7390cb3fdb | |
Günther Brammer | e5b2042b6e | |
Peter Wortmann | 21fc50ac0d | |
Peter Wortmann | 19b3b86bc7 | |
Martin Plicht | 1cbd35d7ca | |
Richard Gerum | a28578e757 | |
Richard Gerum | 7e56f44bc6 | |
Armin Burgmeier | 10b1708510 | |
Richard Gerum | e347b543ac | |
Richard Gerum | 3b0edd304f | |
Charles Spurrill | 0814e677ac | |
Sven Eberhardt | b4d523851a | |
Sven Eberhardt | 067886a140 | |
Richard Gerum | 413d54287d | |
Richard Gerum | 2e19a1a2cb | |
Charles Spurrill | c6121963b8 | |
Charles Spurrill | f5b3a365b4 | |
Peter Wortmann | d3fb7c5d8f | |
Armin Burgmeier | 38dd699493 | |
Peter Wortmann | e8173c224c | |
Charles Spurrill | a432f571ea | |
Felix Wagner | cb1fa699f9 | |
Charles Spurrill | dd09e00321 | |
Charles Spurrill | 6cf62360b1 | |
Charles Spurrill | edc56decbb | |
Tobias Zwick | d830e834e7 | |
Günther Brammer | ae0286adc8 |
|
@ -59,7 +59,6 @@ planet/MinSizeRel
|
|||
planet/clonk.dir
|
||||
planet/c4group.dir
|
||||
planet/ZERO_CHECK.dir
|
||||
planet/libeay32.dll
|
||||
planet/fmod.dll
|
||||
planet/cmake_install.cmake
|
||||
planet/clonk.sln
|
||||
|
@ -74,7 +73,6 @@ Debug
|
|||
clonk.dir
|
||||
c4group.dir
|
||||
ZERO_CHECK.dir
|
||||
libeay32.dll
|
||||
fmod.dll
|
||||
cmake_install.cmake
|
||||
clonk.sln
|
||||
|
|
159
CMakeLists.txt
|
@ -77,6 +77,7 @@ else()
|
|||
endif()
|
||||
if(APPLE)
|
||||
option(USE_COCOA "Use Apple Cocoa for the developer mode and the windows." ON)
|
||||
option(USE_APPLE_CLANG "Use Apple Clang Compiler as C++ compiler." ON)
|
||||
SET(INITIAL_USE_OPEN_AL ON)
|
||||
else()
|
||||
option(USE_COCOA OFF)
|
||||
|
@ -183,8 +184,6 @@ set(OC_CLONK_SOURCES
|
|||
src/C4Version.h
|
||||
src/config/C4Config.cpp
|
||||
src/config/C4Config.h
|
||||
src/config/C4ConfigShareware.cpp
|
||||
src/config/C4ConfigShareware.h
|
||||
src/config/C4Constants.h
|
||||
src/config/C4Reloc.cpp
|
||||
src/config/C4Reloc.h
|
||||
|
@ -398,6 +397,7 @@ set(OC_CLONK_SOURCES
|
|||
src/lib/C4Stat.h
|
||||
src/lib/PathFinder.cpp
|
||||
src/lib/PathFinder.h
|
||||
src/lib/SHA1.h
|
||||
src/lib/Standard.cpp
|
||||
src/lib/Standard.h
|
||||
src/lib/StdAdaptors.h
|
||||
|
@ -548,6 +548,7 @@ set(OC_CLONK_SOURCES
|
|||
src/script/C4ValueMap.h
|
||||
src/zlib/gzio.c
|
||||
src/zlib/zutil.h
|
||||
thirdparty/timsort/sort.h
|
||||
)
|
||||
mark_as_advanced(OC_CLONK_SOURCES)
|
||||
mark_as_advanced(OC_SYSTEM_SOURCES)
|
||||
|
@ -788,11 +789,6 @@ macro(FINDLIB lib)
|
|||
mark_as_advanced(${lib})
|
||||
endmacro(FINDLIB)
|
||||
|
||||
# isilkor 09-05-29: Don't use FindOpenSSL, because that wants to link to ssleay
|
||||
FINDLIB(OPENSSL_LIBRARIES NAMES crypto libeay32)
|
||||
FIND_PATH(OPENSSL_INCLUDE_DIR NAMES openssl/sha.h)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
if(USE_CONSOLE)
|
||||
find_package(Readline)
|
||||
include_directories(${READLINE_INCLUDE_DIRS})
|
||||
|
@ -954,7 +950,6 @@ target_link_libraries(clonk
|
|||
${ZLIB_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${ICONV_LIBRARY}
|
||||
${VORBIS_LIBRARY}
|
||||
${VORBISFILE_LIBRARY}
|
||||
|
@ -962,11 +957,9 @@ target_link_libraries(clonk
|
|||
)
|
||||
target_link_libraries(c4group
|
||||
${ZLIB_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
target_link_libraries(c4script
|
||||
${ZLIB_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
if(HAVE_PTHREAD)
|
||||
target_link_libraries(netpuncher
|
||||
|
@ -985,18 +978,6 @@ endif()
|
|||
set_property(TARGET clonk APPEND PROPERTY COMPILE_DEFINITIONS GLEW_STATIC)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG _DEBUG)
|
||||
|
||||
if (APPLE)
|
||||
add_custom_command(TARGET clonk
|
||||
POST_BUILD COMMAND "/bin/sh" "${CMAKE_CURRENT_SOURCE_DIR}/tools/osx_bundle_libs.sh"
|
||||
)
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
|
||||
endif()
|
||||
|
||||
# This expands some variables in Info.plist as a side-effect. XCode might then
|
||||
# expand a second time, using the same syntax. Try not to get confused by this!
|
||||
set_target_properties(clonk PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Info.plist")
|
||||
|
@ -1086,6 +1067,39 @@ if(USE_GCC_PCH)
|
|||
add_precompiled_header(c4group src/C4Include.h)
|
||||
endif()
|
||||
|
||||
############################################################################
|
||||
# Some Xcode/OSX specific settings involving building with clang, precompiled headers...
|
||||
############################################################################
|
||||
|
||||
if (APPLE)
|
||||
add_custom_command(TARGET clonk
|
||||
POST_BUILD COMMAND "/usr/bin/ruby" "${CMAKE_CURRENT_SOURCE_DIR}/tools/osx_bundle_libs"
|
||||
)
|
||||
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
|
||||
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
|
||||
|
||||
if (USE_APPLE_CLANG)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++0x -stdlib=libc++ -g -Wall")
|
||||
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++0x objective-c++0x")
|
||||
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++0x objective-c++0x")
|
||||
|
||||
set(HAVE_RVALUE_REF ON)
|
||||
else()
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
############################################################################
|
||||
# Locate optional libraries (if so desired)
|
||||
############################################################################
|
||||
|
@ -1189,20 +1203,13 @@ if (WIN32)
|
|||
target_link_libraries(c4script ws2_32 winmm)
|
||||
|
||||
if(NOT USE_OPEN_AL)
|
||||
if(MSVC_VERSION)
|
||||
if(CMAKE_CL_64)
|
||||
FINDLIB(FMOD_LIBRARIES fmod64vc)
|
||||
else()
|
||||
FINDLIB(FMOD_LIBRARIES fmodvc)
|
||||
endif()
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
FINDLIB(FMOD_LIBRARIES fmod)
|
||||
endif()
|
||||
if(FMOD_LIBRARIES)
|
||||
find_package(FMod)
|
||||
if(FMOD_FOUND)
|
||||
set(HAVE_FMOD TRUE)
|
||||
target_link_libraries(clonk
|
||||
${FMOD_LIBRARIES}
|
||||
)
|
||||
include_directories(${FMOD_INCLUDE_DIR})
|
||||
else()
|
||||
set(HAVE_FMOD FALSE)
|
||||
endif()
|
||||
|
@ -1250,40 +1257,9 @@ EXECUTE_PROCESS(COMMAND \"convert\" \"${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico
|
|||
IF(NOT \${CONVERT_RESULT} EQUAL 0)
|
||||
MESSAGE(SEND_ERROR \"Creating icon failed\")
|
||||
ENDIF()
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/openclonk)
|
||||
")
|
||||
|
||||
# Remove previously installed data files
|
||||
FILE(GLOB OC_INSTALLED_DATA_FILES "${CMAKE_INSTALL_PREFIX}/share/openclonk/*.oc[dfgs]")
|
||||
install(CODE "
|
||||
FOREACH(CURRENT_FILE ${OC_INSTALLED_DATA_FILES})
|
||||
FILE(REMOVE \${CURRENT_FILE})
|
||||
ENDFOREACH()
|
||||
")
|
||||
|
||||
# Install new files
|
||||
FILE(GLOB OC_DATA_FILES "${CMAKE_CURRENT_SOURCE_DIR}/planet/*.oc[dfgs]")
|
||||
install(DIRECTORY ${OC_DATA_FILES} DESTINATION share/openclonk)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/clonk.desktop DESTINATION share/applications)
|
||||
|
||||
# Pack them
|
||||
install(CODE "
|
||||
FOREACH(CURRENT_FILE ${OC_DATA_FILES})
|
||||
GET_FILENAME_COMPONENT(CURRENT_FILENAME \"\${CURRENT_FILE}\" NAME)
|
||||
MESSAGE(\"Packing \${CURRENT_FILENAME}...\")
|
||||
EXECUTE_PROCESS(COMMAND \"${CMAKE_CURRENT_BINARY_DIR}/c4group\" \"${CMAKE_INSTALL_PREFIX}/share/openclonk/\${CURRENT_FILENAME}\" \"-p\" RESULT_VARIABLE C4GROUP_RESULT)
|
||||
IF(NOT \${C4GROUP_RESULT} EQUAL 0)
|
||||
MESSAGE(SEND_ERROR \"Packing ${CURRENT_FILENAME} failed\")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
")
|
||||
|
||||
# Install binaries
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/clonk ${CMAKE_CURRENT_BINARY_DIR}/c4group DESTINATION bin/)
|
||||
|
||||
############################################################################
|
||||
# setup_openclonk.exe
|
||||
############################################################################
|
||||
|
||||
set(OC_C4GROUPS
|
||||
Graphics.ocg
|
||||
Material.ocg
|
||||
|
@ -1298,29 +1274,64 @@ set(OC_C4GROUPS
|
|||
get_target_property(C4GROUP_LOCATION c4group LOCATION)
|
||||
get_target_property(CLONK_LOCATION clonk LOCATION)
|
||||
foreach(group ${OC_C4GROUPS})
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${group}
|
||||
COMMAND ${C4GROUP_LOCATION} ${CMAKE_CURRENT_SOURCE_DIR}/planet/${group} -t ${CMAKE_CURRENT_BINARY_DIR}/${group}
|
||||
DEPENDS c4group ${CMAKE_CURRENT_SOURCE_DIR}/planet/${group}
|
||||
VERBATIM
|
||||
)
|
||||
if (APPLE)
|
||||
add_custom_command(TARGET clonk
|
||||
POST_BUILD COMMAND "/bin/sh" "${CMAKE_CURRENT_SOURCE_DIR}/tools/osx_pack_gamedata.sh"
|
||||
"${C4GROUP_LOCATION}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/planet/${group}"
|
||||
DEPENDS c4group
|
||||
)
|
||||
else()
|
||||
INSTALL(CODE "
|
||||
MESSAGE(\"Packing and installing ${group}...\")
|
||||
EXECUTE_PROCESS(COMMAND \"${CMAKE_CURRENT_BINARY_DIR}/c4group\" \"${CMAKE_CURRENT_SOURCE_DIR}/planet/${group}\" -t \"${CMAKE_INSTALL_PREFIX}/share/openclonk/${group}\" RESULT_VARIABLE PACK_RESULT)
|
||||
IF(NOT \${PACK_RESULT} EQUAL 0)
|
||||
MESSAGE(SEND_ERROR \"Packing ${group} failed\")
|
||||
ENDIF()
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Install new files
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/clonk.desktop DESTINATION share/applications)
|
||||
|
||||
# Install binaries
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/clonk ${CMAKE_CURRENT_BINARY_DIR}/c4group DESTINATION bin/)
|
||||
|
||||
############################################################################
|
||||
# setup_openclonk.exe
|
||||
############################################################################
|
||||
|
||||
find_program(MAKENSIS makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS])
|
||||
|
||||
string(REPLACE / \\ C4GROUP_LOCATION ${C4GROUP_LOCATION})
|
||||
string(REPLACE / \\ CLONK_LOCATION ${CLONK_LOCATION})
|
||||
|
||||
foreach(group ${OC_C4GROUPS})
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${group}"
|
||||
COMMAND c4group ARGS "${CMAKE_CURRENT_SOURCE_DIR}/planet/${group}" -t "${CMAKE_CURRENT_BINARY_DIR}/${group}"
|
||||
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/planet/${group}
|
||||
DEPENDS c4group
|
||||
VERBATIM
|
||||
)
|
||||
endforeach()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT setup_openclonk.exe
|
||||
COMMAND ${MAKENSIS} -NOCD -DSRCDIR=${CMAKE_CURRENT_SOURCE_DIR} -DPROGRAMFILES=$PROGRAMFILES "-DPRODUCT_NAME=${C4ENGINENAME}${C4VERSIONBUILDNAME}" "-DPRODUCT_COMPANY=${C4PROJECT}" "-DCLONK=${CLONK_LOCATION}" "-DC4GROUP=${C4GROUP_LOCATION}" ${CMAKE_CURRENT_SOURCE_DIR}/tools/install/oc.nsi "-XOutFile setup_openclonk.exe"
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tools/install/oc.nsi ${OC_C4GROUPS} clonk c4group
|
||||
MAIN_DEPENDENCY
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/install/oc.nsi
|
||||
DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/install/header.bmp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/install/inst.ico
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tools/install/uninst.ico
|
||||
${OC_C4GROUPS} clonk c4group
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(setup
|
||||
DEPENDS setup_openclonk.exe
|
||||
SOURCES tools/install/oc.nsi tools/install/header.bmp tools/install/inst.ico tools/install/uninst.ico
|
||||
)
|
||||
|
||||
############################################################################
|
||||
|
@ -1337,8 +1348,8 @@ set(CPACK_PACKAGE_FILE_NAME "openclonk-${C4XVER1}.${C4XVER2}.${C4XVER3}")
|
|||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "openclonk-src-${C4XVER1}.${C4XVER2}.${C4XVER3}")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
||||
# Somebody who uses Debian/Ubuntu should set this
|
||||
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libgcc1, libx11, libXrandr, libXpm, libGLEW, libGL, libpng, libssl, libSDL-1.2, libSDL_mixer-1.2, gtk2, libjpeg, zlib")
|
||||
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libgcc1, libx11, libXrandr, libXpm, libGLEW, libGL, libpng, libSDL-1.2, libSDL_mixer-1.2, gtk2, libjpeg, zlib")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libc6, libgcc1, libx11, libXrandr, libXpm, libGLEW, libGL, libpng, libssl, libSDL-1.2, libSDL_mixer-1.2, gtk2, libjpeg, zlib")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libc6, libgcc1, libx11, libXrandr, libXpm, libGLEW, libGL, libpng, libSDL-1.2, libSDL_mixer-1.2, gtk2, libjpeg, zlib")
|
||||
|
||||
include(CPack)
|
||||
|
|
25
Makefile.am
|
@ -87,6 +87,9 @@ do_subst = sed -e 's,[@]C4PROJECT[@],'"$$(sed -n 's/SET(C4PROJECT\s\+"\(.\+\)")/
|
|||
|
||||
C4Version.h: $(srcdir)/src/C4Version.h.in $(srcdir)/Version.txt
|
||||
$(do_subst) < $< > $@
|
||||
WindowsGamesExplorer.xml: $(srcdir)/src/res/WindowsGamesExplorer.xml.in $(srcdir)/Version.txt
|
||||
$(do_subst) < $< > $@
|
||||
src/res/engine.o: WindowsGamesExplorer.xml
|
||||
|
||||
#various hacks to get dependency tracking working with a precompiled C4Include
|
||||
if RECENT_GCC
|
||||
|
@ -122,6 +125,7 @@ src/config/C4SecurityCertificates.cpp \
|
|||
src/config/C4SecurityCertificates.h \
|
||||
src/lib/C4InputValidation.cpp \
|
||||
src/lib/C4InputValidation.h \
|
||||
src/lib/SHA1.h \
|
||||
src/lib/Standard.cpp \
|
||||
src/lib/Standard.h \
|
||||
src/lib/StdBuf.cpp \
|
||||
|
@ -170,8 +174,6 @@ src/C4Version.h.in \
|
|||
src/C4WinMain.cpp \
|
||||
src/config/C4Config.cpp \
|
||||
src/config/C4Config.h \
|
||||
src/config/C4ConfigShareware.cpp \
|
||||
src/config/C4ConfigShareware.h \
|
||||
src/config/C4Constants.h \
|
||||
src/config/C4Reloc.cpp \
|
||||
src/config/C4Reloc.h \
|
||||
|
@ -582,8 +584,7 @@ clonk_LDADD = \
|
|||
$(SDL_LIBS) \
|
||||
$(PTHREAD_LIBS) \
|
||||
$(Z_LIBS) \
|
||||
$(CLONK_LIBS) \
|
||||
$(OPENSSL_LIBS)
|
||||
$(CLONK_LIBS)
|
||||
|
||||
# build the resources
|
||||
.rc.o:
|
||||
|
@ -620,7 +621,6 @@ c4group_LDADD = \
|
|||
lib.a \
|
||||
$(LIBICONV) \
|
||||
$(Z_LIBS) \
|
||||
$(OPENSSL_LIBS) \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
## gunzip4c4group
|
||||
|
@ -682,10 +682,9 @@ src/c4group/C4LangStringTable.cpp
|
|||
|
||||
c4script_LDADD = \
|
||||
lib.a \
|
||||
$(OPENSSL_LIBS) \
|
||||
$(Z_LIBS)
|
||||
|
||||
dist_doc_DATA = planet/AUTHORS planet/COPYING licenses/LGPL.txt licenses/OpenSSL.txt Credits.txt
|
||||
dist_doc_DATA = planet/AUTHORS planet/COPYING licenses/LGPL.txt Credits.txt
|
||||
|
||||
c4groups = \
|
||||
Graphics.ocg \
|
||||
|
@ -701,18 +700,24 @@ CLEANFILES += $(c4groups)
|
|||
pkgdata_DATA = $(c4groups)
|
||||
AM_CXXFLAGS += -DOC_SYSTEM_DATA_DIR=\"${pkgdatadir}\"
|
||||
|
||||
%.ocg: planet/%.ocg c4group$(EXEEXT)
|
||||
%.ocg: $(srcdir)/planet/%.ocg c4group$(EXEEXT)
|
||||
./c4group$(EXEEXT) $< -t $@ || c4group $< -t $@
|
||||
%.ocd: planet/%.ocd c4group$(EXEEXT)
|
||||
%.ocd: $(srcdir)/planet/%.ocd c4group$(EXEEXT)
|
||||
./c4group$(EXEEXT) $< -t $@ || c4group $< -t $@
|
||||
%.ocf: planet/%.ocf c4group$(EXEEXT)
|
||||
%.ocf: $(srcdir)/planet/%.ocf c4group$(EXEEXT)
|
||||
./c4group$(EXEEXT) $< -t $@ || c4group $< -t $@
|
||||
|
||||
## windows setup.exe
|
||||
if WIN32
|
||||
tools/install/firewall.dll: $(srcdir)/tools/install/firewall.cpp
|
||||
mkdir -p tools/install
|
||||
$(CXX) -shared -o tools/install/firewall.dll $(srcdir)/tools/install/firewall.cpp -lole32 -loleaut32
|
||||
setup_openclonk.exe: $(srcdir)/tools/install/oc.nsi c4group$(EXEEXT) clonk$(EXEEXT) $(c4groups)
|
||||
makensis -NOCD -DSRCDIR=$(srcdir) '-DPROGRAMFILES=$$PROGRAMFILES' \
|
||||
-DPRODUCT_NAME="$$(sed -n 's/SET(C4ENGINENAME\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)$$(sed -n 's/SET(C4VERSIONBUILDNAME\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)" \
|
||||
-DPRODUCT_COMPANY="$$(sed -n 's/SET(C4PROJECT\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)" \
|
||||
$< "-XOutFile $@"
|
||||
endif
|
||||
|
||||
## other stuff
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ following packages:
|
|||
make gcc g++
|
||||
cmake OR automake autoconf
|
||||
libc6-dev libx11-dev libxxf86vm-dev libxrandr-dev libxpm-dev libglew1.5-dev
|
||||
libgl1-mesa-dev libpng12-dev libssl-dev libsdl1.2-dev libsdl-mixer1.2-dev
|
||||
libgtk2.0-dev libjpeg62-dev zlib1g-dev libboost-dev
|
||||
libgl1-mesa-dev libpng12-dev libsdl1.2-dev libsdl-mixer1.2-dev libgtk2.0-dev
|
||||
libjpeg62-dev zlib1g-dev libboost-dev
|
||||
|
||||
To build on RPM-based Linux distributions (Red Hat, Fedora, Mandariva,
|
||||
SuSE etc.) you need the following packages:
|
||||
|
@ -16,8 +16,8 @@ SuSE etc.) you need the following packages:
|
|||
make gcc gcc-c++
|
||||
cmake OR automake autoconf
|
||||
libX11-devel libXxf86vm-devel libXrandr-devel libXpm-devel glew-devel
|
||||
mesa-libGL-devel libpng-devel openssl-devel SDL-devel SDL_mixer1.2-dev
|
||||
gtk2-devel libjpeg-devel zlib-devel boost-devel
|
||||
mesa-libGL-devel libpng-devel SDL-devel SDL_mixer1.2-dev gtk2-devel
|
||||
libjpeg-devel zlib-devel boost-devel
|
||||
|
||||
|
||||
Build using cmake
|
||||
|
|
32
Version.txt
|
@ -6,7 +6,7 @@
|
|||
SET(C4PROJECT "OpenClonk Project")
|
||||
SET(C4PROJECT_DOMAIN "openclonk")
|
||||
SET(C4PROJECT_TLD "org")
|
||||
SET(C4PROJECT_URL "http://www.{C4PROJECT_DOMAIN}.{C4PROJECT_TLD}")
|
||||
SET(C4PROJECT_URL "http://${C4PROJECT_DOMAIN}.${C4PROJECT_TLD}")
|
||||
|
||||
IF(CMAKE_HOST_UNIX)
|
||||
EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE DATE)
|
||||
|
@ -23,8 +23,8 @@ SET(C4ENGINEID "${C4PROJECT_TLD}.${C4PROJECT_DOMAIN}.${C4ENGINENICK}")
|
|||
|
||||
SET(C4XVER1 5)
|
||||
SET(C4XVER2 2)
|
||||
SET(C4XVER3 0)
|
||||
SET(C4XVER4 1)
|
||||
SET(C4XVER3 2)
|
||||
SET(C4XVER4 0)
|
||||
|
||||
# C4VERSIONBUILDNAME should be witty and somewhat frequently changing
|
||||
# for alpha and beta releases, and meaningful and stable for stable releases.
|
||||
|
@ -35,12 +35,20 @@ SET(C4VERSIONEXTRA "")
|
|||
############################################################################
|
||||
# Get revision from Mercurial
|
||||
############################################################################
|
||||
|
||||
# Note: This will not work for source distributions!
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND "hg" "id" "--id"
|
||||
OUTPUT_VARIABLE C4REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg_archival.txt")
|
||||
# Archives generated by hg archive
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/.hg_archival.txt" C4REVISION
|
||||
LIMIT_COUNT 1
|
||||
REGEX "node: [0-9a-f]+"
|
||||
)
|
||||
string(SUBSTRING "${C4REVISION}" 6 12 C4REVISION)
|
||||
else()
|
||||
# Working copies
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND "hg" "id" "--id"
|
||||
OUTPUT_VARIABLE C4REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
############################################################################
|
||||
# Build version strings
|
||||
|
@ -73,5 +81,7 @@ else()
|
|||
set(C4VERSION "${C4VERSION} strange")
|
||||
endif()
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/C4Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/C4Version.h ESCAPE_QUOTES)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/C4Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/C4Version.h ESCAPE_QUOTES)
|
||||
if(WIN32)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/res/WindowsGamesExplorer.xml.in ${CMAKE_CURRENT_BINARY_DIR}/WindowsGamesExplorer.xml ESCAPE_QUOTES)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
# - Find FMod
|
||||
# Find the FMod library
|
||||
# This module defines
|
||||
# FMOD_INCLUDE_DIR, where to find fmod.h, etc.
|
||||
# FMOD_LIBRARIES, the libraries needed to use FMod.
|
||||
# FMOD_FOUND, If false, do not try to use FMod.
|
||||
|
||||
#=============================================================================
|
||||
# OpenClonk, http://www.openclonk.org
|
||||
#
|
||||
# Copyright (c) 2011 Nicolas Hake
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
# See isc_license.txt for full license and disclaimer.
|
||||
#
|
||||
# "Clonk" is a registered trademark of Matthes Bender.
|
||||
# See clonk_trademark_license.txt for full license.
|
||||
#=============================================================================
|
||||
|
||||
find_path(FMOD_INCLUDE_DIR fmod.h)
|
||||
|
||||
if(CMAKE_CL_64)
|
||||
if(MSVC)
|
||||
set(FMOD_NAMES ${FMOD_NAMES} fmod64vc)
|
||||
else()
|
||||
set(FMOD_NAMES ${FMOD_NAMES} fmod64)
|
||||
endif()
|
||||
else()
|
||||
if(MSVC)
|
||||
set(FMOD_NAMES ${FMOD_NAMES} fmodvc)
|
||||
else()
|
||||
set(FMOD_NAMES ${FMOD_NAMES} fmod)
|
||||
endif()
|
||||
endif()
|
||||
find_library(FMOD_LIBRARY NAMES ${FMOD_NAMES})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FMOD DEFAULT_MSG FMOD_LIBRARY FMOD_INCLUDE_DIR)
|
||||
|
||||
if(FMOD_FOUND)
|
||||
set(FMOD_LIBRARIES ${FMOD_LIBRARY})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FMOD_LIBRARY FMOD_INCLUDE_DIR)
|
|
@ -213,10 +213,6 @@ AX_BOOST_BASE([1.40.0], [], [
|
|||
AC_MSG_ERROR([Boost not found.])
|
||||
])
|
||||
|
||||
# OpenSSL
|
||||
AC_CHECK_LIB(crypto, BIO_new, [OPENSSL_LIBS="-lcrypto"],
|
||||
[AC_MSG_ERROR([libcrypto (OpenSSL) not found.])])
|
||||
|
||||
# Check for libjpeg
|
||||
AC_CHECK_LIB(jpeg, jpeg_read_header, [
|
||||
CLONK_LIBS="-ljpeg $CLONK_LIBS"
|
||||
|
@ -349,7 +345,6 @@ fi
|
|||
|
||||
AC_SUBST(CLONK_LIBS)
|
||||
AC_SUBST(Z_LIBS)
|
||||
AC_SUBST(OPENSSL_LIBS)
|
||||
|
||||
# precompiled headers and -Wextra
|
||||
AC_MSG_CHECKING([whether we are using a GNU C++ compiler version 4.1 or newer])
|
||||
|
|
|
@ -1,127 +0,0 @@
|
|||
|
||||
LICENSE ISSUES
|
||||
==============
|
||||
|
||||
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
|
||||
the OpenSSL License and the original SSLeay license apply to the toolkit.
|
||||
See below for the actual license texts. Actually both licenses are BSD-style
|
||||
Open Source licenses. In case of any license issues related to OpenSSL
|
||||
please contact openssl-core@openssl.org.
|
||||
|
||||
OpenSSL License
|
||||
---------------
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
Original SSLeay License
|
||||
-----------------------
|
||||
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
|
@ -27,7 +27,6 @@ covered by their respective licenses. List of libraries:
|
|||
zlib: Jean-loup Gailly, Mark Adler
|
||||
libpng: Glenn Randers-Pehrson
|
||||
jpeglib: Independent JPEG Group
|
||||
OpenSSL: The OpenSSL Project
|
||||
FMOD: Firelight Multimedia
|
||||
Freetype: The FreeType Project
|
||||
Allegro: Shawn Hargreaves
|
||||
|
|
|
@ -186,7 +186,7 @@ global func FxFillBaseChestStart(object target, effect, int temporary, bool supp
|
|||
|
||||
effect.supply_type=supply;
|
||||
if(effect.supply_type)
|
||||
var w_list = [Firestone, Dynamite, Shovel, Loam, Ropeladder];
|
||||
var w_list = [Firestone, Dynamite, IronBomb, Shovel, Loam, Ropeladder];
|
||||
else
|
||||
var w_list = [Bow, Shield, Sword, Javelin, Musket, FrostboltScroll];
|
||||
for(var i=0; i<5; i++)
|
||||
|
@ -199,7 +199,7 @@ global func FxFillBaseChestTimer(object target, effect)
|
|||
|
||||
if(effect.supply_type)
|
||||
{
|
||||
var w_list = [Firestone, Dynamite, Shovel, Loam, Ropeladder];
|
||||
var w_list = [Firestone, Dynamite, IronBomb, Shovel, Loam, Ropeladder];
|
||||
var maxcount = [2,2,1,2,1];
|
||||
}
|
||||
else
|
||||
|
@ -230,7 +230,7 @@ global func FxFillOtherChestStart(object target, effect, int temporary)
|
|||
{
|
||||
if (temporary)
|
||||
return 1;
|
||||
var w_list = [Sword, Javelin, Club, Firestone, Dynamite, Firestone];
|
||||
var w_list = [Sword, Javelin, Club, Firestone, Dynamite, IronBomb, Firestone];
|
||||
if (target->ContentsCount() < 5)
|
||||
target->CreateChestContents(w_list[Random(GetLength(w_list))]);
|
||||
return 1;
|
||||
|
@ -239,7 +239,7 @@ global func FxFillOtherChestStart(object target, effect, int temporary)
|
|||
global func FxFillOtherChestTimer(object target)
|
||||
{
|
||||
|
||||
var w_list = [Sword, Javelin, Dynamite, WindScroll, FrostboltScroll, Loam, HardeningScroll, PowderKeg];
|
||||
var w_list = [Sword, Javelin, Dynamite, IronBomb, WindScroll, FrostboltScroll, Loam, HardeningScroll, PowderKeg];
|
||||
var maxcount = [1,1,3,1,2,1,1,1];
|
||||
|
||||
var contents;
|
||||
|
|
|
@ -127,7 +127,7 @@ global func FxIntFillChestsTimer()
|
|||
{
|
||||
SetTemperature(100);
|
||||
var chests = FindObjects(Find_ID(Chest));
|
||||
var w_list = [Dynamite, Rock, Dynamite, Firestone, Firestone, Bow, Musket, Sword, Javelin];
|
||||
var w_list = [IronBomb, Rock, IronBomb, Firestone, Firestone, Bow, Musket, Sword, Javelin];
|
||||
for(var chest in chests)
|
||||
if (chest->ContentsCount() < 5 )
|
||||
chest->CreateChestContents(w_list[Random(GetLength(w_list))]);
|
||||
|
|
|
@ -249,7 +249,7 @@ global func FxFillChestTimer(object target, proplist effect)
|
|||
{
|
||||
if (Random(5))
|
||||
return 1;
|
||||
var w_list = [Balloon, Boompack, Dynamite, Shield, Javelin, Bow, Musket, Boompack, Dynamite, Shield, Javelin, Bow, Musket, TeleportScroll, WindScroll, FireballScroll];
|
||||
var w_list = [Balloon, Boompack, IronBomb, Shield, Javelin, Bow, Musket, Boompack, IronBomb, Shield, Javelin, Bow, Musket, TeleportScroll, WindScroll, FireballScroll];
|
||||
|
||||
if (target->ContentsCount() < 6)
|
||||
target->CreateChestContents(w_list[Random(GetLength(w_list))]);
|
||||
|
|
|
@ -112,7 +112,7 @@ global func FxIntFillChestsTimer()
|
|||
{
|
||||
SetTemperature(100);
|
||||
var chest = FindObjects(Find_ID(Chest), Sort_Random())[0];
|
||||
var w_list = [Boompack, Dynamite, Loam, Firestone, Bow, Musket, Sword, Javelin];
|
||||
var w_list = [Boompack, IronBomb, Loam, Firestone, Bow, Musket, Sword, Javelin];
|
||||
|
||||
if (chest->ContentsCount() < 5)
|
||||
chest->CreateChestContents(w_list[Random(GetLength(w_list))]);
|
||||
|
|
|
@ -225,7 +225,7 @@ global func FxIntFillChestsTimer()
|
|||
{
|
||||
SetTemperature(100);
|
||||
var chest = FindObjects(Find_ID(Chest), Sort_Random())[0];
|
||||
var w_list = [Javelin, Bow, Musket, Boompack, Dynamite, Shield, WindScroll, FireballScroll, ThunderScroll, Club, Sword];
|
||||
var w_list = [Javelin, Bow, Musket, Boompack, IronBomb, Shield, WindScroll, FireballScroll, ThunderScroll, Club, Sword];
|
||||
var maxcount = [1,1,1,1,2,1,1,2,2,1,1];
|
||||
|
||||
var contents;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[DefCore]
|
||||
id=Clonk_Animations
|
||||
Version=4,10,0,0
|
||||
Category=C4D_StaticBack
|
After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 351 KiB |
|
@ -0,0 +1,4 @@
|
|||
[DefCore]
|
||||
id=Skin_Farmer
|
||||
Version=5,2,0,1
|
||||
Category=C4D_StaticBack
|
|
@ -0,0 +1,39 @@
|
|||
material farmerClonk
|
||||
{
|
||||
receive_shadows on
|
||||
technique
|
||||
{
|
||||
pass
|
||||
{
|
||||
ambient 1.000000 1.000000 1.000000 1.000000
|
||||
diffuse 1.000000 1.000000 1.000000 1.000000
|
||||
specular 0.000000 0.000000 0.000000 1.000000 1.000000
|
||||
emissive 0.000000 0.000000 0.000000 1.000000
|
||||
|
||||
texture_unit Overlay
|
||||
{
|
||||
texture clonkFarmerOverlay.png
|
||||
tex_address_mode wrap
|
||||
filtering trilinear
|
||||
colour_op_ex modulate src_texture src_player_colour
|
||||
// take alpha from texture only, ignore player alpha
|
||||
alpha_op_ex source1 src_texture src_player_colour
|
||||
}
|
||||
texture_unit Clonk
|
||||
{
|
||||
texture clonkFarmer.png
|
||||
tex_address_mode wrap
|
||||
filtering trilinear
|
||||
colour_op_ex blend_current_alpha src_current src_texture
|
||||
// Don't blend alpha, to make sure we have full intensity at the base/overlay border region
|
||||
alpha_op_ex add src_current src_texture
|
||||
}
|
||||
texture_unit Light
|
||||
{
|
||||
// apply lighting
|
||||
colour_op_ex modulate src_current src_diffuse
|
||||
alpha_op_ex modulate src_current src_diffuse
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 182 KiB |
After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 825 KiB After Width: | Height: | Size: 282 KiB |
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 54 KiB |
|
@ -1 +1,2 @@
|
|||
All sounds by Pat (http://www.freesound.org/people/pwausc1/sounds/118259/), License: CC Attribution 3.0
|
||||
Roll.ogg, Rustle1.ogg, Rustle2.ogg, Rustle3.ogg, Rustle4.ogg, RustleLand.ogg by Pat (http://www.freesound.org/people/pwausc1/sounds/118259/), License: CC Attribution 3.0
|
||||
StepSoft1.ogg, StepSoft2.ogg, StepSoft3.ogg, StepSoft4.ogg, StepSoft5.ogg, StepSoft6.ogg, StepHard1.ogg, StepHard2.ogg, StepHard3.ogg, StepHard4.ogg, StepHard5.ogg by bevangoldswain (http://www.freesound.org/people/bevangoldswain/sounds/54778/ and http://www.freesound.org/people/bevangoldswain/sounds/54779/), License: CC Sampling Plus 1.0
|
|
@ -14,7 +14,7 @@ global func Bubble(int amount, int x, int y)
|
|||
protected func Initialize()
|
||||
{
|
||||
DoCon(RandomX(25, 100));
|
||||
AddEffect("Move", this, 100, 1, this);
|
||||
AddEffect("Move", this, 100, 2, this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,12 @@ public func FxMoveTimer(object target, effect, int time)
|
|||
AddEffect("Fade", target, 100, 1, target);
|
||||
|
||||
// Bubbles burst into smaller bubles
|
||||
if (!Random(30) && target->GetCon() > 100)
|
||||
if (!Random(25) && target->GetCon() > 100)
|
||||
{
|
||||
for (var i = 0; i < 3; i++)
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
var bubble = CreateObject(Fx_Bubble);
|
||||
bubble->SetCon(10 * target->GetCon() / 15);
|
||||
bubble->SetCon(2 * target->GetCon() / 3);
|
||||
bubble->SetYDir(target->GetYDir());
|
||||
}
|
||||
RemoveObject();
|
||||
|
@ -37,7 +37,7 @@ public func FxMoveTimer(object target, effect, int time)
|
|||
}
|
||||
|
||||
// Jittery movement
|
||||
SetYDir(GetYDir() - 2 + Random(5));
|
||||
SetYDir(GetYDir() - 3 + Random(7));
|
||||
if (Inside(GetXDir(), -6, 6))
|
||||
SetXDir(GetXDir() + 2 * Random(2) - 1);
|
||||
|
||||
|
|
|
@ -90,22 +90,22 @@ private func FindRelaunchPos(int plr)
|
|||
|
||||
public func IsFulfilled()
|
||||
{
|
||||
//Check whether someone has reached the limit
|
||||
var fulfilled = CreateArray();
|
||||
for(var i = GetPlayerCount() - 1; i > -1; --i)
|
||||
// Check whether someone has reached the limit.
|
||||
var winner = nil;
|
||||
for (var i = 0; i < GetPlayerCount(); i++)
|
||||
if(GetKillCount(GetPlayerByIndex(i)) >= maxkills)
|
||||
fulfilled[GetLength(fulfilled)] = i;
|
||||
if(!GetLength(fulfilled)) return false;
|
||||
//Eliminate all players, that are not in a team with one of the winners
|
||||
for(var i = GetPlayerCount() - 1; i > -1; --i)
|
||||
winner = GetPlayerByIndex(i);
|
||||
if (winner == nil)
|
||||
return false;
|
||||
// Eliminate all players, that are not in a team with one of the winners
|
||||
for (var i = 0; i < GetPlayerCount(); i++)
|
||||
{
|
||||
var eliminate = true;
|
||||
for(var j = GetLength(fulfilled); j; --j)
|
||||
{
|
||||
if(fulfilled[j] == i) {eliminate = false; break;}
|
||||
if(!CheckTeamHostile(GetPlayerByIndex(fulfilled[j]), GetPlayerByIndex(i))) {eliminate = false; break;}
|
||||
}
|
||||
if(eliminate) EliminatePlayer(GetPlayerByIndex(i));
|
||||
var plr = GetPlayerByIndex(i);
|
||||
if (winner == plr)
|
||||
continue;
|
||||
if (!CheckTeamHostile(winner, plr))
|
||||
continue;
|
||||
EliminatePlayer(plr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ public func StartRelaunch(object clonk)
|
|||
|
||||
private func OpenWeaponMenu(object clonk)
|
||||
{
|
||||
if (!clonk)
|
||||
return;
|
||||
if (!menu)
|
||||
{
|
||||
var weapons = WeaponList();
|
||||
|
|
|
@ -113,8 +113,11 @@ public func Select(int dx, int dy, bool alt)
|
|||
{
|
||||
var item_count=GetLength(menu_icons);
|
||||
if(!item_count)
|
||||
{
|
||||
if(command_object->Selected(this,nil,alt))
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
var distance = Sqrt(dx*dx+dy*dy);
|
||||
|
||||
|
|
|
@ -175,10 +175,30 @@ public func FxIntGrappleControlControl(object target, fxnum, ctrl, x,y,strength,
|
|||
if(ctrl == CON_Right)
|
||||
{
|
||||
fxnum.mv_right = !release;
|
||||
if(release)
|
||||
{
|
||||
if(fxnum.lastkey == CON_Right)
|
||||
{
|
||||
target->SetDir(0);
|
||||
target->UpdateTurnRotation();
|
||||
}
|
||||
fxnum.lastkey = CON_Right;
|
||||
fxnum.keyTimer = 10;
|
||||
}
|
||||
}
|
||||
if(ctrl == CON_Left)
|
||||
{
|
||||
fxnum.mv_left = !release;
|
||||
if(release)
|
||||
{
|
||||
if(fxnum.lastkey == CON_Left)
|
||||
{
|
||||
target->SetDir(1);
|
||||
target->UpdateTurnRotation();
|
||||
}
|
||||
fxnum.lastkey = CON_Left;
|
||||
fxnum.keyTimer = 10;
|
||||
}
|
||||
}
|
||||
if(ctrl == CON_Up)
|
||||
{
|
||||
|
@ -209,6 +229,12 @@ public func FxIntGrappleControlTimer(object target, fxnum, int time)
|
|||
if (target->Contained())
|
||||
return -1;
|
||||
|
||||
if(fxnum.keyTimer)
|
||||
{
|
||||
fxnum.keyTimer--;
|
||||
if(fxnum.keyTimer == 0)
|
||||
fxnum.lastkey = 0;
|
||||
}
|
||||
// Movement.
|
||||
if (fxnum.mv_up)
|
||||
if (rope)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Electrical.ogg by McFex (http://www.freesound.org/people/McFex/sounds/104303/), License: CC Sampling Plus 1.0
|
|
@ -0,0 +1,18 @@
|
|||
[DefCore]
|
||||
id=IronBomb
|
||||
Version=4,10,0,0
|
||||
Category=C4D_Object
|
||||
Width=6
|
||||
Height=6
|
||||
Offset=-3,-3
|
||||
Picture=6,0,16,16
|
||||
Vertices=3
|
||||
VertexX=0,3,-3
|
||||
VertexY=-2,2,2
|
||||
VertexFriction=20,20,20
|
||||
Value=3
|
||||
Mass=20
|
||||
Components=IronBomb=1;
|
||||
Rotate=1
|
||||
ContactIncinerate=1
|
||||
BlastIncinerate=1
|
After Width: | Height: | Size: 5.2 KiB |
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
IronBomb
|
||||
Author: Ringwaul
|
||||
|
||||
Explodes after a short fuse.
|
||||
*/
|
||||
|
||||
|
||||
public func ControlUse(object clonk, int x, int y, bool box)
|
||||
{
|
||||
// if already activated, nothing (so, throw)
|
||||
if(GetEffect("FuseBurn", this))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Fuse();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
func Fuse()
|
||||
{
|
||||
AddEffect("FuseBurn", this, 1,1, this);
|
||||
}
|
||||
|
||||
func FxFuseBurnTimer(object bomb, int num, int timer)
|
||||
{
|
||||
var i = 3;
|
||||
var x = +Sin(GetR(), i);
|
||||
var y = -Cos(GetR(), i);
|
||||
CreateParticle("EngineSmoke", x, y, x, y, RandomX(20,50), RGB(100,100,100));
|
||||
|
||||
if(timer == 1) Sound("FuseLoop",nil,nil,nil,+1);
|
||||
if(timer >= 90)
|
||||
{
|
||||
Sound("FuseLoop",nil,nil,nil,-1);
|
||||
DoExplode();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
func DoExplode()
|
||||
{
|
||||
var i = 23;
|
||||
while(i != 0)
|
||||
{
|
||||
var shrapnel = CreateObject(Shrapnel);
|
||||
shrapnel->SetVelocity(Random(359), RandomX(100,140));
|
||||
shrapnel->SetRDir(-30+ Random(61));
|
||||
CreateObject(BulletTrail)->Set(2,30,shrapnel);
|
||||
i--;
|
||||
}
|
||||
if(GBackLiquid())
|
||||
Sound("BlastLiquid2.ogg");
|
||||
else
|
||||
Sound("BlastMetal.ogg");
|
||||
CreateParticle("ExploSmoke", 0,0,0,0,390,RGBa(255,255,255,165));
|
||||
Explode(14);
|
||||
}
|
||||
|
||||
protected func Hit() { Sound("RockHit*"); }
|
||||
|
||||
protected func Incineration() { Extinguish(); Fuse(); }
|
||||
|
||||
protected func RejectEntrance()
|
||||
{
|
||||
return GetAction() == "Fuse" || GetAction() == "Ready";
|
||||
}
|
||||
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
local Collectible = 1;
|
||||
local Rebuy = true;
|
|
@ -0,0 +1,13 @@
|
|||
[DefCore]
|
||||
id=Shrapnel
|
||||
Version=4,10,0,0
|
||||
Category=C4D_Object
|
||||
Width=2
|
||||
Height=2
|
||||
Offset=-1,-1
|
||||
Vertices=1
|
||||
VertexX=0
|
||||
VertexY=0
|
||||
VertexFriction=95
|
||||
Mass=5
|
||||
Rotate=1
|
After Width: | Height: | Size: 827 B |
|
@ -0,0 +1,50 @@
|
|||
/* shrapnel */
|
||||
|
||||
public func ProjectileDamage() { return 1; }
|
||||
public func FlightTime() { return 4; }
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
SetAction("Flight");
|
||||
AddEffect("Fade", this, 1, 1, this);
|
||||
}
|
||||
|
||||
protected func FxFadeTimer(object target, int num, int timer)
|
||||
{
|
||||
/* SetObjAlpha(255 - ((timer * 1275)/ 100));
|
||||
if(timer >= 20)
|
||||
{
|
||||
RemoveObject();
|
||||
}*/
|
||||
|
||||
if(timer > FlightTime()) RemoveObject();
|
||||
}
|
||||
|
||||
protected func Hit()
|
||||
{
|
||||
ShakeFree(6);
|
||||
RemoveObject();
|
||||
}
|
||||
|
||||
public func HitObject(object obj)
|
||||
{
|
||||
ProjectileHit(obj,ProjectileDamage(),ProjectileHit_tumble);
|
||||
Sound("ProjectileHitLiving*.ogg");
|
||||
RemoveObject();
|
||||
}
|
||||
|
||||
public func TrailColor(int time)
|
||||
{
|
||||
return RGBa(100,100,100,240*Max(0,FlightTime()-time)/FlightTime());
|
||||
}
|
||||
|
||||
local ActMap = {
|
||||
Fly = {
|
||||
Prototype = Action,
|
||||
Name = "Fly",
|
||||
Procedure = DFA_FLIGHT,
|
||||
NextAction = "Fly",
|
||||
Delay = 1,
|
||||
Length = 1,
|
||||
},
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
Name=Eisenbombe
|
||||
Description=Nach dem Anzünden, drücke [Benutzen], um zu werfen.
|
|
@ -0,0 +1,2 @@
|
|||
Name=Iron Bomb
|
||||
Description=Press [Use] to ignite. After it has been ignited, throw it with [Use].
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 9.2 KiB |
|
@ -350,7 +350,7 @@ func FxIntClimbControlControl(target, number, ctrl, x,y,strength, repeat, releas
|
|||
}
|
||||
|
||||
func SetLadderRotation (int r, int xoff, int yoff) {
|
||||
SetMeshTransformation(Trans_Mul(Trans_Translate(0, -10000), Trans_Rotate(-r,0,0,1), Trans_Translate(xoff, 10000+yoff)), 1);
|
||||
SetMeshTransformation(Trans_Mul(Trans_Translate(0, -10000), Trans_Rotate(-r,0,0,1), Trans_Translate(xoff, 10000+yoff)), 5);
|
||||
// SetProperty("MeshTransformation", Trans_Mul(Trans_Translate(0, -10000), Trans_Rotate(-r,0,0,1), Trans_Translate(xoff, 10000+yoff)));
|
||||
return;
|
||||
// var fsin=Sin(r, 1000), fcos=Cos(r, 1000);
|
||||
|
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
@ -8,7 +8,7 @@ Ringwaul - MonsterGrowl*, MonsterDie, Snuff*, WipfAroof, WipfWhine
|
|||
Clonkonaut - Confirm*
|
||||
Checkmaty - ProjectileHitLiving*
|
||||
dobroide - BirdsLoop (http://www.freesound.org/people/dobroide/sounds/54746/)
|
||||
Benboncan - Blast* (http://www.freesound.org/people/Benboncan/sounds/73005/)
|
||||
Benboncan - Blast*/BlastMetal (http://www.freesound.org/people/Benboncan/sounds/73005/)
|
||||
Stickinthemud - Clonk (http://www.freesound.org/people/Stickinthemud/sounds/27526/)
|
||||
Toby Knowles - Fanfare (http://www.freesound.org/people/tobyk/sounds/26198/)
|
||||
ERH - WindLoop (http://www.freesound.org/people/ERH/sounds/34338/)
|
||||
|
@ -39,4 +39,7 @@ suonho - FireLoop (http://www.freesound.org/people/suonho/sounds/17782/)
|
|||
Nikolino - BlastLiquid*
|
||||
(http://www.freesound.org/people/Nikolino/sounds/106694/)
|
||||
(http://www.freesound.org/people/Nikolino/sounds/106650/)
|
||||
(http://www.freesound.org/people/Nikolino/sounds/106640/)
|
||||
(http://www.freesound.org/people/Nikolino/sounds/106640/)
|
||||
jenc - BlastMetal (http://www.freesound.org/people/jenc/sounds/511/)
|
||||
Stickinthemud - BlastMetal (http://www.freesound.org/people/Stickinthemud/sounds/27531/)
|
||||
Halleck - Electrical (http://www.freesound.org/people/Halleck/sounds/19483/)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
/*-- Explosion --*/
|
||||
|
||||
global func Explode(int level)
|
||||
global func Explode(int level, bool silent)
|
||||
{
|
||||
if(!this) FatalError("Function Explode must be called from object context");
|
||||
|
||||
|
@ -17,11 +17,14 @@ global func Explode(int level)
|
|||
ShakeViewPort(level, GetX(), GetY());
|
||||
|
||||
// Sound must be created before object removal, for it to be played at the right position.
|
||||
var grade = BoundBy(level / 10 - 1, 1, 3);
|
||||
if(GBackLiquid())
|
||||
Sound(Format("BlastLiquid%d.ogg",grade));
|
||||
else
|
||||
Sound(Format("Blast%d", grade));
|
||||
if(!silent) //Does object use it's own explosion sound effect?
|
||||
{
|
||||
var grade = BoundBy(level / 10 - 1, 1, 3);
|
||||
if(GBackLiquid())
|
||||
Sound(Format("BlastLiquid%d.ogg",grade));
|
||||
else
|
||||
Sound(Format("Blast%d", grade));
|
||||
}
|
||||
|
||||
// Explosion parameters.
|
||||
var x = GetX(), y = GetY();
|
||||
|
@ -67,7 +70,7 @@ global func DoExplosion(int x, int y, int level, object inobj, int cause_plr, ob
|
|||
if (inobj != container)
|
||||
BlastObjects(x + GetX(), y + GetY(), level, container, cause_plr, layer);
|
||||
|
||||
// Landschaft zerstören. Nach BlastObjects, damit neu freigesprengte Materialien nicht betroffen sind
|
||||
// Landscape destruction. Happens after BlastObjects, so that recently blown-free materials are not affected
|
||||
if (!container)
|
||||
BlastFree(x, y, level, cause_plr);
|
||||
|
||||
|
@ -419,7 +422,7 @@ global func FxFireworkTimer(object target, effect, int time)
|
|||
if (GBackSemiSolid(x / 100, y / 100))
|
||||
return -1;
|
||||
|
||||
// loose speed
|
||||
// lose speed
|
||||
speed = 25 * speed / 26;
|
||||
|
||||
var x_dir = Sin(angle, speed);
|
||||
|
|
|
@ -611,7 +611,6 @@ IDS_ERR_TITLE=Fehler
|
|||
IDS_ERR_UNKNOWNCMD=Unbekannter Befehl: "%s" - Befehl /help für eine Liste gültiger Befehle
|
||||
IDS_ERR_HELPCMD=Grundlegende Befehle im IRC-Chat:|/join [Chatraum] - Neuen Chatraum betreten|/part - Diesen Chatraum verlassen|/notice [Benutzer] [Nachricht] - Sende eine Nachricht an den Benutzer|/query [Benutzer] - Öffne ein neues Chatfenster für einen privaten Dialog mit dem Benutzer|/msg [Benutzer] [Nachricht] - Dasselbe wie /query, nur dass bereits die erste Nachrich geschickt wird|/nick [Neuer Spitzname] - Wähle einen neuen Spitznamen|/quit - Chat ganz verlassen|/raw - Raw-Kommando senden
|
||||
IDS_ERR_USERCANCEL=Benutzerabbruch
|
||||
IDS_ERR_WARNINGYOUWERETRYINGTOSEN=ACHTUNG: Du hast versucht, Deinen persönlichen WebCode an eine unbekannte Person zu versenden. Dieser Code darf unter keinen Umständen an andere Personen weiter gegeben werden, da diese damit Deine persönliche Online-Konten stehlen könnten.||Clonk-Administratoren würden Dich nie nach Deinem WebCode oder anderen Passwörtern fragen.
|
||||
IDS_ERR_WRITENEWTITLE=Fehler beim Speichern des neuen Titels in Datei "%s": %s
|
||||
IDS_ERR_YOUHAVEBEENREMOVEDBYVOTIN=Du wurdest per Abstimmung aus dem Spiel entfernt. (%s)
|
||||
IDS_ERR_YOUSURRENDEREDTHELEAGUEGA=Du hast das Ligaspiel aufgegeben.
|
||||
|
|
|
@ -610,7 +610,6 @@ IDS_ERR_TITLE=Error
|
|||
IDS_ERR_UNKNOWNCMD=Unknown command: "%s" - type /help to get a list of valid commands
|
||||
IDS_ERR_HELPCMD=Basic commands in the IRC-chat:|/join [channel] - Enter a new chat room|/part - Leave this chat room|/notice [user] [message] - Send a message to the user|/query [user] - Open a new chat window to chat for chatting with the user|/msg [user] [message] - The same as /query, only that the first message is already sent|/nick [new nick name] - Choose a new nick name|/quit - Exit the chat|/raw - Send a raw command
|
||||
IDS_ERR_USERCANCEL=User abort
|
||||
IDS_ERR_WARNINGYOUWERETRYINGTOSEN=WARNING: you were trying to send your secret WebCode to a stranger on the internet. You should NEVER give your WebCode to anyone, because they could use it to steal your online accounts!||Clonk administrators will never ask you for any passwords or your WebCode.
|
||||
IDS_ERR_WRITENEWTITLE=Error writing new title for file "%s": %s
|
||||
IDS_ERR_YOUHAVEBEENREMOVEDBYVOTIN=You have been removed by vote. (%s)
|
||||
IDS_ERR_YOUSURRENDEREDTHELEAGUEGA=You have surrendered the league game.
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#ifndef INC_C4Application
|
||||
#define INC_C4Application
|
||||
|
||||
#include <C4ConfigShareware.h>
|
||||
#include <C4Group.h>
|
||||
#include <C4MusicSystem.h>
|
||||
#include <C4SoundSystem.h>
|
||||
|
@ -72,7 +71,15 @@ public:
|
|||
void SetNextMission(const char *szMissionFilename);
|
||||
virtual void OnCommand(const char *szCmd);
|
||||
|
||||
const char *GetRevision() const { return Revision.getData(); }
|
||||
const char *GetRevision() const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
// some late mac-specific commits require this sad little piece of trickery
|
||||
return "14ab9fe1345a";
|
||||
#else
|
||||
return Revision.getData();
|
||||
#endif
|
||||
}
|
||||
|
||||
// set by ParseCommandLine
|
||||
int isEditor;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "StdResStr2.h"
|
||||
#include "C4Log.h"
|
||||
#include "C4Reloc.h"
|
||||
#include "C4Config.h"
|
||||
|
||||
#include "C4Game.h"
|
||||
|
||||
|
|
|
@ -173,15 +173,15 @@
|
|||
#define C4FLS_Section "Scenario.txt|Game.txt|Landscape.bmp|Landscape.png|Sky.bmp|Sky.png|Sky.jpeg|Sky.jpg|PXS.ocb|MassMover.ocb|CtrlRec.ocb|Strings.txt|Objects.txt"
|
||||
#define C4FLS_SectionLandscape "Scenario.txt|Landscape.bmp|Landscape.png|PXS.ocb|MassMover.ocb"
|
||||
#define C4FLS_SectionObjects "Strings.txt|Objects.txt"
|
||||
#define C4FLS_Def "Particle.txt|DefCore.txt|Graphics.png|Overlay.png|Graphics*.png|Overlay*.png|StringTbl*.txt|Script.c|Script*.c|C4Script.c|Names*.txt|Title*.txt|ClonkNames.txt|Rank.txt|Rank.png|Desc*.txt|Overlay.png|Title.png|Icon.bmp|Author.txt|Version.txt|*.wav|*.ocd"
|
||||
#define C4FLS_Def "Particle.txt|DefCore.txt|*.material|Graphics.png|Overlay.png|Graphics*.png|Overlay*.png|*.png|*.jpg|Graphics.mesh|*.skeleton|StringTbl*.txt|Script.c|Script*.c|C4Script.c|Names*.txt|Title*.txt|ClonkNames.txt|Rank.txt|Rank*.txt|Rank.png|Desc*.txt|Title.png|Icon.bmp|Author.txt|Version.txt|*.wav|*.ogg|*.ocd"
|
||||
#define C4FLS_Player "Player.txt|*.oci"
|
||||
#define C4FLS_Object "ObjectInfo.txt"
|
||||
#define C4FLS_Folder "Folder.txt|Title*.txt|Info.txt|Desc*.rtf|Title.png|Title.bmp|Icon.png|Icon.bmp|Author.txt|Version.txt|*.ocs|Loader*.bmp|Loader*.png|Loader*.jpeg|Loader*.jpg|FolderMap.txt|FolderMap.png"
|
||||
#define C4FLS_Material "TexMap.txt|*.bmp|*.png|*.ocm"
|
||||
#define C4FLS_Graphics "Loader*.bmp|Loader*.png|Loader*.jpeg|Loader*.jpg|Font*.png"\
|
||||
"|Control.png|Fire.png|Background.png|Flag.png|Crew.png|Wealth.png|Player.png|Rank.png|Captain.png|Cursor.png|SelectMark.png|MenuSymbol.png|Menu.png|Logo.png|Construction.png|Energy.png|Options.png|UpperBoard.png|Arrow.png|Exit.png|Hand.png|Gamepad.png|Build.png"\
|
||||
"|GUICaption.png|GUIButton.png|GUIButtonDown.png|GUIButtonHighlight.png|GUIButtonHighlightRound.png|GUIIcons.png|GUIIcons2.png|GUIScroll.png|GUIContext.png|GUISubmenu.png|GUICheckBox.png|GUIBigArrows.png|GUIProgress.png"\
|
||||
"|StartupScenSelBG.*|StartupPlrSelBG.*|StartupPlrPropBG.*|StartupNetworkBG.*|StartupAboutBG.*|StartupBigButton.png|StartupBigButtonDown.png|StartupBookScroll.png|StartupContext.png|StartupScenSelIcons.png|StartupScenSelTitleOv.png|StartupDlgPaper.png|StartupOptionIcons.png|StartupTabClip.png|StartupNetGetRef.png|StartupLogo.png"
|
||||
"|GUIProgress.png|Endeavour.ttf|GUICaption.png|GUIButton.png|GUIButtonDown.png|GUIButtonHighlight.png|GUIButtonHighlightRound.png|GUIIcons.png|GUIIcons2.png|GUIScroll.png|GUIContext.png|GUISubmenu.png|GUICheckBox.png|GUIBigArrows.png"\
|
||||
"|StartupMainMenuBG.*|StartupScenSelBG.*|StartupPlrSelBG.*|StartupPlrPropBG.*|StartupNetworkBG.*|StartupAboutBG.*|StartupBigButton.png|StartupBigButtonDown.png|StartupBookScroll.png|StartupContext.png|StartupScenSelIcons.png|StartupScenSelTitleOv.png|StartupDlgPaper.png|StartupOptionIcons.png|StartupTabClip.png|StartupNetGetRef.png|StartupLogo.png"
|
||||
#define C4FLS_Objects "Names*.txt|Desc*.txt|*.ocd"
|
||||
#define C4FLS_System "*.hlp|*.cnt|Language*.txt|*.fon|*.fnt|*.ttf|*.ttc|*.fot|*.otf|Fonts.txt|StringTbl*.txt|*.c|Names.txt"
|
||||
#define C4FLS_Music "Frontend.*|Credits.*"
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include <StdPNG.h>
|
||||
#include <zlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <openssl/sha.h>
|
||||
|
||||
|
||||
//------------------------------ File Sort Lists -------------------------------------------
|
||||
|
@ -410,82 +409,6 @@ bool C4Group_ReadFile(const char *szFile, char **pData, size_t *iSize)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool C4Group_GetFileCRC(const char *szFilename, uint32_t *pCRC32)
|
||||
{
|
||||
if (!pCRC32) return false;
|
||||
// doesn't exist physically?
|
||||
char szPath[_MAX_PATH + 1];
|
||||
if (FileExists(szFilename))
|
||||
SCopy(szFilename, szPath, _MAX_PATH);
|
||||
else
|
||||
{
|
||||
// Expect file to be packed: Extract to temporary
|
||||
SCopy(GetFilename(szFilename), szPath, _MAX_PATH);
|
||||
MakeTempFilename(szPath);
|
||||
if (!C4Group_CopyItem(szFilename, szPath)) return false;
|
||||
}
|
||||
// open file
|
||||
CStdFile File;
|
||||
if (!File.Open(szFilename))
|
||||
return false;
|
||||
// calculcate CRC
|
||||
uint32_t iCRC32 = 0;
|
||||
for (;;)
|
||||
{
|
||||
// read a chunk of data
|
||||
BYTE szData[CStdFileBufSize]; size_t iSize = 0;
|
||||
if (!File.Read(szData, CStdFileBufSize, &iSize))
|
||||
if (!iSize)
|
||||
break;
|
||||
// update CRC
|
||||
iCRC32 = crc32(iCRC32, szData, iSize);
|
||||
}
|
||||
// close file
|
||||
File.Close();
|
||||
// okay
|
||||
*pCRC32 = iCRC32;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Group_GetFileSHA1(const char *szFilename, BYTE *pSHA1)
|
||||
{
|
||||
if (!pSHA1) return false;
|
||||
// doesn't exist physically?
|
||||
char szPath[_MAX_PATH + 1];
|
||||
if (FileExists(szFilename))
|
||||
SCopy(szFilename, szPath, _MAX_PATH);
|
||||
else
|
||||
{
|
||||
// Expect file to be packed: Extract to temporary
|
||||
SCopy(GetFilename(szFilename), szPath, _MAX_PATH);
|
||||
MakeTempFilename(szPath);
|
||||
if (!C4Group_CopyItem(szFilename, szPath)) return false;
|
||||
}
|
||||
// open file
|
||||
CStdFile File;
|
||||
if (!File.Open(szFilename))
|
||||
return false;
|
||||
// calculcate CRC
|
||||
SHA_CTX ctx;
|
||||
if (!SHA1_Init(&ctx)) return false;
|
||||
for (;;)
|
||||
{
|
||||
// read a chunk of data
|
||||
BYTE szData[CStdFileBufSize]; size_t iSize = 0;
|
||||
if (!File.Read(szData, CStdFileBufSize, &iSize))
|
||||
if (!iSize)
|
||||
break;
|
||||
// update CRC
|
||||
if (!SHA1_Update(&ctx, szData, iSize))
|
||||
return false;
|
||||
}
|
||||
// close file
|
||||
File.Close();
|
||||
// finish calculation
|
||||
SHA1_Final(pSHA1, &ctx);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemScramble(BYTE *bypBuffer, int iSize)
|
||||
{
|
||||
int cnt; BYTE temp;
|
||||
|
@ -727,7 +650,7 @@ bool C4Group::OpenRealGrpFile()
|
|||
EntryOffset+=sizeof(C4GroupEntryCore);
|
||||
if (!AddEntry(C4GRES_InGroup,!!corebuf.ChildGroup,
|
||||
corebuf.FileName,corebuf.Size,
|
||||
corebuf.HasCRC,corebuf.CRC,entryname.getData(),
|
||||
entryname.getData(),
|
||||
NULL, false, false,
|
||||
!!corebuf.Executable))
|
||||
return Error("OpenRealGrpFile: Cannot add entry");
|
||||
|
@ -740,8 +663,6 @@ bool C4Group::AddEntry(int status,
|
|||
bool childgroup,
|
||||
const char *fname,
|
||||
long size,
|
||||
char cCRC,
|
||||
unsigned int iCRC,
|
||||
const char *entryname,
|
||||
BYTE *membuf,
|
||||
bool fDeleteOnDisk,
|
||||
|
@ -808,8 +729,6 @@ bool C4Group::AddEntry(int status,
|
|||
nentry->Size=size;
|
||||
nentry->ChildGroup=childgroup;
|
||||
nentry->Offset=0;
|
||||
nentry->HasCRC=cCRC;
|
||||
nentry->CRC=iCRC;
|
||||
nentry->Executable=fExecutable;
|
||||
nentry->DeleteOnDisk=fDeleteOnDisk;
|
||||
nentry->HoldBuffer=fHoldBuffer;
|
||||
|
@ -875,9 +794,6 @@ bool C4Group::Close()
|
|||
// Automatic sort
|
||||
SortByList(C4Group_SortList);
|
||||
|
||||
// Calculate all missing checksums
|
||||
EntryCRC32(NULL);
|
||||
|
||||
// Save group contents to disk
|
||||
bool fSuccess = Save(false);
|
||||
|
||||
|
@ -1329,7 +1245,7 @@ bool C4Group::View(const char *szFiles)
|
|||
|
||||
// Calculate group file crc
|
||||
uint32_t crc = 0;
|
||||
C4Group_GetFileCRC(GetFullName().getData(), &crc);
|
||||
GetFileCRC(GetFullName().getData(), &crc);
|
||||
|
||||
// Display list
|
||||
ResetSearch();
|
||||
|
@ -1350,8 +1266,6 @@ bool C4Group::View(const char *szFiles)
|
|||
centry->FileName,
|
||||
centry->Size);
|
||||
|
||||
if (centry->HasCRC)
|
||||
printf(" %s%08X", (centry->HasCRC == C4GECS_New) ? "!" : "~", centry->CRC);
|
||||
if (centry->ChildGroup)
|
||||
printf(" (Group)");
|
||||
if (centry->Executable)
|
||||
|
@ -1442,7 +1356,6 @@ bool C4Group::AddEntryOnDisk(const char *szFilename,
|
|||
fIsGroup,
|
||||
szFilename,
|
||||
iSize,
|
||||
false, 0,
|
||||
szAddAs,
|
||||
NULL,
|
||||
fMove,
|
||||
|
@ -1807,7 +1720,6 @@ bool C4Group::OpenAsChild(C4Group *pMother,
|
|||
EntryOffset+=sizeof(C4GroupEntryCore);
|
||||
if (!AddEntry(C4GRES_InGroup,!!corebuf.ChildGroup,
|
||||
corebuf.FileName,corebuf.Size,
|
||||
corebuf.HasCRC, corebuf.CRC,
|
||||
NULL, NULL, false, false,
|
||||
!!corebuf.Executable))
|
||||
{ CloseExclusiveMother(); Clear(); return Error("OpenAsChild: Insufficient memory"); }
|
||||
|
@ -1917,8 +1829,6 @@ bool C4Group::Add(const char *szName, void *pBuffer, int iSize, bool fChild, boo
|
|||
fChild,
|
||||
szName,
|
||||
iSize,
|
||||
false,
|
||||
0,
|
||||
szName,
|
||||
(BYTE*) pBuffer,
|
||||
false,
|
||||
|
@ -1932,8 +1842,6 @@ bool C4Group::Add(const char *szName, StdBuf &pBuffer, bool fChild, bool fHoldBu
|
|||
fChild,
|
||||
szName,
|
||||
pBuffer.getSize(),
|
||||
false,
|
||||
0,
|
||||
szName,
|
||||
(BYTE*) pBuffer.getData(),
|
||||
false,
|
||||
|
@ -1951,8 +1859,6 @@ bool C4Group::Add(const char *szName, StdStrBuf &pBuffer, bool fChild, bool fHol
|
|||
fChild,
|
||||
szName,
|
||||
pBuffer.getLength(),
|
||||
false,
|
||||
0,
|
||||
szName,
|
||||
(BYTE*) pBuffer.getData(),
|
||||
false,
|
||||
|
@ -2003,8 +1909,7 @@ unsigned int C4Group::EntryCRC32(const char *szWildCard)
|
|||
ResetSearch();
|
||||
while ((pEntry = SearchNextEntry(szWildCard)))
|
||||
{
|
||||
if (!CalcCRC32(pEntry)) return false;
|
||||
iCRC ^= pEntry->CRC;
|
||||
iCRC ^= CalcCRC32(pEntry);
|
||||
}
|
||||
// return
|
||||
return iCRC;
|
||||
|
@ -2217,11 +2122,9 @@ StdStrBuf C4Group::GetFullName() const
|
|||
return sResult;
|
||||
}
|
||||
|
||||
bool C4Group::CalcCRC32(C4GroupEntry *pEntry)
|
||||
uint32_t C4Group::CalcCRC32(C4GroupEntry *pEntry)
|
||||
{
|
||||
// checksum already calculated?
|
||||
if (pEntry->HasCRC == C4GECS_New)
|
||||
return true;
|
||||
uint32_t CRC;
|
||||
// child group?
|
||||
if (pEntry->ChildGroup || (pEntry->Status == C4GRES_OnDisk && (DirectoryExists(pEntry->DiskPath) || C4Group_IsGroup(pEntry->DiskPath))))
|
||||
{
|
||||
|
@ -2241,55 +2144,49 @@ bool C4Group::CalcCRC32(C4GroupEntry *pEntry)
|
|||
return 0;
|
||||
}
|
||||
// get checksum
|
||||
pEntry->CRC = Child.EntryCRC32();
|
||||
CRC = Child.EntryCRC32();
|
||||
}
|
||||
else if (!pEntry->Size)
|
||||
pEntry->CRC = 0;
|
||||
CRC = 0;
|
||||
else
|
||||
{
|
||||
// file checksum already calculated?
|
||||
if (pEntry->HasCRC != C4GECS_Old)
|
||||
BYTE *pData = NULL; bool fOwnData; CStdFile f;
|
||||
// get data
|
||||
switch (pEntry->Status)
|
||||
{
|
||||
BYTE *pData = NULL; bool fOwnData; CStdFile f;
|
||||
// get data
|
||||
switch (pEntry->Status)
|
||||
{
|
||||
case C4GRES_InGroup:
|
||||
// create buffer
|
||||
pData = new BYTE [pEntry->Size]; fOwnData = true;
|
||||
// go to entry
|
||||
if (!SetFilePtr2Entry(pEntry->FileName)) { delete [] pData; return false; }
|
||||
// read
|
||||
if (!Read(pData, pEntry->Size)) { delete [] pData; return false; }
|
||||
break;
|
||||
case C4GRES_OnDisk:
|
||||
// create buffer
|
||||
pData = new BYTE [pEntry->Size]; fOwnData = true;
|
||||
// open
|
||||
if (!f.Open(pEntry->DiskPath)) { delete [] pData; return false; }
|
||||
// read
|
||||
if (!f.Read(pData, pEntry->Size)) { delete [] pData; return false; }
|
||||
break;
|
||||
case C4GRES_InMemory:
|
||||
// set
|
||||
pData = pEntry->bpMemBuf; fOwnData = false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!pData) return false;
|
||||
// calc crc
|
||||
pEntry->CRC = crc32(0, pData, pEntry->Size);
|
||||
// discard buffer
|
||||
if (fOwnData) delete [] pData;
|
||||
case C4GRES_InGroup:
|
||||
// create buffer
|
||||
pData = new BYTE [pEntry->Size]; fOwnData = true;
|
||||
// go to entry
|
||||
if (!SetFilePtr2Entry(pEntry->FileName)) { delete [] pData; return false; }
|
||||
// read
|
||||
if (!Read(pData, pEntry->Size)) { delete [] pData; return false; }
|
||||
break;
|
||||
case C4GRES_OnDisk:
|
||||
// create buffer
|
||||
pData = new BYTE [pEntry->Size]; fOwnData = true;
|
||||
// open
|
||||
if (!f.Open(pEntry->DiskPath)) { delete [] pData; return false; }
|
||||
// read
|
||||
if (!f.Read(pData, pEntry->Size)) { delete [] pData; return false; }
|
||||
break;
|
||||
case C4GRES_InMemory:
|
||||
// set
|
||||
pData = pEntry->bpMemBuf; fOwnData = false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!pData) return false;
|
||||
// calc crc
|
||||
CRC = crc32(0, pData, pEntry->Size);
|
||||
// discard buffer
|
||||
if (fOwnData) delete [] pData;
|
||||
// add file name
|
||||
pEntry->CRC = crc32(pEntry->CRC, reinterpret_cast<BYTE *>(pEntry->FileName), SLen(pEntry->FileName));
|
||||
CRC = crc32(CRC, reinterpret_cast<BYTE *>(pEntry->FileName), SLen(pEntry->FileName));
|
||||
}
|
||||
// set flag
|
||||
pEntry->HasCRC = C4GECS_New;
|
||||
// ok
|
||||
return true;
|
||||
return CRC;
|
||||
}
|
||||
|
||||
bool C4Group::OpenChild(const char* strEntry)
|
||||
|
@ -2367,8 +2264,7 @@ void C4Group::PrintInternals(const char *szIndent)
|
|||
printf("%s ChildGroup: %d\n", szIndent, p->ChildGroup);
|
||||
printf("%s Size: %d\n", szIndent, p->Size);
|
||||
printf("%s Offset: %d\n", szIndent, p->Offset);
|
||||
printf("%s HasCRC: %d\n", szIndent, p->HasCRC);
|
||||
printf("%s CRC: %08X\n", szIndent, p->CRC);
|
||||
printf("%s Executable: %d\n", szIndent, p->Executable);
|
||||
if (p->ChildGroup)
|
||||
{
|
||||
C4Group hChildGroup;
|
||||
|
|
|
@ -82,8 +82,6 @@ bool C4Group_UnpackDirectory(const char *szFilename);
|
|||
bool C4Group_ExplodeDirectory(const char *szFilename);
|
||||
bool C4Group_SetOriginal(const char *szFilename, bool fOriginal);
|
||||
bool C4Group_ReadFile(const char *szFilename, char **pData, size_t *iSize);
|
||||
bool C4Group_GetFileCRC(const char *szFilename, uint32_t *pCRC32);
|
||||
bool C4Group_GetFileSHA1(const char *szFilename, BYTE *pSHA1);
|
||||
|
||||
extern const char *C4CFN_FLS[];
|
||||
|
||||
|
@ -104,10 +102,6 @@ public:
|
|||
void Init();
|
||||
};
|
||||
|
||||
const char C4GECS_None = 0,
|
||||
C4GECS_Old = 1,
|
||||
C4GECS_New = 2;
|
||||
|
||||
class C4GroupEntryCore
|
||||
{
|
||||
public:
|
||||
|
@ -117,7 +111,7 @@ public:
|
|||
int32_t Packed,ChildGroup;
|
||||
int32_t Size, reserved1, Offset;
|
||||
int32_t reserved2;
|
||||
char HasCRC; unsigned int CRC;
|
||||
char reserved3; unsigned int reserved4;
|
||||
char Executable;
|
||||
BYTE fbuf[26];
|
||||
};
|
||||
|
@ -281,8 +275,6 @@ protected:
|
|||
bool childgroup,
|
||||
const char *fname,
|
||||
long size,
|
||||
char cCRC,
|
||||
unsigned int iCRC,
|
||||
const char *entryname = NULL,
|
||||
BYTE *membuf = NULL,
|
||||
bool fDeleteOnDisk = false,
|
||||
|
@ -295,7 +287,7 @@ protected:
|
|||
C4GroupEntry *GetEntry(const char *szName);
|
||||
C4GroupEntry *SearchNextEntry(const char *szName);
|
||||
C4GroupEntry *GetNextFolderEntry();
|
||||
bool CalcCRC32(C4GroupEntry *pEntry);
|
||||
uint32_t CalcCRC32(C4GroupEntry *pEntry);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -211,16 +211,12 @@ public:
|
|||
{
|
||||
C4GroupEntryCore *pCore = ((C4GroupEx &)rByGrp).GetEntry(szEntry);
|
||||
// copy core
|
||||
SavedCore.HasCRC = pCore->HasCRC;
|
||||
SavedCore.CRC = pCore->CRC;
|
||||
SavedCore.Executable = pCore->Executable;
|
||||
}
|
||||
void SetSavedEntryCore(const char *szEntry)
|
||||
{
|
||||
C4GroupEntryCore *pCore = GetEntry(szEntry);
|
||||
// copy core
|
||||
pCore->HasCRC = SavedCore.HasCRC;
|
||||
pCore->CRC = SavedCore.CRC;
|
||||
pCore->Executable = SavedCore.Executable;
|
||||
}
|
||||
|
||||
|
@ -364,7 +360,7 @@ bool C4UpdatePackage::Execute(C4Group *pGroup)
|
|||
return false;*/
|
||||
// check checksum
|
||||
uint32_t iCRC32;
|
||||
if (!C4Group_GetFileCRC(TargetGrp.GetFullName().getData(), &iCRC32))
|
||||
if (!GetFileCRC(TargetGrp.GetFullName().getData(), &iCRC32))
|
||||
return false;
|
||||
int i = 0;
|
||||
for (; i < UpGrpCnt; i++)
|
||||
|
@ -398,7 +394,7 @@ bool C4UpdatePackage::Execute(C4Group *pGroup)
|
|||
{
|
||||
// check the result
|
||||
uint32_t iResChks;
|
||||
if (!C4Group_GetFileCRC(strTarget, &iResChks))
|
||||
if (!GetFileCRC(strTarget, &iResChks))
|
||||
return false;
|
||||
if (iResChks != GrpChks2)
|
||||
{
|
||||
|
@ -472,7 +468,7 @@ int C4UpdatePackage::Check(C4Group *pGroup)
|
|||
|
||||
// check source crc
|
||||
uint32_t iCRC32;
|
||||
if (!C4Group_GetFileCRC(DestPath, &iCRC32))
|
||||
if (!GetFileCRC(DestPath, &iCRC32))
|
||||
return C4UPD_CHK_BAD_SOURCE;
|
||||
// equal to destination group?
|
||||
if (iCRC32 == GrpChks2)
|
||||
|
@ -576,9 +572,6 @@ bool C4UpdatePackage::DoGrpUpdate(C4Group *pUpdateData, C4GroupEx *pGrpTo)
|
|||
// strip checksum/time (if given)
|
||||
char *pTime = strchr(strItemName, '=');
|
||||
if (pTime) *pTime = '\0';
|
||||
// update EntryCRC32. This will make updates to old groups invalid
|
||||
// however, it's needed so updates will update the EntryCRC of *unchanged* files correctly
|
||||
pGrpTo->EntryCRC32(strItemName);
|
||||
// copy to sort list
|
||||
SAppend(strItemName, strSortList);
|
||||
SAppendChar('|', strSortList);
|
||||
|
@ -671,9 +664,9 @@ bool C4UpdatePackage::MakeUpdate(const char *strFile1, const char *strFile2, con
|
|||
sprintf(Name, "%s Update", GetFilename(strFile1));
|
||||
SCopy(strFile1, DestPath, _MAX_PATH);
|
||||
GrpUpdate = true;
|
||||
if (!C4Group_GetFileCRC(strFile1, &GrpChks1[UpGrpCnt]))
|
||||
if (!GetFileCRC(strFile1, &GrpChks1[UpGrpCnt]))
|
||||
{ WriteLog("Error: could not calc checksum for %s!\n", strFile1); return false; }
|
||||
if (!C4Group_GetFileCRC(strFile2, &GrpChks2))
|
||||
if (!GetFileCRC(strFile2, &GrpChks2))
|
||||
{ WriteLog("Error: could not calc checksum for %s!\n", strFile2); return false; }
|
||||
if (fContinued)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
#include <StdFile.h>
|
||||
#include <CStdFile.h>
|
||||
#include <SHA1.h>
|
||||
|
||||
#include <zlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -333,3 +334,55 @@ size_t CStdFile::AccessedEntrySize()
|
|||
assert(!hgzFile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GetFileCRC(const char *szFilename, uint32_t *pCRC32)
|
||||
{
|
||||
if (!pCRC32) return false;
|
||||
// open file
|
||||
CStdFile File;
|
||||
if (!File.Open(szFilename))
|
||||
return false;
|
||||
// calculcate CRC
|
||||
uint32_t iCRC32 = 0;
|
||||
for (;;)
|
||||
{
|
||||
// read a chunk of data
|
||||
BYTE szData[CStdFileBufSize]; size_t iSize = 0;
|
||||
if (!File.Read(szData, CStdFileBufSize, &iSize))
|
||||
if (!iSize)
|
||||
break;
|
||||
// update CRC
|
||||
iCRC32 = crc32(iCRC32, szData, iSize);
|
||||
}
|
||||
// close file
|
||||
File.Close();
|
||||
// okay
|
||||
*pCRC32 = iCRC32;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetFileSHA1(const char *szFilename, BYTE *pSHA1)
|
||||
{
|
||||
if (!pSHA1) return false;
|
||||
// open file
|
||||
CStdFile File;
|
||||
if (!File.Open(szFilename))
|
||||
return false;
|
||||
// calculcate CRC
|
||||
sha1 ctx;
|
||||
for (;;)
|
||||
{
|
||||
// read a chunk of data
|
||||
BYTE szData[CStdFileBufSize]; size_t iSize = 0;
|
||||
if (!File.Read(szData, CStdFileBufSize, &iSize))
|
||||
if (!iSize)
|
||||
break;
|
||||
// update CRC
|
||||
ctx.process_bytes(szData, iSize);
|
||||
}
|
||||
// close file
|
||||
File.Close();
|
||||
// finish calculation
|
||||
ctx.get_digest((sha1::digest_type) pSHA1);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -78,5 +78,7 @@ protected:
|
|||
};
|
||||
|
||||
int UncompressedFileSize(const char *szFileName);
|
||||
bool GetFileCRC(const char *szFilename, uint32_t *pCRC32);
|
||||
bool GetFileSHA1(const char *szFilename, BYTE *pSHA1);
|
||||
|
||||
#endif // INC_CSTDFILE
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <C4Group.h>
|
||||
#include <C4Version.h>
|
||||
#include <C4Update.h>
|
||||
#include <C4ConfigShareware.h>
|
||||
#include <StdRegistry.h>
|
||||
#ifdef _WIN32
|
||||
#include <C4windowswrapper.h>
|
||||
|
@ -187,6 +186,11 @@ bool ProcessGroup(const char *FilenamePar)
|
|||
{
|
||||
fprintf(stderr, "Closing failed: %s\n", hGroup.GetError());
|
||||
}
|
||||
else if (!EraseItem(argv[iArg]))
|
||||
{
|
||||
fprintf(stderr, "Destination Clear failed\n");
|
||||
break;
|
||||
}
|
||||
// Pack
|
||||
else if (!C4Group_PackDirectoryTo(szFilename, argv[iArg]))
|
||||
{
|
||||
|
@ -458,10 +462,6 @@ int main(int argc, char *argv[])
|
|||
// Program info
|
||||
LogF("OpenClonk C4Group %s", C4VERSION);
|
||||
|
||||
// Registration check
|
||||
/* Config.Init();
|
||||
Config.Load(false);*/
|
||||
|
||||
// Init C4Group
|
||||
C4Group_SetSortList(C4CFN_FLS);
|
||||
|
||||
|
|
|
@ -800,3 +800,5 @@ void C4Config::ExpandEnvironmentVariables(char *strPath, size_t iMaxLen)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
C4Config Config;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "C4Constants.h"
|
||||
#include "C4InputValidation.h"
|
||||
#include "C4PlayerControl.h"
|
||||
#include <list>
|
||||
|
||||
#define C4DEFAULT_FONT_NAME "Endeavour"
|
||||
|
@ -288,6 +289,6 @@ public:
|
|||
static void ExpandEnvironmentVariables(char *strPath, size_t iMaxLen);
|
||||
};
|
||||
|
||||
#include <C4ConfigShareware.h>
|
||||
extern C4Config Config;
|
||||
|
||||
#endif // INC_C4Config
|
||||
|
|
|
@ -1,513 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 2003-2004, 2007-2008 Matthes Bender
|
||||
* Copyright (c) 2004-2005, 2007, 2009 Günther Brammer
|
||||
* Copyright (c) 2007 Julian Raschke
|
||||
* Copyright (c) 2007 Peter Wortmann
|
||||
* Copyright (c) 2009 Nicolas Hake
|
||||
* Copyright (c) 2010 Benjamin Herr
|
||||
* Copyright (c) 2010 Sven Eberhardt
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
#include <C4Include.h>
|
||||
#include <C4ConfigShareware.h>
|
||||
#include <C4SecurityCertificates.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Gui.h>
|
||||
|
||||
#include <StdFile.h>
|
||||
|
||||
#ifdef HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
// this disables registration checking!
|
||||
#ifdef _WIN32
|
||||
//#define C4CHECKMEMLEAKS 1
|
||||
#else
|
||||
// Do not disable registration checking
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#ifndef C4CHECKMEMLEAKS
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
// OpenSSL / Key file handling helpers
|
||||
|
||||
// Loads a public key from memory. The parameter provided must point to a certificate in memory.
|
||||
// If generated by certscramble.pl, the certificate needs to be de-base64ed and de-XORed first.
|
||||
// The loaded public key has to be cleared using clearPublicKey after use.
|
||||
|
||||
EVP_PKEY* loadPublicKey(const char *memKey, bool deBase64 = false, bool deXOR = false, const char *strXOR = 0)
|
||||
{
|
||||
const int maxKeyDataLen = 2048;
|
||||
unsigned char keyData[maxKeyDataLen + 1];
|
||||
unsigned int keyDataLen;
|
||||
memset(keyData, 0, maxKeyDataLen + 1);
|
||||
|
||||
// De-base64 certificate
|
||||
if (deBase64)
|
||||
{
|
||||
// The man page says that the data memKey points to will not be modified by this
|
||||
BIO* memBio = BIO_new_mem_buf(const_cast<char *>(memKey), strlen(memKey));
|
||||
BIO* b64Bio = BIO_new(BIO_f_base64());
|
||||
BIO* bio = BIO_push(b64Bio, memBio);
|
||||
(void) BIO_flush(bio);
|
||||
keyDataLen = BIO_read(bio, keyData, maxKeyDataLen * 2);
|
||||
BIO_free_all(bio);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyDataLen = strlen(memKey);
|
||||
memcpy(keyData, memKey, keyDataLen);
|
||||
}
|
||||
|
||||
// De-XOR certificate
|
||||
if (deXOR)
|
||||
{
|
||||
int xorStrLen = strlen(strXOR);
|
||||
for (unsigned int i = 0; i < keyDataLen; i++)
|
||||
keyData[i] = keyData[i] ^ strXOR[i % xorStrLen];
|
||||
}
|
||||
|
||||
// Load public key from certificate
|
||||
BIO* mbio = BIO_new_mem_buf(keyData, -1);
|
||||
X509* cert = PEM_read_bio_X509(mbio, NULL, NULL, NULL);
|
||||
if (!cert) return 0;
|
||||
BIO_free(mbio);
|
||||
EVP_PKEY* pubKey = X509_get_pubkey(cert);
|
||||
X509_free(cert);
|
||||
|
||||
// Return public key
|
||||
return pubKey;
|
||||
}
|
||||
|
||||
void clearPublicKey(EVP_PKEY* pubKey)
|
||||
{
|
||||
EVP_PKEY_free(pubKey);
|
||||
}
|
||||
|
||||
// Verifies the specified block of data using the public key provided.
|
||||
// The block of data is assumed to include a base64-ed signature separated
|
||||
// from data by a double-linefeed delimier.
|
||||
|
||||
int verifyData(char *data, unsigned int dataLen, EVP_PKEY* pubKey)
|
||||
{
|
||||
// Invalid parameters
|
||||
if (!data || !dataLen || !pubKey)
|
||||
return -1;
|
||||
|
||||
// Find delimiter in data
|
||||
char* pDelimiter = 0;
|
||||
for (char* pBack = data + dataLen - 4; pBack >= data; pBack--)
|
||||
if (memcmp(pBack, "\r\n\r\n", 4) == 0)
|
||||
{
|
||||
pDelimiter = pBack;
|
||||
break;
|
||||
}
|
||||
if (!pDelimiter) return -1; //return error("No delimiter found in data to verify.");
|
||||
unsigned int dataOnlyLen = pDelimiter - data;
|
||||
|
||||
// De-base64 signature on registration key
|
||||
unsigned char* b64Sig = (unsigned char*) pDelimiter + 4;
|
||||
unsigned int b64SigLen = dataLen - dataOnlyLen - 4;
|
||||
BIO* memBio = BIO_new_mem_buf(b64Sig, b64SigLen);
|
||||
BIO* b64Bio = BIO_new(BIO_f_base64());
|
||||
BIO* bio = BIO_push(b64Bio, memBio);
|
||||
(void) BIO_flush(bio);
|
||||
const int MAXSIGLEN = 1024;
|
||||
unsigned char sig[MAXSIGLEN] = "";
|
||||
unsigned int sigLen = BIO_read(bio, sig, MAXSIGLEN * 2);
|
||||
BIO_free_all(bio);
|
||||
|
||||
// Verify signature
|
||||
EVP_MD_CTX digest;
|
||||
EVP_VerifyInit(&digest, EVP_sha1());
|
||||
EVP_VerifyUpdate(&digest, data, dataOnlyLen);
|
||||
int err = EVP_VerifyFinal(&digest, sig, sigLen, pubKey);
|
||||
if (err != 1)
|
||||
return -1;
|
||||
EVP_MD_CTX_cleanup(&digest);
|
||||
|
||||
// Data is valid
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Windows clipboard handling
|
||||
|
||||
bool getClipboardText(char *pBuffer, int iBufferSize)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!IsClipboardFormatAvailable(CF_TEXT)) return false;
|
||||
if (!OpenClipboard(NULL)) return false;
|
||||
HANDLE hData = GetClipboardData(CF_TEXT);
|
||||
LPVOID pData = GlobalLock(hData);
|
||||
strncpy(pBuffer, (const char*) pData, iBufferSize); pBuffer[iBufferSize] = 0;
|
||||
GlobalUnlock(pData);
|
||||
CloseClipboard();
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif // C4CHECKMEMLEAKS
|
||||
|
||||
// Old-style string scrambling
|
||||
|
||||
#define ScrambleDefaultKey "_D.lp/8f3_ 3 ] =h16%2"
|
||||
|
||||
const char ScrambleMark = '£',
|
||||
ScrambleRangeLow = '0',
|
||||
ScrambleRangeHi = 'z';
|
||||
|
||||
void ScrambleString(char *szString, int iLen, const char *szKey)
|
||||
{
|
||||
if (!szString || !szKey) return;
|
||||
char *cpString = szString;
|
||||
const char *cpKey = szKey;
|
||||
int iChar,iEscSequence=0;
|
||||
if (iLen<0) iLen=SLen(szString);
|
||||
while (iLen>0)
|
||||
{
|
||||
// Detect character escape sequences
|
||||
if (*cpString=='\\') iEscSequence=2;
|
||||
// Process character
|
||||
if (!iEscSequence)
|
||||
{
|
||||
// Scramble range
|
||||
if (Inside(*cpString,ScrambleRangeLow,ScrambleRangeHi))
|
||||
{
|
||||
// Shift character
|
||||
iChar= ((int) *cpString) + (BoundBy(*cpKey,ScrambleRangeLow,ScrambleRangeHi)-ScrambleRangeLow);
|
||||
if (iChar>ScrambleRangeHi) iChar-=(ScrambleRangeHi-ScrambleRangeLow+1);
|
||||
*cpString = (char) iChar;
|
||||
// Advance key
|
||||
cpKey++; if (!(*cpKey)) cpKey=szKey;
|
||||
}
|
||||
// Postconvert backslash
|
||||
if (*cpString=='\\') *cpString='ø';
|
||||
}
|
||||
// Advance
|
||||
cpString++; iLen--; if (iEscSequence) iEscSequence--;
|
||||
}
|
||||
}
|
||||
|
||||
void UnscrambleString(char *szString/*, int iLen, const char *szKey*/)
|
||||
{
|
||||
int iLen=-1;
|
||||
const char *szKey = ScrambleDefaultKey;
|
||||
|
||||
if (!szString || !szKey) return;
|
||||
char *cpString = szString;
|
||||
const char *cpKey = szKey;
|
||||
int iChar,iEscSequence=0;
|
||||
if (iLen<0) iLen=SLen(szString);
|
||||
while (iLen>0)
|
||||
{
|
||||
// Detect character escape sequences
|
||||
if (*cpString=='\\') iEscSequence=2;
|
||||
// Process character
|
||||
if (!iEscSequence)
|
||||
{
|
||||
// Preconvert backslash
|
||||
if (*cpString=='ø') *cpString='\\';
|
||||
// Scramble range
|
||||
if (Inside(*cpString,ScrambleRangeLow,ScrambleRangeHi))
|
||||
{
|
||||
// Unshift character
|
||||
iChar= ((int) *cpString) - (BoundBy(*cpKey,ScrambleRangeLow,ScrambleRangeHi)-ScrambleRangeLow);
|
||||
if (iChar<ScrambleRangeLow) iChar+=(ScrambleRangeHi-ScrambleRangeLow+1);
|
||||
*cpString = (char) iChar;
|
||||
// Advance key
|
||||
cpKey++; if (!(*cpKey)) cpKey=szKey;
|
||||
}
|
||||
}
|
||||
cpString++; iLen--; if (iEscSequence) iEscSequence--;
|
||||
}
|
||||
}
|
||||
|
||||
#define IDS_SEC_FREEFOLDERMAKER "£6ydHdln zhWijn"
|
||||
#define IDS_SEC_FREEFOLDERS "£8>t`giiW.fcf>ECs;.P5l;OS>sV.X4nqNIyeoCrq.P5l;YS;lUh.c<Q>6afeU.cAS<SenIys.TtfC8dTs.f4H;QfogmkG.w4W0Mq^vMoqs.E4s"
|
||||
|
||||
const char *LoadSecStr(const char *szString)
|
||||
{
|
||||
static char szBuf[1024+1];
|
||||
SCopy(szString,szBuf);
|
||||
UnscrambleString(szBuf);
|
||||
return szBuf+1;
|
||||
}
|
||||
|
||||
C4ConfigShareware::C4ConfigShareware()
|
||||
{
|
||||
RegistrationValid = false;
|
||||
RegData[0] = 0;
|
||||
KeyFile[0] = 0;
|
||||
InvalidKeyFile[0] = 0;
|
||||
}
|
||||
|
||||
C4ConfigShareware::~C4ConfigShareware()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void C4ConfigShareware::Default()
|
||||
{
|
||||
RegistrationValid = false;
|
||||
*RegData = 0;
|
||||
*KeyFile = 0;
|
||||
*InvalidKeyFile = 0;
|
||||
C4Config::Default();
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::Load(bool forceWorkingDirectory, const char *szCustomFile)
|
||||
{
|
||||
// Load standard config
|
||||
if (!C4Config::Load(forceWorkingDirectory, szCustomFile)) return false;
|
||||
// Load registration
|
||||
LoadRegistration();
|
||||
// Done
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::Save()
|
||||
{
|
||||
// Save standard config
|
||||
if (!C4Config::Save()) return false;
|
||||
// Done
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::Registered()
|
||||
{
|
||||
return RegistrationValid;
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::LoadRegistration()
|
||||
{
|
||||
// Reset error message(s)
|
||||
RegistrationError.Clear();
|
||||
|
||||
// First look in configured KeyPath
|
||||
if (Security.KeyPath[0])
|
||||
{
|
||||
char searchPath[_MAX_PATH] = "";
|
||||
SCopy(GetKeyPath(), searchPath);
|
||||
for (DirectoryIterator i(searchPath); *i; ++i)
|
||||
if (WildcardMatch("*.c4k", *i))
|
||||
{
|
||||
if (LoadRegistration(*i))
|
||||
return true;
|
||||
else
|
||||
SCopy(*i, InvalidKeyFile, CFG_MaxString);
|
||||
}
|
||||
}
|
||||
|
||||
// Then look in ExePath
|
||||
for (DirectoryIterator i(General.ExePath.getData()); *i; ++i)
|
||||
if (WildcardMatch("*.c4k", *i))
|
||||
{
|
||||
if (LoadRegistration(*i))
|
||||
return true;
|
||||
else
|
||||
SCopy(*i, InvalidKeyFile, CFG_MaxString);
|
||||
}
|
||||
|
||||
// No key file found
|
||||
return HandleError("No valid key file found.");
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::LoadRegistration(const char *keyFile)
|
||||
{
|
||||
|
||||
#ifdef C4CHECKMEMLEAKS
|
||||
// Set registered flag
|
||||
RegistrationValid = true;
|
||||
SCopy("Debug User", General.Name);
|
||||
return true;
|
||||
#else
|
||||
|
||||
// Clear registered flag, general name, and key file names
|
||||
RegistrationValid = false;
|
||||
General.Name[0] = 0;
|
||||
KeyFile[0] = 0;
|
||||
InvalidKeyFile[0] = 0;
|
||||
|
||||
// Load registration key
|
||||
char* delim = 0;
|
||||
int regKeyLen = 0;
|
||||
FILE* fh = fopen(keyFile, "rb");
|
||||
if (!fh)
|
||||
return HandleError("Cannot open key file.");
|
||||
regKeyLen = fread(RegData, 1, MaxRegDataLen, fh);
|
||||
fclose(fh);
|
||||
delim = strstr(RegData, "\r\n\r\n");
|
||||
if (!delim)
|
||||
return HandleError("Invalid key data (no delimiter).");
|
||||
|
||||
// Load public key from memory
|
||||
EVP_PKEY* pubKey = loadPublicKey(Cert_Reg_XOR_Base64, true, true, XOR_Cert_Reg);
|
||||
if (!pubKey)
|
||||
return HandleError("Internal error on public key.");
|
||||
|
||||
// Verify registration data
|
||||
if (verifyData(RegData, regKeyLen, pubKey) != 0)
|
||||
{
|
||||
clearPublicKey(pubKey);
|
||||
return HandleError("Registration key not valid.");
|
||||
}
|
||||
|
||||
// Clear public key
|
||||
clearPublicKey(pubKey);
|
||||
|
||||
// Cuid blacklist (this will ban a certain player-id forever)
|
||||
int i;
|
||||
const char *BlackCuid[] = { "16206436", "36689615", "15315029", "13109693", "17584580", "14718309",
|
||||
"10851931", "13295768", "15786864", "13769103",
|
||||
NULL
|
||||
};
|
||||
for (i = 0; BlackCuid[i]; i++)
|
||||
if (SEqual2(SSearch(RegData, "Cuid="), BlackCuid[i]))
|
||||
return HandleError("Invalid User-Id.");
|
||||
|
||||
// Cuid-Webcode blacklist (this will only ban a key with a given cuid-webcode combination, allowing to create a new key without assigning a new cuid)
|
||||
const char *BlackCuidWebCode[] = { "16826502", "398ED5F7",
|
||||
NULL, NULL
|
||||
};
|
||||
for (i = 0; BlackCuidWebCode[i]; i += 2)
|
||||
if (SEqual2(SSearch(RegData, "Cuid="), BlackCuidWebCode[i]) && SEqual2(SSearch(RegData, "WebCode="), BlackCuidWebCode[i + 1]))
|
||||
return HandleError("Invalid User-Id/WebCode.");
|
||||
|
||||
// Now truncate the signature from the registration key
|
||||
*delim = 0;
|
||||
|
||||
// Set registered flag
|
||||
RegistrationValid = true;
|
||||
// Store valid keyfile name
|
||||
SCopy(keyFile, KeyFile);
|
||||
// Overwrite general config name (will be empty if not registered)
|
||||
SAppend(GetRegistrationData("FirstName"), General.Name, CFG_MaxString);
|
||||
SAppend(" ", General.Name, CFG_MaxString);
|
||||
SAppend(GetRegistrationData("LastName"), General.Name, CFG_MaxString);
|
||||
|
||||
// Success
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::HandleError(const char *strMessage)
|
||||
{
|
||||
RegData[0] = 0;
|
||||
Log(strMessage);
|
||||
if (RegistrationError.getLength()) RegistrationError.Append(" ");
|
||||
RegistrationError.Append(strMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* C4ConfigShareware::GetRegistrationError()
|
||||
{
|
||||
return RegistrationError.getData();
|
||||
}
|
||||
|
||||
const char* C4ConfigShareware::GetKeyFilename()
|
||||
{
|
||||
return KeyFile;
|
||||
}
|
||||
|
||||
const char* C4ConfigShareware::GetInvalidKeyFilename()
|
||||
{
|
||||
return InvalidKeyFile;
|
||||
}
|
||||
|
||||
const char* C4ConfigShareware::GetKeyPath()
|
||||
{
|
||||
// Returns the configured key path with environment variables expanded and terminating slash
|
||||
static char strKeyPath[_MAX_PATH + 1];
|
||||
if (!Security.KeyPath[0]) return "";
|
||||
SCopy(Security.KeyPath, strKeyPath);
|
||||
ExpandEnvironmentVariables(strKeyPath, _MAX_PATH);
|
||||
AppendBackslash(strKeyPath);
|
||||
return strKeyPath;
|
||||
}
|
||||
|
||||
StdStrBuf C4ConfigShareware::GetKeyMD5()
|
||||
{
|
||||
if (!Registered()) return StdStrBuf();
|
||||
// Calculate MD5 of full key data
|
||||
BYTE Digest[MD5_DIGEST_LENGTH];
|
||||
MD5(reinterpret_cast<BYTE *>(RegData), SLen(RegData), Digest);
|
||||
// Convert to hex
|
||||
StdStrBuf HexDigest;
|
||||
for (int i = 0; i < MD5_DIGEST_LENGTH; i++)
|
||||
HexDigest.AppendFormat("%02x", Digest[i]);
|
||||
// Done
|
||||
return HexDigest;
|
||||
}
|
||||
|
||||
const char* C4ConfigShareware::GetRegistrationData(const char *strField)
|
||||
{
|
||||
// Notice: GetRegistrationData() is used by LoadRegistration even if the registered flag is not yet set.
|
||||
static char strReturnValue[CFG_MaxString + 1];
|
||||
// Find field in registration key
|
||||
char strFieldMask[128 + 1 + 1];
|
||||
strncpy(strFieldMask, strField, 128); strFieldMask[128] = 0;
|
||||
strcat(strFieldMask, "=");
|
||||
const char *pKeyField = strstr(RegData, strFieldMask);
|
||||
// Field not found, key might be empty
|
||||
if (!pKeyField) return "";
|
||||
// Advance to value
|
||||
pKeyField += strlen(strFieldMask);
|
||||
// Get field value
|
||||
size_t iValueLen = 256;
|
||||
const char *pFieldEnd = strstr(pKeyField, "\x0d");
|
||||
if (pFieldEnd) iValueLen = pFieldEnd - pKeyField;
|
||||
iValueLen = Min<size_t>(iValueLen, CFG_MaxString);
|
||||
strncpy(strReturnValue, pKeyField, iValueLen); strReturnValue[iValueLen] = 0;
|
||||
return strReturnValue;
|
||||
}
|
||||
|
||||
void C4ConfigShareware::ClearRegistrationError()
|
||||
{
|
||||
// Reset error message(s)
|
||||
RegistrationError.Clear();
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::IsConfidentialData(const char *szInput)
|
||||
{
|
||||
// safety
|
||||
if (!szInput) return false;
|
||||
// unreg users don't have confidential data
|
||||
if (!Config.Registered()) return false;
|
||||
// shouldn't send the webcode!
|
||||
const char *szWebCode = GetRegistrationData("WebCode");
|
||||
if (szWebCode && *szWebCode) if (SSearchNoCase(szInput, szWebCode))
|
||||
{
|
||||
/* if (fShowWarningMessage && ::pGUI)
|
||||
::pGUI->ShowErrorMessage(LoadResStr("IDS_ERR_WARNINGYOUWERETRYINGTOSEN"));*/
|
||||
return true;
|
||||
}
|
||||
// all OK
|
||||
return false;
|
||||
}
|
||||
|
||||
C4ConfigShareware Config;
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* OpenClonk, http://www.openclonk.org
|
||||
*
|
||||
* Copyright (c) 2003, 2007 Matthes Bender
|
||||
* Copyright (c) 2005 Günther Brammer
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
#ifndef C4CONFIGSHAREWARE_H_INC
|
||||
#define C4CONFIGSHAREWARE_H_INC
|
||||
|
||||
#include <C4Config.h>
|
||||
#include <C4Group.h>
|
||||
|
||||
const int MaxRegDataLen = 4096;
|
||||
const char szInvalidKeyData[] = "r>iU218f3_030\r\n0ipX>ZeuX\r\nZichtVLpI=WeUt\r\nYNtzNcQy=EZs1\r\nAhVsloP=PYptk TE0e\r\n5Vtms5_0:-0^-0>\r\nDfhCqHy=27CIxFpB\r\n\r\nnxSR+?bD50+H[:fEnyW^UcASVTSR9n>Oez`2qHN3YWbz8P;SSqkvXtXMM6Z1UQNT\r\nrpFHRy/6pZ2T6E1iGF1Dt\370Ofw7f\370bUvuM3_jl8TsxWN8;d0kCj3v/JRWBO/Gvxpx\r\nTrBomp81>gkZoddjFcyTwx[J/dNIKEzt]Tj5em=]60w@\r\n";
|
||||
|
||||
void UnscrambleString(char *szString);
|
||||
|
||||
class C4ConfigShareware: public C4Config
|
||||
{
|
||||
public:
|
||||
C4ConfigShareware();
|
||||
~C4ConfigShareware();
|
||||
protected:
|
||||
bool RegistrationValid;
|
||||
char RegData[MaxRegDataLen + 1];
|
||||
char KeyFile[CFG_MaxString + 1];
|
||||
char InvalidKeyFile[CFG_MaxString + 1];
|
||||
public:
|
||||
void Default();
|
||||
bool Save();
|
||||
bool Load(bool forceWorkingDirectory=true, const char *szCustomFile=NULL);
|
||||
public:
|
||||
void ClearRegistrationError();
|
||||
bool Registered();
|
||||
bool LoadRegistration();
|
||||
bool LoadRegistration(const char *szFrom);
|
||||
const char* GetRegistrationData(const char* strField);
|
||||
const char* GetRegistrationError();
|
||||
const char* GetKeyFilename();
|
||||
const char* GetInvalidKeyFilename();
|
||||
const char* GetKeyPath();
|
||||
StdStrBuf GetKeyMD5();
|
||||
// checks for phising attacks: Return true if input contains user's webcode
|
||||
bool IsConfidentialData(const char *szInput);
|
||||
protected:
|
||||
StdStrBuf RegistrationError;
|
||||
bool HandleError(const char *strMessage);
|
||||
};
|
||||
|
||||
extern C4ConfigShareware Config;
|
||||
#endif // C4CONFIGSHAREWARE_H_INC
|
|
@ -19,6 +19,7 @@
|
|||
#include <C4Reloc.h>
|
||||
|
||||
#include <C4Config.h>
|
||||
#include <C4Application.h>
|
||||
|
||||
C4Reloc Reloc; // singleton
|
||||
|
||||
|
@ -31,9 +32,19 @@ void C4Reloc::Init()
|
|||
// but for distribution it might make sense to disable it.
|
||||
// TODO: We might also want to add ExePath/planet if it exists, so that we don't
|
||||
// need to run the engine in planet/.
|
||||
|
||||
#ifdef USE_COCOA
|
||||
AddPath(::Application.GetGameDataPath().getData());
|
||||
#else
|
||||
AddPath(Config.General.ExePath.getData());
|
||||
#endif
|
||||
|
||||
AddPath(Config.General.UserDataPath);
|
||||
|
||||
#ifndef USE_COCOA
|
||||
AddPath(Config.General.SystemDataPath);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
bool C4Reloc::AddPath(const char* path)
|
||||
|
|
|
@ -680,7 +680,7 @@ C4ControlJoinPlayer::C4ControlJoinPlayer(const char *szFilename, int32_t iAtClie
|
|||
MakeTempFilename(&filename_buf);
|
||||
if (C4Group_PackDirectoryTo(filename.getData(), filename_buf.getData()))
|
||||
{
|
||||
filename = filename_buf;
|
||||
filename.Take(filename_buf);
|
||||
file_is_temp = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -222,10 +222,20 @@ void C4GameResList::Clear()
|
|||
void C4GameResList::LoadFoldersWithLocalDefs(const char *szPath)
|
||||
{
|
||||
// Scan path for folder names
|
||||
int32_t cnt,iBackslash;
|
||||
int32_t iBackslash;
|
||||
char szFoldername[_MAX_PATH+1];
|
||||
C4Group hGroup;
|
||||
for (cnt=0; (iBackslash=SCharPos(DirectorySeparator,szPath,cnt)) > -1; cnt++)
|
||||
#ifdef _WIN32
|
||||
// Allow both backward and forward slashes when searching because the path
|
||||
// may be given with forward slashes. We would skip loading some definitions
|
||||
// if we didn't handle this properly and the user would have no clue what was
|
||||
// going on. See also http://forum.openclonk.org/topic_show.pl?tid=905.
|
||||
char control[3] = { DirectorySeparator, AltDirectorySeparator, '\0' };
|
||||
const size_t len = strlen(szPath);
|
||||
for (int32_t iPrev=0; (iBackslash = strcspn(szPath+iPrev, control) + iPrev) < len; iPrev = iBackslash + 1)
|
||||
#else
|
||||
for (int32_t cnt=0; (iBackslash=SCharPos(DirectorySeparator,szPath,cnt)) > -1; cnt++)
|
||||
#endif
|
||||
{
|
||||
// Get folder name
|
||||
SCopy(szPath,szFoldername,iBackslash);
|
||||
|
|
|
@ -224,7 +224,7 @@ bool C4Record::Stop(StdStrBuf *pRecordName, BYTE *pRecordSHA1)
|
|||
if (pRecordName)
|
||||
pRecordName->Copy(sFilename);
|
||||
if (pRecordSHA1)
|
||||
if (!C4Group_GetFileSHA1(sFilename.getData(), pRecordSHA1))
|
||||
if (!GetFileSHA1(sFilename.getData(), pRecordSHA1))
|
||||
return false;
|
||||
|
||||
// ok
|
||||
|
|
|
@ -418,19 +418,16 @@ void C4EditCursor::Draw(C4TargetFacet &cgo)
|
|||
uint32_t dwOldBlitMode = cobj->BlitMode;
|
||||
cobj->ColorMod = 0xffffffff;
|
||||
cobj->BlitMode = C4GFXBLIT_CLRSFC_MOD2 | C4GFXBLIT_ADDITIVE;
|
||||
|
||||
StdMeshInstance::FaceOrdering old_fo = StdMeshInstance::FO_Fixed;
|
||||
|
||||
StdMeshInstance::FaceOrdering old_fo = StdSubMeshInstance::FO_Fixed;
|
||||
if(cobj->pMeshInstance)
|
||||
{
|
||||
old_fo = cobj->pMeshInstance->GetFaceOrdering();
|
||||
cobj->pMeshInstance->SetFaceOrdering(StdMeshInstance::FO_NearestToFarthest);
|
||||
}
|
||||
|
||||
cobj->pMeshInstance->SetFaceOrdering(StdSubMeshInstance::FO_NearestToFarthest);
|
||||
|
||||
cobj->Draw(cgo,-1);
|
||||
cobj->DrawTopFace(cgo, -1);
|
||||
|
||||
if(cobj->pMeshInstance)
|
||||
cobj->pMeshInstance->SetFaceOrdering(old_fo);
|
||||
cobj->pMeshInstance->SetFaceOrderingForClrModulation(cobj->ColorMod);
|
||||
|
||||
cobj->ColorMod = dwOldMod;
|
||||
cobj->BlitMode = dwOldBlitMode;
|
||||
|
|
|
@ -505,7 +505,9 @@ void C4Landscape::DigMaterial2Objects(int32_t tx, int32_t ty, C4MaterialList *ma
|
|||
if(::MaterialMap.Map[mat].Dig2ObjectCollect == 2)
|
||||
{
|
||||
pObj->AssignRemoval();
|
||||
return;
|
||||
// Cap so we never have more than one object ´worth of material in the store
|
||||
mat_list->Amount[mat] = ::MaterialMap.Map[mat].Dig2ObjectRatio;
|
||||
break;
|
||||
}
|
||||
mat_list->Amount[mat] -= ::MaterialMap.Map[mat].Dig2ObjectRatio;
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ void C4LandscapeRenderGL::DumpInfoLog(const char *szWhat, GLhandleARB hShader, i
|
|||
if(iActualLength > iLength || iActualLength <= 0) return;
|
||||
|
||||
// Terminate, log
|
||||
pBuf[iActualLength + 1] = '\0';
|
||||
pBuf[iActualLength] = '\0';
|
||||
LogSilentF(" gl: Compiling %s %d:", szWhat, iWorkaround);
|
||||
LogSilent(pBuf);
|
||||
delete[] pBuf;
|
||||
|
@ -534,17 +534,31 @@ GLhandleARB C4LandscapeRenderGL::CreateShader(GLenum iShaderType, const char *sz
|
|||
// Create shader
|
||||
GLhandleARB hShader = glCreateShaderObjectARB(iShaderType);
|
||||
|
||||
// Find #version
|
||||
StdStrBuf Version("");
|
||||
const char *szCodeRest = szCode;
|
||||
if (const char *szVersion = SSearch(szCode, "#version"))
|
||||
{
|
||||
while (*szVersion && *szVersion != '\n')
|
||||
szVersion++;
|
||||
if (*szVersion == '\n')
|
||||
szVersion++;
|
||||
Version.Copy(szCode, szVersion - szCode);
|
||||
szCodeRest = szVersion;
|
||||
}
|
||||
|
||||
// Build code
|
||||
const char *szCodes[C4LR_ShaderWorkaroundCount + 1];
|
||||
const char *szCodes[C4LR_ShaderWorkaroundCount + 2];
|
||||
szCodes[0] = Version.getData();
|
||||
for(int i = 0; i < C4LR_ShaderWorkaroundCount; i++)
|
||||
if(iWorkaround & (1 << i))
|
||||
szCodes[i] = C4LR_ShaderWorkarounds[i];
|
||||
szCodes[i+1] = C4LR_ShaderWorkarounds[i];
|
||||
else
|
||||
szCodes[i] = "";
|
||||
szCodes[C4LR_ShaderWorkaroundCount] = szCode;
|
||||
szCodes[i+1] = "";
|
||||
szCodes[C4LR_ShaderWorkaroundCount+1] = szCodeRest;
|
||||
|
||||
// Compile
|
||||
glShaderSourceARB(hShader, C4LR_ShaderWorkaroundCount + 1, szCodes, 0);
|
||||
glShaderSourceARB(hShader, C4LR_ShaderWorkaroundCount + 2, szCodes, 0);
|
||||
glCompileShaderARB(hShader);
|
||||
|
||||
// Dump any information to log
|
||||
|
|
|
@ -21,7 +21,8 @@ bool C4LandscapeRenderClassic::Init(int32_t iWidth, int32_t iHeight, C4TextureMa
|
|||
{
|
||||
// Create surface
|
||||
Surface32 = new CSurface();
|
||||
if(!Surface32->Create(iWidth, iHeight,false,false,64))
|
||||
// without shaders, the FoW is only as detailed as the landscape has tiles.
|
||||
if(!Surface32->Create(iWidth, iHeight,false,false,lpDDraw->IsShaderific() ? 0 : 64))
|
||||
return false;
|
||||
// Safe back info
|
||||
this->iWidth = iWidth;
|
||||
|
|
|
@ -102,77 +102,27 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
|
|||
return iResult;
|
||||
}
|
||||
|
||||
int32_t C4DefList::Load(const char *szSearch,
|
||||
int32_t C4DefList::Load(const char *szFilename,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem,
|
||||
bool fOverload, int32_t iMinProgress, int32_t iMaxProgress)
|
||||
{
|
||||
int32_t iResult=0;
|
||||
|
||||
// Empty
|
||||
if (!szSearch[0]) return iResult;
|
||||
|
||||
// Segments
|
||||
char szSegment[_MAX_PATH+1]; int32_t iGroupCount;
|
||||
if ((iGroupCount=SCharCount(';',szSearch)))
|
||||
{
|
||||
++iGroupCount; int32_t iPrg=iMaxProgress-iMinProgress;
|
||||
for (int32_t cseg=0; SCopySegment(szSearch,cseg,szSegment,';',_MAX_PATH); cseg++)
|
||||
iResult += Load(szSegment,dwLoadWhat,szLanguage,pSoundSystem,fOverload,
|
||||
iMinProgress+iPrg*cseg/iGroupCount, iMinProgress+iPrg*(cseg+1)/iGroupCount);
|
||||
return iResult;
|
||||
}
|
||||
|
||||
// Wildcard items
|
||||
if (SCharCount('*',szSearch))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
struct _finddata_t fdt; int32_t fdthnd;
|
||||
if ((fdthnd=_findfirst(szSearch,&fdt))<0) return false;
|
||||
do
|
||||
{
|
||||
iResult += Load(fdt.name,dwLoadWhat,szLanguage,pSoundSystem,fOverload);
|
||||
}
|
||||
while (_findnext(fdthnd,&fdt)==0);
|
||||
_findclose(fdthnd);
|
||||
// progress
|
||||
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
|
||||
#else
|
||||
fputs("FIXME: C4DefList::Load\n", stderr);
|
||||
#endif
|
||||
return iResult;
|
||||
}
|
||||
|
||||
// File specified with creation (currently not used)
|
||||
char szCreation[25+1];
|
||||
int32_t iCreation=0;
|
||||
if (SCopyEnclosed(szSearch,'(',')',szCreation,25))
|
||||
{
|
||||
// Scan creation
|
||||
SClearFrontBack(szCreation);
|
||||
sscanf(szCreation,"%i",&iCreation);
|
||||
// Extract filename
|
||||
SCopyUntil(szSearch,szSegment,'(',_MAX_PATH);
|
||||
SClearFrontBack(szSegment);
|
||||
szSearch = szSegment;
|
||||
}
|
||||
|
||||
// Load from specified file
|
||||
C4Group hGroup;
|
||||
if (!Reloc.Open(hGroup, szSearch))
|
||||
if (!Reloc.Open(hGroup, szFilename))
|
||||
{
|
||||
// Specified file not found (failure)
|
||||
LogFatal(FormatString(LoadResStr("IDS_PRC_DEFNOTFOUND"),szSearch).getData());
|
||||
LogFatal(FormatString(LoadResStr("IDS_PRC_DEFNOTFOUND"), szFilename).getData());
|
||||
LoadFailure=true;
|
||||
return iResult;
|
||||
return 0; // 0 definitions loaded
|
||||
}
|
||||
iResult += Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem,fOverload,true,iMinProgress,iMaxProgress);
|
||||
int32_t nDefs = Load(hGroup,dwLoadWhat,szLanguage,pSoundSystem,fOverload,true,iMinProgress,iMaxProgress);
|
||||
hGroup.Close();
|
||||
|
||||
// progress (could go down one level of recursion...)
|
||||
if (iMinProgress != iMaxProgress) Game.SetInitProgress(float(iMaxProgress));
|
||||
|
||||
return iResult;
|
||||
return nDefs;
|
||||
}
|
||||
|
||||
bool C4DefList::Add(C4Def *pDef, bool fOverload)
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
C4SoundSystem *pSoundSystem = NULL,
|
||||
bool fOverload = false,
|
||||
bool fSearchMessage = false, int32_t iMinProgress=0, int32_t iMaxProgress=0, bool fLoadSysGroups = true);
|
||||
int32_t Load(const char *szSearch,
|
||||
int32_t Load(const char *szFilename,
|
||||
DWORD dwLoadWhat, const char *szLanguage,
|
||||
C4SoundSystem *pSoundSystem = NULL,
|
||||
bool fOverload = false, int32_t iMinProgress=0, int32_t iMaxProgress=0);
|
||||
|
|
|
@ -88,12 +88,13 @@ public:
|
|||
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
|
||||
inline bool operator ==(const C4ID &other) const { return v == other.v; }
|
||||
inline bool operator !=(const C4ID &other) const { return v != other.v; }
|
||||
inline bool operator <(const C4ID &other) const { return v < other.v; }
|
||||
inline bool operator >(const C4ID &other) const { return v > other.v; }
|
||||
inline bool operator <=(const C4ID &other) const { return v <= other.v; }
|
||||
inline bool operator >=(const C4ID &other) const { return v >= other.v; }
|
||||
// Compare names instead of v directly so that a sequence of IDs is synchronous
|
||||
inline bool operator ==(const C4ID &other) const { return names[v] == names[other.v]; }
|
||||
inline bool operator !=(const C4ID &other) const { return names[v] != names[other.v]; }
|
||||
inline bool operator <(const C4ID &other) const { return names[v] < names[other.v]; }
|
||||
inline bool operator >(const C4ID &other) const { return names[v] > names[other.v]; }
|
||||
inline bool operator <=(const C4ID &other) const { return names[v] <= names[other.v]; }
|
||||
inline bool operator >=(const C4ID &other) const { return names[v] >= names[other.v]; }
|
||||
|
||||
// Safe bool
|
||||
typedef size_t C4ID::*safe_bool_type;
|
||||
|
|
|
@ -326,7 +326,9 @@ void C4Object::AssignRemoval(bool fExitContents)
|
|||
if (!Status) return;
|
||||
#ifdef DEBUGREC
|
||||
C4RCCreateObj rc;
|
||||
memset(&rc, '\0', sizeof(rc));
|
||||
rc.oei=Number;
|
||||
if (Def && Def->GetName()) strncpy(rc.id, Def->GetName(), 32+1);
|
||||
rc.x=GetX(); rc.y=GetY(); rc.ownr=Owner;
|
||||
AddDbgRec(RCT_DsObj, &rc, sizeof(rc));
|
||||
#endif
|
||||
|
|
|
@ -243,7 +243,7 @@ static bool FnSetName(C4AulContext *cthr, C4String *pNewName, bool fSetInInfo, b
|
|||
static C4Value FnSetCrewExtraData(C4AulContext *cthr, C4Value *strDataName_C4V, C4Value *Data)
|
||||
{
|
||||
if (!cthr->Obj)
|
||||
throw NeedObjectContext("SetCrewExtraData");
|
||||
throw new NeedObjectContext("SetCrewExtraData");
|
||||
|
||||
const char *strDataName = FnStringPar(strDataName_C4V->getStr());
|
||||
// valid crew with info? (for great nullpointer prevention)
|
||||
|
@ -278,7 +278,7 @@ static C4Value FnSetCrewExtraData(C4AulContext *cthr, C4Value *strDataName_C4V,
|
|||
static C4Value FnGetCrewExtraData(C4AulContext *cthr, C4Value *strDataName_C4V)
|
||||
{
|
||||
if (!cthr->Obj)
|
||||
throw NeedObjectContext("GetCrewExtraData");
|
||||
throw new NeedObjectContext("GetCrewExtraData");
|
||||
|
||||
const char *strDataName = FnStringPar(strDataName_C4V->getStr());
|
||||
// valid crew with info?
|
||||
|
@ -458,7 +458,7 @@ static C4Value FnSetCommand(C4AulContext *cthr, C4Value *pPars)
|
|||
PAR(object, pTarget2); PAR(any, Data); PAR(int, iRetries);
|
||||
// Object
|
||||
if (!cthr->Obj)
|
||||
throw NeedObjectContext("SetCommand");
|
||||
throw new NeedObjectContext("SetCommand");
|
||||
// Command
|
||||
if (!szCommand) return C4VFalse;
|
||||
long iCommand = CommandByName(FnStringPar(szCommand));
|
||||
|
@ -481,7 +481,7 @@ static C4Value FnAddCommand(C4AulContext *cthr, C4Value *pPars)
|
|||
PAR(object, pTarget2); PAR(int, iUpdateInterval); PAR(any, Data); PAR(int, iRetries); PAR(int, iBaseMode);
|
||||
// Object
|
||||
if (!cthr->Obj)
|
||||
throw NeedObjectContext("AddCommand");
|
||||
throw new NeedObjectContext("AddCommand");
|
||||
// Command
|
||||
if (!szCommand) return C4VFalse;
|
||||
long iCommand = CommandByName(FnStringPar(szCommand));
|
||||
|
@ -502,7 +502,7 @@ static C4Value FnAppendCommand(C4AulContext *cthr, C4Value *pPars)
|
|||
PAR(object, pTarget2); PAR(int, iUpdateInterval); PAR(any, Data); PAR(int, iRetries); PAR(int, iBaseMode);
|
||||
// Object
|
||||
if (!cthr->Obj)
|
||||
throw NeedObjectContext("AppendCommand");
|
||||
throw new NeedObjectContext("AppendCommand");
|
||||
// Command
|
||||
if (!szCommand) return C4VFalse;
|
||||
long iCommand = CommandByName(FnStringPar(szCommand));
|
||||
|
@ -523,7 +523,7 @@ static C4Value FnGetCommand(C4AulContext *cthr, C4Value *pPars)
|
|||
|
||||
// safety
|
||||
if (!cthr->Obj)
|
||||
throw NeedObjectContext("GetCommand");
|
||||
throw new NeedObjectContext("GetCommand");
|
||||
|
||||
C4Command * Command = cthr->Obj->Command;
|
||||
// Move through list to Command iCommandNum
|
||||
|
@ -1955,7 +1955,7 @@ static Nillable<int> FnGetAnimationLength(C4AulObjectContext *ctx, C4String *szA
|
|||
|
||||
const StdMeshAnimation* animation = Instance->GetMesh().GetAnimationByName(szAnimation->GetData());
|
||||
if (!animation) return C4Void();
|
||||
return static_cast<int>(animation->Length * 1000.0f); // TODO: sync critical
|
||||
return fixtoi(ftofix(animation->Length), 1000); // sync critical!
|
||||
}
|
||||
|
||||
static Nillable<C4String*> FnGetAnimationName(C4AulObjectContext *ctx, Nillable<int> iAnimationNumber, Nillable<int> iAttachNumber)
|
||||
|
@ -2089,6 +2089,7 @@ static Nillable<int> FnAttachMesh(C4AulObjectContext *ctx, C4PropList* Mesh, C4S
|
|||
if (!pDef) return C4Void();
|
||||
if (pDef->Graphics.Type != C4DefGraphics::TYPE_Mesh) return C4Void();
|
||||
attach = ctx->Obj->pMeshInstance->AttachMesh(*pDef->Graphics.Mesh, new C4MeshDenumerator(pDef), szParentBone->GetData(), szChildBone->GetData(), trans, Flags);
|
||||
attach->Child->SetFaceOrderingForClrModulation(ctx->Obj->ColorMod);
|
||||
}
|
||||
|
||||
if (!attach) return C4Void();
|
||||
|
|
|
@ -620,12 +620,16 @@ bool C4FindObjectCategory::IsEnsured()
|
|||
|
||||
bool C4FindObjectAction::Check(C4Object *pObj)
|
||||
{
|
||||
assert(pObj);
|
||||
if (!pObj->GetAction()) return false;
|
||||
return SEqual(pObj->GetAction()->GetName(), szAction);
|
||||
}
|
||||
|
||||
bool C4FindObjectActionTarget::Check(C4Object *pObj)
|
||||
{
|
||||
assert(index >= 0 && index <= 1);
|
||||
assert(pObj);
|
||||
if (!pObj->GetAction()) return false;
|
||||
if (index == 0)
|
||||
return pObj->Action.Target == pActionTarget;
|
||||
else if (index == 1)
|
||||
|
@ -636,6 +640,8 @@ bool C4FindObjectActionTarget::Check(C4Object *pObj)
|
|||
|
||||
bool C4FindObjectProcedure::Check(C4Object *pObj)
|
||||
{
|
||||
assert(pObj);
|
||||
if (!pObj->GetAction()) return false;
|
||||
C4Value v;
|
||||
pObj->GetAction()->GetProperty(P_Procedure, &v);
|
||||
return v != C4VNull && v.getStr() == procedure;
|
||||
|
|
|
@ -153,6 +153,10 @@ static C4Object *FnCreateConstruction(C4AulContext *cthr,
|
|||
C4PropList * PropList, long iXOffset, long iYOffset, Nillable<long> owner,
|
||||
long iCompletion, bool fTerrain, bool fCheckSite)
|
||||
{
|
||||
// Make sure parameters are valid
|
||||
if (!PropList || !PropList->GetDef())
|
||||
return NULL;
|
||||
|
||||
// Local object calls override position offset, owner
|
||||
if (cthr->Obj)
|
||||
{
|
||||
|
|
|
@ -833,12 +833,6 @@ bool C4ChatControl::ProcessInput(const char *szInput, ChatSheet *pChatSheet)
|
|||
}
|
||||
// safety
|
||||
if (!szInput || !*szInput || !pChatSheet) return fResult;
|
||||
// check confidential data
|
||||
if (Config.IsConfidentialData(szInput))
|
||||
{
|
||||
pChatSheet->DoError(LoadResStr("IDS_ERR_WARNINGYOUWERETRYINGTOSEN"));
|
||||
return fResult;
|
||||
}
|
||||
// command?
|
||||
if (*szInput == '/' && !SEqual2NoCase(szInput + 1, "me "))
|
||||
{
|
||||
|
|