Merge branch 'master' into Controls

Conflicts:
	planet/Objects.ocd/Items.ocd/Tools.ocd/GrappleBow.ocd/Script.c
Controls
David Dormagen 2013-05-23 17:53:41 +02:00
commit 20bfab48b6
682 changed files with 25071 additions and 18759 deletions

8
.gitignore vendored
View File

@ -4,7 +4,7 @@ autom4te.cache
.deps
deps
*.o
/clonk
/openclonk
/netpuncher
/c4group
/c4script
@ -40,6 +40,8 @@ planet/CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake
*.rule
editor-icons.h
oc-icon.h
# Documentation
*.pyc
@ -84,6 +86,7 @@ openclonk.ilk
*.vcproj
*.vcxproj
*.vcxproj.filters
/ipch
# Temporary files created by Microsoft Visual Studio
*.ncb
@ -122,6 +125,7 @@ planet/.project
openclonk.layout
openclonk.sdf
openclonk.cbp
tests/openclonk_unittest.cbp
# MacOSX saved searches
*.savedSearch
@ -132,3 +136,5 @@ WindowsGamesExplorer.xml
# Mape
mape
mape-icons.h

View File

@ -29,7 +29,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(Version.txt)
set(CMAKE_ADDITIONAL_DEPS_PATH deps CACHE PATH "Additional directory to search for libraries and headers")
set(CMAKE_ADDITIONAL_DEPS_PATH "${CMAKE_CURRENT_BINARY_DIR}/deps" CACHE PATH "Additional directory to search for libraries and headers")
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_ADDITIONAL_DEPS_PATH})
set(OC_CXX_FLAGS ${CMAKE_CXX_FLAGS})
separate_arguments(OC_CXX_FLAGS)
@ -50,53 +50,29 @@ endfunction()
############################################################################
# User selectable options
############################################################################
include(CMakeDependentOption)
option(PROJECT_FOLDERS "Put source files into subfolders in project file" ON)
option(USE_GL "Enable OpenGL support" ON)
SET(INITIAL_USE_SDL_MAINLOOP_VALUE OFF)
SET(INITIAL_USE_OPEN_AL OFF)
option(USE_SDL_MAINLOOP "Use SDL to create windows etc." ${INITIAL_USE_SDL_MAINLOOP_VALUE})
if(WIN32 AND FALSE) # disable DX option while it doesn't work anyway
option(USE_DIRECTX "Enable DirectX support" ON)
if(EXISTS $ENV{DXSDK_DIR})
list(APPEND CMAKE_INCLUDE_PATH $ENV{DXSDK_DIR}/Include)
if(CMAKE_CL_64)
list(APPEND CMAKE_LIBRARY_PATH $ENV{DXSDK_DIR}/Lib/x64)
else()
list(APPEND CMAKE_LIBRARY_PATH $ENV{DXSDK_DIR}/Lib/x86)
endif()
else()
option(USE_CONSOLE "Build dedicated server" OFF)
CMAKE_DEPENDENT_OPTION(USE_GL "Enable OpenGL support" ON "NOT USE_CONSOLE" OFF)
# DirectX is disabled because it misses essential features
CMAKE_DEPENDENT_OPTION(USE_DIRECTX "Enable DirectX support" OFF "WIN32 AND NOT USE_CONSOLE" OFF)
CMAKE_DEPENDENT_OPTION(USE_SDL_MAINLOOP "Use SDL to create windows etc." OFF "NOT USE_CONSOLE" OFF)
CMAKE_DEPENDENT_OPTION(USE_X11 "Use X11 to create windows etc." ON
"UNIX AND NOT APPLE AND NOT USE_SDL_MAINLOOP AND NOT USE_CONSOLE" OFF)
CMAKE_DEPENDENT_OPTION(USE_GTK "Use GTK for the developer mode" ON "USE_X11" OFF)
CMAKE_DEPENDENT_OPTION(USE_GTK3 "Use GTK3 instead of GTK2" OFF "USE_GTK" OFF)
endif()
else()
SET(USE_DIRECTX OFF)
SET(HAVE_FMOD OFF)
endif()
if(NOT USE_GL AND NOT USE_DIRECTX)
message(STATUS "No graphics display enabled; building dedicated server")
SET(USE_CONSOLE ON CACHE INTERNAL "Build dedicated server")
else()
SET(USE_CONSOLE OFF)
endif()
if(UNIX AND NOT USE_SDL_MAINLOOP AND NOT APPLE AND NOT USE_CONSOLE)
option(USE_X11 "Use X11 to create windows etc." ON)
option(USE_GTK "Use GTK for the developer mode" ON)
option(USE_GTK3 "Use GTK3 instead of GTK2" OFF)
else()
SET(USE_X11 OFF)
SET(USE_GTK OFF)
SET(USE_GTK3 OFF)
endif()
CMAKE_DEPENDENT_OPTION(USE_COCOA "Use Apple Cocoa for the developer mode and the windows." ON "APPLE" OFF)
CMAKE_DEPENDENT_OPTION(USE_APPLE_CLANG "Use Apple Clang Compiler as C++ compiler." ON "APPLE" OFF)
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)
SET(INITIAL_USE_OPEN_AL OFF)
endif()
option(USE_OPEN_AL "Use OpenAL to play sounds" ${INITIAL_USE_OPEN_AL})
option(DEBUGREC "Debug records" OFF)
option(OC_BUILD_MULTIPROCESSOR "Use all processor cores to build" OFF)
option(WITH_AUTOMATIC_UPDATE "Build engine without automatic update support" OFF)
option(WITH_AUTOMATIC_UPDATE "Automatic updates are downloaded from the project website." OFF)
############################################################################
# Check for compiler quirks and features
@ -120,6 +96,8 @@ endforeach()
# out because it does not understand -std=gnu++0x
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS ${OC_REQUIRED_FLAGS})
include(RequireCXXSourceCompiles)
REQUIRE_CXX_SOURCE_COMPILES("#include <memory>\nint main() { std::unique_ptr<int> a; std::shared_ptr<int> b; }" HAVE_C11_SMART_PTRS)
CHECK_CXX_SOURCE_COMPILES("void f(struct D&&); int main() { return 0; }" HAVE_RVALUE_REF)
CHECK_CXX_SOURCE_COMPILES("int main() { void *d = nullptr; }" HAVE_NULLPTR)
CHECK_CXX_SOURCE_COMPILES("int main() { static_assert(true, \"\"); }" HAVE_STATIC_ASSERT)
@ -337,6 +315,9 @@ set(OC_CLONK_SOURCES
src/landscape/C4MapCreatorS2.cpp
src/landscape/C4MapCreatorS2.h
src/landscape/C4Map.h
src/landscape/C4MapScript.cpp
src/landscape/C4MapScriptAlgo.cpp
src/landscape/C4MapScript.h
src/landscape/C4MassMover.cpp
src/landscape/C4MassMover.h
src/landscape/C4Material.cpp
@ -568,10 +549,6 @@ set(MAPE_SOURCES
src/mape/window.h
)
mark_as_advanced(OC_CLONK_SOURCES)
mark_as_advanced(OC_SYSTEM_SOURCES)
mark_as_advanced(MAPE_SOURCES)
# generated source files
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mape-icons.h
@ -637,23 +614,55 @@ endif()
# source files specific to a GUI library
if(USE_GTK)
list(APPEND OC_CLONK_SOURCES
src/res/Brush.h
src/res/Cursor.h
src/res/Dynamic.h
src/res/Exact.h
src/res/Fill.h
src/res/Halt.h
src/res/Ift.h
src/res/Line.h
src/res/Mouse.h
src/res/NoIft.h
src/res/Picker.h
src/res/Play.h
src/res/Rect.h
src/res/resource.h
src/res/Static.h
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/editor-icons.h
COMMAND
gdk-pixbuf-csource "--raw" "--rle" "--static" "--build-list"
"brush_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Brush_Trans.png"
"halt_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Halt_Trans.png"
"picker_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Picker_Trans.png"
"cursor_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Cursor_Trans.png"
"ift_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Ift_Trans.png"
"play_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Play_Trans.png"
"dynamic_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Dynamic_Trans.png"
"line_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Line_Trans.png"
"rect_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Rect_Trans.png"
"exact_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Exact_Trans.png"
"mouse_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Mouse_Trans.png"
"static_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Static_Trans.png"
"fill_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Fill_Trans.png"
"no_ift_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/NoIft_Trans.png"
> ${CMAKE_CURRENT_BINARY_DIR}/editor-icons.h
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Brush_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Halt_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Picker_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Cursor_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Ift_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Play_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Dynamic_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Line_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Rect_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Exact_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Mouse_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Static_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/Fill_Trans.png
${CMAKE_CURRENT_SOURCE_DIR}/src/res/NoIft_Trans.png
VERBATIM
)
list(APPEND OC_CLONK_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/editor-icons.h)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/oc-icon.h
COMMAND
gdk-pixbuf-csource "--raw" "--rle" "--static" "--build-list"
"oc_icon_pixbuf_data" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico"
> ${CMAKE_CURRENT_BINARY_DIR}/oc-icon.h
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico
VERBATIM
)
list(APPEND OC_CLONK_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/oc-icon.h)
list(APPEND OC_SYSTEM_SOURCES
src/editor/C4ConsoleGTK.cpp
@ -828,8 +837,10 @@ if(MSVC)
endif()
endif()
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg)
include(FindJPEG)
if(NOT USE_CONSOLE)
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg)
include(FindJPEG)
endif()
include(FindPNG)
include(FindZLIB)
include_directories(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
@ -847,10 +858,12 @@ if(NOT WIN32)
endif()
# isilkor 09-05-29: FindFreetype only checks for no-ver and 219
find_library(FREETYPE_LIBRARY NAMES freetype239)
include(FindFreetype)
include_directories(${FREETYPE_INCLUDE_DIRS})
SET(HAVE_FREETYPE ${FREETYPE_FOUND} CACHE INTERNAL "Rename of FREETYPE_FOUND for config.h")
if(NOT USE_CONSOLE)
find_library(FREETYPE_LIBRARY NAMES freetype239 freetype2411)
include(FindFreetype)
include_directories(${FREETYPE_INCLUDE_DIRS})
SET(HAVE_FREETYPE ${FREETYPE_FOUND} CACHE INTERNAL "Rename of FREETYPE_FOUND for config.h")
endif()
# FINDLIB works the same as find_library, but also marks the resulting var as
# advanced so it doesn't show in GUIs by default
@ -902,16 +915,12 @@ if(USE_OPEN_AL)
else()
FINDLIB(OPENAL_LIBRARY NAMES OpenAL32)
endif()
FINDLIB(OGG_LIBRARY NAMES libogg_static)
FINDLIB(VORBIS_LIBRARY NAMES libvorbis_static)
FINDLIB(VORBISFILE_LIBRARY NAMES libvorbisfile_static)
else()
FINDLIB(VORBIS_LIBRARY NAMES vorbis)
FINDLIB(VORBISFILE_LIBRARY NAMES vorbisfile)
FINDLIB(OGG_LIBRARY NAMES ogg)
endif()
FINDLIB(OGG_LIBRARY NAMES libogg_static libogg ogg)
FINDLIB(VORBIS_LIBRARY NAMES libvorbis_static libvorbis vorbis)
FINDLIB(VORBISFILE_LIBRARY NAMES libvorbisfile_static libvorbisfile vorbisfile)
if(NOT APPLE)
FINDLIB(ALUT_LIBRARY NAMES alut)
FINDLIB(ALUT_LIBRARY NAMES alut_static alut)
endif()
endif()
@ -1111,6 +1120,9 @@ target_link_libraries(c4script
libmisc
)
if(HAVE_PTHREAD)
target_link_libraries(openclonk
pthread
)
target_link_libraries(netpuncher
pthread
)
@ -1125,7 +1137,6 @@ if(HAVE_PTHREAD)
endif()
if(USE_CONSOLE)
target_link_libraries(openclonk
pthread
${READLINE_LIBRARIES}
)
endif()
@ -1229,9 +1240,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
option(USE_GCC_PCH "Use GCC precompiled headers" ON)
endif()
if(USE_GCC_PCH)
add_precompiled_header(libmisc src/C4Include.h)
add_precompiled_header(libc4script src/C4Include.h)
add_precompiled_header(openclonk src/C4Include.h)
add_precompiled_header(c4group src/C4Include.h)
add_precompiled_header(c4script src/C4Include.h)
endif()
############################################################################
@ -1252,6 +1263,9 @@ if (APPLE)
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")
SET_TARGET_PROPERTIES(libmisc PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
SET_TARGET_PROPERTIES(libmisc PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
SET_TARGET_PROPERTIES(libmisc PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
SET_TARGET_PROPERTIES(openclonk PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
if (USE_APPLE_CLANG)
@ -1310,6 +1324,14 @@ if(USE_GL)
include_directories(${GLEW_INCLUDE_DIR})
endif()
if(USE_DIRECTX)
if(EXISTS $ENV{DXSDK_DIR})
list(APPEND CMAKE_INCLUDE_PATH $ENV{DXSDK_DIR}/Include)
if(CMAKE_CL_64)
list(APPEND CMAKE_LIBRARY_PATH $ENV{DXSDK_DIR}/Lib/x64)
else()
list(APPEND CMAKE_LIBRARY_PATH $ENV{DXSDK_DIR}/Lib/x86)
endif()
endif()
FINDLIB(DIRECT3D_LIBRARIES d3d9)
FINDLIB(DIRECT3DX_LIBRARIES d3dx9)
FIND_PATH(DIRECT3D_INCLUDE_DIR NAMES d3d9.h)
@ -1384,6 +1406,8 @@ if (WIN32)
set(HAVE_FMOD FALSE)
endif()
endif()
else()
SET(HAVE_FMOD FALSE)
endif()
if(NOT HAVE_FMOD AND NOT USE_OPEN_AL OR USE_SDL_MAINLOOP AND NOT USE_OPEN_AL)
include(FindSDL)
@ -1425,7 +1449,7 @@ endif()
# extracting the correct size from oc.ico. Currently this is layer 2 - let's
# hope that it stays this way.
# Only allow installation for WITH_AUTOMATIC_UPDATE because otherwise
# Don't allow installation for WITH_AUTOMATIC_UPDATE because otherwise
# the installed binary wouldn't find its game data in the system data path.
IF(WITH_AUTOMATIC_UPDATE)
INSTALL(CODE "MESSAGE(SEND_ERROR \"Installation is only supported for WITH_AUTOMATIC_UPDATE disabled\")")
@ -1438,22 +1462,24 @@ install(
CODE
"execute_process(
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target data
)"
)
)"
)
FIND_PACKAGE(ImageMagick COMPONENTS convert)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/openclonk.png
COMMAND convert "${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico[2]" "${CMAKE_CURRENT_BINARY_DIR}/openclonk.png"
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico
VERBATIM
if(ImageMagick_convert_FOUND)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/openclonk.png
COMMAND "${ImageMagick_convert_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico[2]" "${CMAKE_CURRENT_BINARY_DIR}/openclonk.png"
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/res/oc.ico
VERBATIM
)
add_custom_target(icon DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/openclonk.png)
add_dependencies(data icon)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/openclonk.png
DESTINATION share/icons/hicolor/48x48/apps
add_custom_target(icon DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/openclonk.png)
add_dependencies(data icon)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/openclonk.png
DESTINATION share/icons/hicolor/48x48/apps
)
endif()
set(OC_C4GROUPS
Graphics.ocg
@ -1523,7 +1549,7 @@ add_custom_command(
)
add_custom_target(setup
DEPENDS setup_openclonk.exe
DEPENDS setup_openclonk.exe groups
)
############################################################################

View File

@ -80,7 +80,8 @@ do_subst = sed -e 's,[@]C4PROJECT[@],'"$$(sed -n 's/SET(C4PROJECT\s\+"\(.\+\)")/
-e 's,[@]C4XVER3[@],'"$$(sed -n 's/SET(C4XVER3\s\+\(.\+\))/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4XVER4[@],'"$$(sed -n 's/SET(C4XVER4\s\+\(.\+\))/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4VERSIONBUILDNAME[@],'"$$(sed -n 's/SET(C4VERSIONBUILDNAME\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4VERSIONEXTRA[@],'"$$(sed -n 's/SET(C4VERSIONEXTRA\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g'
-e 's,[@]C4VERSIONEXTRA[@],'"$$(sed -n 's/SET(C4VERSIONEXTRA\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]OC_BUILD_ID[@],,g'
C4Version.h: $(srcdir)/src/C4Version.h.in $(srcdir)/Version.txt
$(do_subst) < $< > $@
@ -348,6 +349,9 @@ src/landscape/C4LandscapeRender.h \
src/landscape/C4Map.cpp \
src/landscape/C4MapCreatorS2.cpp \
src/landscape/C4MapCreatorS2.h \
src/landscape/C4MapScript.cpp \
src/landscape/C4MapScriptAlgo.cpp \
src/landscape/C4MapScript.h \
src/landscape/C4Map.h \
src/landscape/C4MassMover.cpp \
src/landscape/C4MassMover.h \
@ -556,6 +560,7 @@ src/platform/C4WindowSDL.cpp
else
if GTK
openclonk_SOURCES += \
editor-icons.h oc-icon.h \
src/editor/C4ConsoleGTK.cpp \
src/editor/C4ConsoleGTKDlg.cpp \
src/editor/C4ConsoleGTKDlg.h \
@ -637,6 +642,46 @@ openclonk_LDADD = \
.rc.o:
$(WINDRES) -I $(srcdir)/src/res -I $(builddir) -i $< -o $@
if GTK
editor-icons.h: \
src/res/Brush_Trans.png \
src/res/Halt_Trans.png \
src/res/Picker_Trans.png \
src/res/Cursor_Trans.png \
src/res/Ift_Trans.png \
src/res/Play_Trans.png \
src/res/Dynamic_Trans.png \
src/res/Line_Trans.png \
src/res/Rect_Trans.png \
src/res/Exact_Trans.png \
src/res/Mouse_Trans.png \
src/res/Static_Trans.png \
src/res/Fill_Trans.png \
src/res/NoIft_Trans.png
gdk-pixbuf-csource --raw --rle --static --build-list \
brush_pixbuf_data "$(srcdir)/src/res/Brush_Trans.png" \
halt_pixbuf_data "$(srcdir)/src/res/Halt_Trans.png" \
picker_pixbuf_data "$(srcdir)/src/res/Picker_Trans.png" \
cursor_pixbuf_data "$(srcdir)/src/res/Cursor_Trans.png" \
ift_pixbuf_data "$(srcdir)/src/res/Ift_Trans.png" \
play_pixbuf_data "$(srcdir)/src/res/Play_Trans.png" \
dynamic_pixbuf_data "$(srcdir)/src/res/Dynamic_Trans.png" \
line_pixbuf_data "$(srcdir)/src/res/Line_Trans.png" \
rect_pixbuf_data "$(srcdir)/src/res/Rect_Trans.png" \
exact_pixbuf_data "$(srcdir)/src/res/Exact_Trans.png" \
mouse_pixbuf_data "$(srcdir)/src/res/Mouse_Trans.png" \
static_pixbuf_data "$(srcdir)/src/res/Static_Trans.png" \
fill_pixbuf_data "$(srcdir)/src/res/Fill_Trans.png" \
no_ift_pixbuf_data "$(srcdir)/src/res/NoIft_Trans.png" \
> $@
oc-icon.h: src/res/oc.ico
gdk-pixbuf-csource --raw --rle --static --build-list oc_icon_pixbuf_data "$(srcdir)/src/res/oc.ico" > $@
BUILT_SOURCES += editor-icons.h oc-icon.h
CLEANFILES += editor-icons.h oc-icon.h
endif
## c4group
c4group_SOURCES = \
src/lib/C4SimpleLog.cpp \
src/c4group/C4GroupMain.cpp
@ -708,11 +753,8 @@ c4script_LDADD = \
$(LDADD) \
$(Z_LIBS)
if WIN32
c4script_LDADD += -lwinmm
endif
## mape
if MAPE
mape_SOURCES = \
mape-icons.h \
src/landscape/C4MapCreatorS2.cpp \
@ -801,6 +843,7 @@ mape-icons.h: $(mape_icons)
> $@
BUILT_SOURCES += mape-icons.h
CLEANFILES += mape-icons.h
endif
## documentation
dist_doc_DATA = planet/AUTHORS planet/COPYING licenses/LGPL.txt Credits.txt

View File

@ -0,0 +1,20 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2013 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.
include(CheckCXXSourceCompiles)
macro(REQUIRE_CXX_SOURCE_COMPILES _code _var)
CHECK_CXX_SOURCE_COMPILES("${_code}" ${_var})
if(NOT ${_var})
unset(${_var} CACHE)
MESSAGE(FATAL_ERROR "${_var} is required for this project to build properly. Aborting.")
endif()
endmacro()

View File

@ -1,8 +1,15 @@
# Notable targets:
# all (default): German and English onlinedocs
# online-en: only English onlinedocs, which can be partially updated
# Enwickler.chm: the German offline doc
# use with make Entwickler.chm HHC = /path/to/hhc
# German and English online docs:
# make all
# make install prefix=/path/to/webspace
# The offline docs:
# make chm HHC=/path/to/hhc.exe
# Only English online docs, which can be partially updated:
# make online-en
# The English offline doc:
# make chm/en/Developer.chm HHC=/path/to/hhc.exe
# XML syntax check:
# make check
# Extra Parameters for xsltproc can be given in the XSLTFLAGS variable.
# Use prefix to select the directory where the docs are to be installed
@ -56,7 +63,7 @@ install: all
$(CP_R) online/* $(prefix)
check:
xmllint --noblanks --noout --valid $(xmlfiles)
@xmllint --noblanks --noout --valid $(xmlfiles)
clean:
rm -f *.mo Entwickler.chm Developer.chm doku.pot sdk/content.xml
@ -122,7 +129,7 @@ $(addprefix chm/de/, $(extra-files-chm)): chm/de/%: %
$(CP) $< $@
chm/en/Developer.chm: chm/en/Output.hhp chm/en/Output.hhk chm/en/Output.hhc $(addprefix chm/en/, $(sdk-dirs) images $(htmlfiles) $(extra-files-chm))
"$(HHC)" $<
! "$(HHC)" $<
chm/de/Entwickler.chm: chm/de/Output.hhp chm/de/Output.hhk chm/de/Output.hhc $(addprefix chm/de/, $(sdk-dirs) images $(htmlfiles) $(extra-files-chm))
"$(HHC)" $<
! "$(HHC)" $<

View File

@ -4,7 +4,7 @@ This section explains how to build the German and English HTML-documentation fro
In Linux, it should be as easy as: Open the console and run make in this directory.
In Windows, you ned Python and Cygwin. During the Cygwin installation, select these additional libraries to install:
In Windows, you need Python and Cygwin. During the Cygwin installation, select these additional libraries to install:
+ make
+ xsltproc (libxml2 + libxslt + python-libxml2)
+ findutils
@ -12,7 +12,8 @@ In Windows, you ned Python and Cygwin. During the Cygwin installation, select th
+ gettext
+ gettext-devel
+ libgcrypt + libgpg-error (for whatever reason)
Also you might have to rename find.exe, so that the cygwin provided one is used - first in Windows\System32\dllback then in Windows\System32 to make sure it isn't used.
After the installation, run cygwin, cd to this directory (/cygdrive/c/.../openclonk/docs/) and run make. The process takes about ten minutes to complete.
The online version of the documentation has been generated into the online/ directory.
After the installation, run cygwin, cd to this directory (/cygdrive/c/.../openclonk/docs/) and run make. The process takes a few minutes to complete.
The online version of the documentation has been generated into the online/ directory.
To build the .chm files, install the html help compiler from http://www.microsoft.com/en-us/download/details.aspx?id=21138 or http://go.microsoft.com/fwlink/?LinkId=14188 and run make chm HHC=/path/to/hhc.exe

View File

@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import sys
import xml.sax
from xml.sax.saxutils import escape, quoteattr
import experimental
class ClonkEntityResolver(xml.sax.handler.EntityResolver):
@ -125,11 +126,11 @@ class Clonkparser(xml.sax.handler.ContentHandler):
def printfunctions(f, _):
def folder(name):
f.write("<li>" + name + "\n<ul>\n")
f.write("<li>" + escape(name) + "\n<ul>\n")
def sheet(url, name):
f.write("<li><emlink href='" + url[4:] + "'>" + name + "</emlink></li>\n")
f.write("<li><emlink href=" + quoteattr(url[4:]) + ">" + escape(name) + "</emlink></li>\n")
def sheetE(url, name):
f.write("<li><emlink href='" + url[4:] + "'>" + name + "</emlink> (extended)</li>\n")
f.write("<li><emlink href=" + quoteattr(url[4:]) + ">" + escape(name) + "</emlink> (extended)</li>\n")
folder("Functions by Category")
cats = parser.cats.keys()
cats.sort()
@ -153,9 +154,9 @@ def printfunctions(f, _):
def printindex(f, _):
def folder(name):
f.write("<li class='index'>" + name + "\n<ul>\n")
f.write("<li class='index'>" + escape(name) + "\n<ul>\n")
def sheet(url, name):
f.write("<li><emlink href='" + url[4:] + "'>" + name.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;') + "</emlink></li>\n")
f.write("<li><emlink href=" + quoteattr(url[4:]) + ">" + escape(name) + "</emlink></li>\n")
folder("Index")
titles = parser.files.keys()
titles.sort(key=unicode.lower)

View File

@ -23,58 +23,68 @@
<!ELEMENT remark (#PCDATA | br | ul | li | table | %text;)*>
<!ELEMENT examples (example+)>
<!ELEMENT example (code | text)*>
<!ELEMENT code (#PCDATA | funclink | emlink | em | strong)*>
<!ELEMENT code (#PCDATA | funclink | emlink | em | i | strong)*>
<!ATTLIST code
id CDATA #IMPLIED>
<!ELEMENT i (#PCDATA)>
<!ELEMENT text (#PCDATA | br | ul | li | table | %text;)*>
<!ATTLIST text
id CDATA #IMPLIED>
<!ELEMENT related (funclink | emlink)+>
<!ELEMENT funclink (#PCDATA)>
<!ELEMENT emlink (#PCDATA)>
<!ELEMENT emlink (#PCDATA | %text;)*>
<!ATTLIST emlink href CDATA #REQUIRED>
<!ELEMENT author (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT search EMPTY>
<!ELEMENT doc (title, (h | text | dl | part | code | author | date | img | search)*)>
<!ELEMENT part (h | text | part | code | dl | search)*>
<!ELEMENT doc (title, (h | text | table | part | code | dl | ul | img | search | examples)+, related?, (author, date?)+)>
<!ELEMENT part ((h | text | table | part | code | dl | ul | img | search | examples)+, related?)>
<!ELEMENT h (#PCDATA | %text;)*>
<!ATTLIST h
id CDATA #IMPLIED>
<!ELEMENT br EMPTY>
<!ELEMENT table (#PCDATA | caption | rowh | row | bitmask)*>
<!ELEMENT caption (#PCDATA)>
<!ATTLIST caption
id ID #IMPLIED>
id CDATA #IMPLIED>
<!ELEMENT row (#PCDATA | col | literal_col)*>
<!ATTLIST row
id ID #IMPLIED>
id CDATA #IMPLIED>
<!ELEMENT rowh (#PCDATA | col | literal_col)*>
<!ELEMENT col (#PCDATA | %text;)*>
<!ELEMENT col (#PCDATA | table | text | %text;)*>
<!ATTLIST col
id CDATA #IMPLIED
colspan CDATA #IMPLIED>
<!ELEMENT literal_col (#PCDATA | %text;)*>
<!ELEMENT literal_col (#PCDATA | table | text | %text;)*>
<!ATTLIST literal_col
colspan CDATA #IMPLIED>
<!ELEMENT bitmask (#PCDATA)>
<!ELEMENT ul (#PCDATA | li)*>
<!ELEMENT li (#PCDATA | br | %text;)*>
<!ELEMENT li (#PCDATA | br | table | text | %text;)*>
<!ATTLIST li
id CDATA #IMPLIED>
<!ELEMENT dl (#PCDATA | dd | dt)*>
<!ELEMENT dt (#PCDATA | br | %text;)*>
<!ATTLIST dt
id ID #IMPLIED>
id CDATA #IMPLIED>
<!ELEMENT dd (#PCDATA | text | code)*>
<!ELEMENT em (#PCDATA)>
<!ELEMENT strong (#PCDATA)>
<!ELEMENT h (#PCDATA)>
<!ATTLIST h
id ID #IMPLIED>
<!ELEMENT img EMPTY>
<!ATTLIST img
src CDATA #REQUIRED
width CDATA "0"
height CDATA "0"
id ID #IMPLIED>
alt CDATA #IMPLIED
class CDATA #IMPLIED
width CDATA #IMPLIED
height CDATA #IMPLIED
id CDATA #IMPLIED>
<!ELEMENT a (#PCDATA)>
<!ATTLIST a

View File

@ -350,11 +350,13 @@
</xsl:template>
<xsl:template match="search">
<form action="../search.php" method="get">
<input name="search" type="text"></input>
<input type="submit" name="func" value="Search"></input>
<input type="submit" name="fulltext" value="Fulltext"></input>
</form>
<xsl:if test="not($chm)">
<form action="../search.php" method="get">
<input name="search" type="text"></input>
<input type="submit" name="func" value="Search"></input>
<input type="submit" name="fulltext" value="Fulltext"></input>
</form>
</xsl:if>
</xsl:template>
<xsl:template match="table/bitmask">

19962
docs/de.po

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
<doc>
<title>Command Line Parameters</title>
<h>Command Line Parameters</h>
<text>The installation directory of Clonk contains various executable program files. Usually programs are started with a double click or from a start menu without additional parameters. When starting programs from a command line shell or script file (batch file), additional command line parameters can be specified.</text>
<text>The installation directory of OpenClonk contains various executable program files. Usually programs are started with a double click or from a start menu without additional parameters. When starting programs from a command line shell or script file (batch file), additional command line parameters can be specified.</text>
<part>
<h id="Clonk">Clonk.exe (Windows) clonk (Linux) Clonk (Mac)</h>
<h id="Clonk">openclonk.exe (Windows) openclonk (Linux) Openclonk (Mac)</h>
<text>The engine. The main program of the game. Without startup parameters, the game starts in fullscreen (player mode) and shows the startup menu. The following command line parameters are recognized:</text>
<dl>
<dt id="editor">--editor</dt>
@ -82,7 +82,7 @@
</dd>
<dt id="recdump">--recdump=&lt;<em>Filename</em>&gt;</dt>
<dd>
<text>Only for replay of recorded games: Before the replay is started, all replay data (player controls) are dumped into a file called &lt;<em>File name</em>&gt; in the Clonk folder. If the file name extension is .txt, the controls will be dumped in text mode, otherwise binary. The replay file must be specified separately as a scenario file (e.g. Clonk.exe Records.ocf/Record001.ocs --recdump=CtrlRec.txt).</text>
<text>Only for replay of recorded games: Before the replay is started, all replay data (player controls) are dumped into a file called &lt;<em>File name</em>&gt; in the Clonk folder. If the file name extension is .txt, the controls will be dumped in text mode, otherwise binary. The replay file must be specified separately as a scenario file (e.g. openclonk.exe Records.ocf/Record001.ocs --recdump=CtrlRec.txt).</text>
</dd>
<dt id="startup">--startup=&lt;<em>Name</em>&gt;</dt>
<dd>
@ -108,7 +108,7 @@
</part>
<part>
<h id="C4Group">c4group.exe (Windows) c4group (Linux) c4group (Mac)</h>
<text>This command line program is used for processing group files. A list of command line options is available by starting the program without parameters via command line (<i>not</i> by double clicking).</text>
<text>This command line program is used for processing group files. A list of command line options is available by starting the program without parameters via command line (<em>not</em> by double clicking).</text>
</part>
<author>Sven2</author><date>2007-02</date>
<author>Günther</author><date>2011</date>

View File

@ -6,7 +6,7 @@
<title>Object Categories</title>
<h>Object Categories</h>
<part>
<text>An object's category specifies parts of its behavior. For a definition it is set by the Category entry in the DefCore.txt file. Multiple categories can be combined using the binary OR operator.</text>
<text>An object's category specifies parts of its behavior. For a definition it is set by the <code id="Category">Category</code> entry in the DefCore.txt file. Multiple categories can be combined using the binary OR operator.</text>
<text>
<table>
<rowh>
@ -71,15 +71,13 @@
</row>
</table>
</text>
<h id="Beispiel">Example</h>
<text>
<examples>
<example>
<code>Category=C4D_StaticBack|C4D_Rule</code>
<text>Category for a rule.</text>
</example>
</examples>
</text>
<h>Example</h>
<examples>
<example>
<code>Category=C4D_StaticBack|C4D_Rule</code>
<text>Category for a rule.</text>
</example>
</examples>
</part>
<author>Sven2</author><date>2006-05</date>
<author>Newton</author><date>2005-01</date>

View File

@ -5,7 +5,7 @@
<doc>
<title>CNAT - Contact Attachment</title>
<h>CNAT - Contact Attachment</h>
<text>In multiple places the engine uses ContactAttachment values (a bitmask) to manage the orientation of objects and processes. For example, a vertex of an object can have the CNAT bit <em>left</em>. If that object has <emlink href="definition/defcore.html">ContactCalls</emlink> activated, the engine calls on every contact of that vertex with the landscape the object script function <em>ContactLeft</em>. CNAT values are composed of the following bits:</text>
<text>In multiple places the engine uses ContactAttachment values (a bitmask) to manage the orientation of objects and processes. For example, a vertex of an object can have the <code id="CNAT">CNAT</code> bit <em>left</em>. If that object has <emlink href="definition/defcore.html">ContactCalls</emlink> activated, the engine calls on every contact of that vertex with the landscape the object script function <em>ContactLeft</em>. CNAT values are composed of the following bits:</text>
<text>
<table>
<rowh>

View File

@ -6,7 +6,7 @@
<title>Meshes</title>
<h>Meshes</h>
<part>
<text>It is possible to directly use 3D models (meshes) as object graphics. To do so they need to be in OGRE format. For most modeling tools there exist exporter tools, a list can be found on the <a href="http://www.ogre3d.org/wiki/index.php/Exporters">OGRE Wiki</a>. Both the OGRE binary format (*.mesh) and the OGRE XML format(*.mesh.xml) are supported, however it is recommended to always use the binary format whenever possible since it is smaller in size and can be loaded more quickly by the engine. The tool <a href="http://www.ogre3d.org/wiki/index.php/OgreXmlConverter">OgreXMLConverter</a> can convert between the two formats.</text>
<text>It is possible to directly use 3D models (meshes) as object graphics. To do so they need to be in OGRE format. For most modeling tools there exist exporter tools, a list can be found on the <a href="http://www.ogre3d.org/tikiwiki/tiki-index.php?page=OGRE%20Exporters">OGRE Wiki</a>. Both the OGRE binary format (*.mesh) and the OGRE XML format(*.mesh.xml) are supported, however it is recommended to always use the binary format whenever possible since it is smaller in size and can be loaded more quickly by the engine. The tool <a href="http://www.ogre3d.org/tikiwiki/tiki-index.php?page=OgreXmlConverter">OgreXMLConverter</a> can convert between the two formats.</text>
<text>The exporter normally creates a mesh file (*.mesh or *.mesh.xml), a skeleton file (*.skeleton or *.skeleton.xml) if the mesh contains bones, a material script (*.material) and potentially used textures. To use the mesh as a Clonk object all generated files need to be copied into the <emlink href="definition/index.html">object definition</emlink> and the mesh file needs to be renamed to Graphics.mesh or Graphics.mesh.xml, respectively. Textures are supported in PNG, JPG and BMP format.</text>
<text>The mesh is not automatically scaled to the shape (i.e. the width and height values specified in <emlink href="definition/defcore.html">DefCore.txt</emlink>) of the object. Instead one unit in the modeling tool corresponds to one pixel in Clonk. This simplifies using the same magnitude of object sizes for all objects which is especially helpful for attaching meshes (see below). Also pay attention to the coordinate frame: The X axis in the mesh coordinate frame points out of the screen in Clonk, the Y axis points to the right and the Z axis points upwards.</text>
<h id="MaterialScripts">Material scripts</h>

View File

@ -38,7 +38,7 @@
<col>Behaviour according to <emlink href="definition/actmap.html">activity</emlink>.</col>
<col>CNAT_Bottom</col>
</row>
<row iD="SCALE">
<row id="SCALE">
<col>SCALE</col>
<col>Scaling a wall</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
@ -101,7 +101,7 @@
<row id="CONNECT">
<col>CONNECT</col>
<col>Line connections</col>
<col>Only <emlink href="definition/lineconnect.html">line objects</emlink>. Connects <emlink href="script/fn/SetAction.html">target object 1</emlink> and <emlink href="script/fn/SetAction.html">target object 2</emlink>.</col>
<col>Only <emlink href="definition/lineconnect.html">line objects</emlink>. Connects <emlink href="script/fn/SetAction.html">target object 1</emlink> and <emlink href="script/fn/SetAction.html">target object 2</emlink>. If property LineMaxDistance is a nonzero integer, the line breaks when the target objects are further apart than the given distance.</col>
<col>CNAT_None</col>
</row>
<row id="PULL">

View File

@ -158,7 +158,7 @@
</text>
<text>The image is always stretched to the full available screen area. All coordinates given for section elements are relative to the unstretched background image.</text>
<h id="devel">Useful Hints</h>
<text>For testing purposes a folder map can be loaded from an unpacked scenario folder and reloaded an runtime using F5. If the classic scenario selection appears instead of the folder map, an error has occured in the folder map declaration, such as missing image files. With debug mode activated, there will also be an error message in Clonk.log.</text>
<text>For testing purposes a folder map can be loaded from an unpacked scenario folder and reloaded an runtime using F5. If the classic scenario selection appears instead of the folder map, an error has occured in the folder map declaration, such as missing image files. With debug mode activated, there will also be an error message in OpenClonk.log.</text>
</part>
<author>Sven2</author><date>2006-09</date>
</doc>

View File

@ -12,255 +12,247 @@
<part>
<h id="ControlDefs">Section [ControlDefs]</h>
<text>
Definition of possible player commands. Subordinated to this section:
<text>
<table>
<caption id="ControlDef">Any number of sections [ControlDef]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Identifier</literal_col>
<col>String (max. 96 chars)</col>
<col>Internally used name for identification of the command. The command is referenced by that name in standard mappings and it is predefined in script as CON_Name. The name should therefore be a valid identifier in script, i.e. only consist of letters, numbers and _. Especially there should be no space characters or German umlauts. To avoid conflicts the same rules as for object IDs apply for definitions local to a certain scenario or object.</col>
</row>
<row>
<literal_col>GUIName</literal_col>
<col>String</col>
<col>Name which is shown to the player in the control configuration dialog and in control tooltips. Localized strings from the corresponding string table can be used ($Name$).</col>
</row>
<row>
<literal_col>GUIDesc</literal_col>
<col>String</col>
<col>Informative description which is displayed to the player in the control configuration dialog. Localized strings from the corresponding string table can be used ($Desc$).</col>
</row>
<row>
<literal_col>Global</literal_col>
<col>Boolean</col>
<col>If true this is a global definition, i.e. not assigned to a particular player. See <emlink href="playercontrols.xml#Globals">Global definitions</emlink>.</col>
</row>
<row>
<literal_col>Hold</literal_col>
<col>Boolean</col>
<col>If true this command is interpreted as a held command. Such a command remembers whether the control key is pressed and generates another scripting event when it is released. See <emlink href="playercontrols.xml#Hold">Held keys</emlink>.</col>
</row>
<row>
<literal_col>RepeatDelay</literal_col>
<col>Integer</col>
<col>Only valid if <em>Hold</em> is true. If greater than 0 then this key generates additional scripting events while pressed every that many number of frames. See <emlink href="playercontrols.xml#Repeat">Key repeats</emlink>.</col>
</row>
<row>
<literal_col>InitialRepeatDelay</literal_col>
<col>Integer</col>
<col>If specified then the delay of the first key repeat event can be changed. See <emlink href="playercontrols.xml#Repeat">Key repeats</emlink>.</col>
</row>
<row>
<literal_col>DefaultDisabled</literal_col>
<col>Boolean</col>
<col>If true then the command is deactivated in the normal case and needs to be activated by script first. This is useful for commands that are only required in special situations. See <emlink href="playercontrols.xml#Deactivate">Deactivated commands</emlink>.</col>
</row>
<row>
<literal_col>ExtraData</literal_col>
<col>C4ID</col>
<col>Optional ID that is passed to the script function. See <emlink href="playercontrols.xml#ExtraData">ExtraData</emlink>.</col>
</row>
<row>
<literal_col>SendCursorPos</literal_col>
<col>Boolean</col>
<col>If true then the GUI mouse position at the time of triggering the command will be sent as a separate CON_CursorPos command. If the mouse is not activated then the cursor position in GUI coordinates is transmitted.</col>
</row>
<row>
<literal_col>Action</literal_col>
<col>String</col>
<col>
Action to be executed for this command. Possible values:
<text>
<table>
<rowh>
<col>Value</col>
<col>Description</col>
</rowh>
<row>
<literal_col>None</literal_col>
<col>No action.</col>
</row>
<row>
<literal_col>Script</literal_col>
<col>Execution of the script function <em>PlayerControl</em>. See <emlink href="playercontrols.xml#Script">Script callbacks</emlink>. (Default value)</col>
</row>
<row>
<literal_col>ZoomIn</literal_col>
<col>Zoom in one unit</col>
</row>
<row>
<literal_col>ZoomOut</literal_col>
<col>Zoom out one unit</col>
</row>
<row>
<literal_col>Menu</literal_col>
<col>Open the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>MenuOK</literal_col>
<col>Confirmation of the selected item in the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>MenuCancel</literal_col>
<col>Close the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>MenuLeft / MenuUp / MenuRight / MenuDown</literal_col>
<col>Navigation in the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>ObjectMenuOK / ObjectMenuSelect / ObjectMenuOKAll</literal_col>
<col>Confirmation of the selected item in a menu (synchronous command).</col>
</row>
<row>
<literal_col>ObjectMenuCancel</literal_col>
<col>Close a menu (synchronous command).</col>
</row>
<row>
<literal_col>ObjectMenuLeft / ObjectMenuUp / ObjectMenuRight / ObjectMenuDown</literal_col>
<col>Navigation in a menu (synchronous command).</col>
</row>
</table>
</text>
</col>
</row>
</table>
</text>
Definition of possible player commands. Subordinated to this section:
</text>
<h id="ControlSets">Section [ControlSets]</h>
<text>
Definition of standard control mappings.
<text>
<table>
<caption id="ControlSet">Any number of sections [ControlSet]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Name</literal_col>
<col>String</col>
<col>Internal name for identification of otherwise equal control mappings. By using placeholders (*) keys can directly be defined in multiple mappings.</col>
</row>
<row>
<literal_col>GUIName</literal_col>
<col>String</col>
<col>Name for the control assignment set which is shown to the player in the control configuration dialog.</col>
</row>
<row>
<literal_col>Keyboard</literal_col>
<col>Boolean</col>
<col>Whether this control assignment set uses the keyboard. Default 1.</col>
</row>
<row>
<literal_col>Mouse</literal_col>
<col>Boolean</col>
<col>Whether this control assignment set uses the mouse. Default 1.</col>
</row>
<row>
<literal_col>Gamepad</literal_col>
<col>Boolean</col>
<col>Whether this control assignment set uses the gamepad. Default 0.</col>
</row>
</table>
<text>
<table>
<caption id="ControlDef">Any number of sections [ControlDef]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Identifier</literal_col>
<col>String (max. 96 chars)</col>
<col>Internally used name for identification of the command. The command is referenced by that name in standard mappings and it is predefined in script as CON_Name. The name should therefore be a valid identifier in script, i.e. only consist of letters, numbers and _. Especially there should be no space characters or German umlauts. To avoid conflicts the same rules as for object IDs apply for definitions local to a certain scenario or object.</col>
</row>
<row>
<literal_col>GUIName</literal_col>
<col>String</col>
<col>Name which is shown to the player in the control configuration dialog and in control tooltips. Localized strings from the corresponding string table can be used ($Name$).</col>
</row>
<row>
<literal_col>GUIDesc</literal_col>
<col>String</col>
<col>Informative description which is displayed to the player in the control configuration dialog. Localized strings from the corresponding string table can be used ($Desc$).</col>
</row>
<row>
<literal_col>Global</literal_col>
<col>Boolean</col>
<col>If true this is a global definition, i.e. not assigned to a particular player. See <emlink href="playercontrols.xml#Globals">Global definitions</emlink>.</col>
</row>
<row>
<literal_col>Hold</literal_col>
<col>Boolean</col>
<col>If true this command is interpreted as a held command. Such a command remembers whether the control key is pressed and generates another scripting event when it is released. See <emlink href="playercontrols.xml#Hold">Held keys</emlink>.</col>
</row>
<row>
<literal_col>RepeatDelay</literal_col>
<col>Integer</col>
<col>Only valid if <em>Hold</em> is true. If greater than 0 then this key generates additional scripting events while pressed every that many number of frames. See <emlink href="playercontrols.xml#Repeat">Key repeats</emlink>.</col>
</row>
<row>
<literal_col>InitialRepeatDelay</literal_col>
<col>Integer</col>
<col>If specified then the delay of the first key repeat event can be changed. See <emlink href="playercontrols.xml#Repeat">Key repeats</emlink>.</col>
</row>
<row>
<literal_col>DefaultDisabled</literal_col>
<col>Boolean</col>
<col>If true then the command is deactivated in the normal case and needs to be activated by script first. This is useful for commands that are only required in special situations. See <emlink href="playercontrols.xml#Deactivate">Deactivated commands</emlink>.</col>
</row>
<row>
<literal_col>ExtraData</literal_col>
<col>C4ID</col>
<col>Optional ID that is passed to the script function. See <emlink href="playercontrols.xml#ExtraData">ExtraData</emlink>.</col>
</row>
<row>
<literal_col>SendCursorPos</literal_col>
<col>Boolean</col>
<col>If true then the GUI mouse position at the time of triggering the command will be sent as a separate CON_CursorPos command. If the mouse is not activated then the cursor position in GUI coordinates is transmitted.</col>
</row>
<row>
<literal_col>Action</literal_col>
<col>String</col>
<col>
<text>
Action to be executed for this command. Possible values:
</text>
<table>
<caption id="Assignment">Any number of sections [Assignment]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Key</literal_col>
<col>String</col>
<col>Specifies the key(s) of this mapping or a reference to another mapping. See <emlink href="playercontrols.xml#Keys">Key mappings</emlink>.</col>
<literal_col>None</literal_col>
<col>No action.</col>
</row>
<row>
<literal_col>ComboIsSequence</literal_col>
<col>Boolean</col>
<col>If true then multiple keys are taken as a sequence, i.e. they need to be pressed one after the other instead of all at the same time. See <emlink href="playercontrols.xml#Keys">Key mappings</emlink>.</col>
<literal_col>Script</literal_col>
<col>Execution of the script function <em>PlayerControl</em>. See <emlink href="playercontrols.xml#Script">Script callbacks</emlink>. (Default value)</col>
</row>
<row>
<literal_col>Control</literal_col>
<col>String</col>
<col>Command that is combined with this mapping. The name should be equivalent to the <em>Identifier</em> of a command defined in a <emlink href="playercontrols.xml#ControlDef">[ControlDef]</emlink>.</col>
<literal_col>ZoomIn</literal_col>
<col>Zoom in one unit</col>
</row>
<row>
<literal_col>GUIName</literal_col>
<col>String</col>
<col>Name which is shown to the player in the control configuration dialog and in control tooltips. Localized strings from the corresponding string table can be used ($Name$). If unset, GUIName of the control def is used. If set to "None", the control is not displayed in the user customization dialog even if the control def has a name set.</col>
<literal_col>ZoomOut</literal_col>
<col>Zoom out one unit</col>
</row>
<row>
<literal_col>GUIDesc</literal_col>
<col>String</col>
<col>Informative description which is displayed to the player in the control configuration dialog. Lokalisierte Zeichenketten koennen aus dem zugehoerigen StringTable refeenziert werden ($Name$). If unset, GUIDesc of the control def is used.</col>
<literal_col>Menu</literal_col>
<col>Open the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>GUIGroup</literal_col>
<col>Integer</col>
<col>Control assignments in the same group are displayed grouped together in the control assignment dialog. The group with the lowest number is displayed at the top. Default 0.</col>
<literal_col>MenuOK</literal_col>
<col>Confirmation of the selected item in the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>GUIDisabled</literal_col>
<col>Boolean</col>
<col>Whether this control assignment can not be changed in the control assignment dialog. Default 0.</col>
<literal_col>MenuCancel</literal_col>
<col>Close the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>Priority</literal_col>
<col>Integer</col>
<col>Priority of the mapping. If more than once mapping is using the same keys then the key with the highest priority is executed first until a command is treated as handled.</col>
<literal_col>MenuLeft / MenuUp / MenuRight / MenuDown</literal_col>
<col>Navigation in the player menu (asynchronous command).</col>
</row>
<row>
<literal_col>TriggerMode</literal_col>
<col>bitmask</col>
<col>
Trigger mode of this mapping. Bitmask based on the following values:
<text>
<table>
<rowh>
<col>Value</col>
<col>Description</col>
</rowh>
<row>
<col>Default value</col>
<col>No particular action.</col>
</row>
<row>
<literal_col>Hold</literal_col>
<col>The key changes the state of the command linked to to be held even if the key itself is pressed only shortly. Only valid if the <em>Hold</em> attribute is set for the command. This state remains until a corresponding mapping with trigger mode <em>Release</em> is being pressed. See <emlink href="playercontrols.xml#Hold">Held keys</emlink>.</col>
</row>
<row>
<literal_col>Release</literal_col>
<col>The key removes the held state. A key can have both Hold and Release set to toggle between the two states. See <emlink href="playercontrols.xml#Hold">Held keys</emlink>.</col>
</row>
<row>
<literal_col>AlwaysUnhandled</literal_col>
<col>The key press is always passed to the mapping with the next lowest priority, independent of whether the previous command was executed successfully or not.</col>
</row>
<row>
<literal_col>OverrideAssignments</literal_col>
<col>The assignment overwrites all other assignments for the same control with the same press/release trigger mode.</col>
</row>
</table>
</text>
</col>
<literal_col>ObjectMenuOK / ObjectMenuSelect / ObjectMenuOKAll</literal_col>
<col>Confirmation of the selected item in a menu (synchronous command).</col>
</row>
<row>
<literal_col>ObjectMenuCancel</literal_col>
<col>Close a menu (synchronous command).</col>
</row>
<row>
<literal_col>ObjectMenuLeft / ObjectMenuUp / ObjectMenuRight / ObjectMenuDown</literal_col>
<col>Navigation in a menu (synchronous command).</col>
</row>
</table>
</text>
</text>
</col>
</row>
</table>
<h id="ControlSets">Section [ControlSets]</h>
<text>
Definition of standard control mappings.
</text>
<table>
<caption id="ControlSet">Any number of sections [ControlSet]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Name</literal_col>
<col>String</col>
<col>Internal name for identification of otherwise equal control mappings. By using placeholders (*) keys can directly be defined in multiple mappings.</col>
</row>
<row>
<literal_col>GUIName</literal_col>
<col>String</col>
<col>Name for the control assignment set which is shown to the player in the control configuration dialog.</col>
</row>
<row>
<literal_col>Keyboard</literal_col>
<col>Boolean</col>
<col>Whether this control assignment set uses the keyboard. Default 1.</col>
</row>
<row>
<literal_col>Mouse</literal_col>
<col>Boolean</col>
<col>Whether this control assignment set uses the mouse. Default 1.</col>
</row>
<row>
<literal_col>Gamepad</literal_col>
<col>Boolean</col>
<col>Whether this control assignment set uses the gamepad. Default 0.</col>
</row>
</table>
<table>
<caption id="Assignment">Any number of sections [Assignment]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Key</literal_col>
<col>String</col>
<col>Specifies the key(s) of this mapping or a reference to another mapping. See <emlink href="playercontrols.xml#Keys">Key mappings</emlink>.</col>
</row>
<row>
<literal_col>ComboIsSequence</literal_col>
<col>Boolean</col>
<col>If true then multiple keys are taken as a sequence, i.e. they need to be pressed one after the other instead of all at the same time. See <emlink href="playercontrols.xml#Keys">Key mappings</emlink>.</col>
</row>
<row>
<literal_col>Control</literal_col>
<col>String</col>
<col>Command that is combined with this mapping. The name should be equivalent to the <em>Identifier</em> of a command defined in a <emlink href="playercontrols.xml#ControlDef">[ControlDef]</emlink>.</col>
</row>
<row>
<literal_col>GUIName</literal_col>
<col>String</col>
<col>Name which is shown to the player in the control configuration dialog and in control tooltips. Localized strings from the corresponding string table can be used ($Name$). If unset, GUIName of the control def is used. If set to "None", the control is not displayed in the user customization dialog even if the control def has a name set.</col>
</row>
<row>
<literal_col>GUIDesc</literal_col>
<col>String</col>
<col>Informative description which is displayed to the player in the control configuration dialog. Lokalisierte Zeichenketten koennen aus dem zugehoerigen StringTable refeenziert werden ($Name$). If unset, GUIDesc of the control def is used.</col>
</row>
<row>
<literal_col>GUIGroup</literal_col>
<col>Integer</col>
<col>Control assignments in the same group are displayed grouped together in the control assignment dialog. The group with the lowest number is displayed at the top. Default 0.</col>
</row>
<row>
<literal_col>GUIDisabled</literal_col>
<col>Boolean</col>
<col>Whether this control assignment can not be changed in the control assignment dialog. Default 0.</col>
</row>
<row>
<literal_col>Priority</literal_col>
<col>Integer</col>
<col>Priority of the mapping. If more than once mapping is using the same keys then the key with the highest priority is executed first until a command is treated as handled.</col>
</row>
<row>
<literal_col>TriggerMode</literal_col>
<col>bitmask</col>
<col>
<text>
Trigger mode of this mapping. Bitmask based on the following values:
</text>
<table>
<rowh>
<col>Value</col>
<col>Description</col>
</rowh>
<row>
<col>Default value</col>
<col>No particular action.</col>
</row>
<row>
<literal_col>Hold</literal_col>
<col>The key changes the state of the command linked to to be held even if the key itself is pressed only shortly. Only valid if the <em>Hold</em> attribute is set for the command. This state remains until a corresponding mapping with trigger mode <em>Release</em> is being pressed. See <emlink href="playercontrols.xml#Hold">Held keys</emlink>.</col>
</row>
<row>
<literal_col>Release</literal_col>
<col>The key removes the held state. A key can have both Hold and Release set to toggle between the two states. See <emlink href="playercontrols.xml#Hold">Held keys</emlink>.</col>
</row>
<row>
<literal_col>AlwaysUnhandled</literal_col>
<col>The key press is always passed to the mapping with the next lowest priority, independent of whether the previous command was executed successfully or not.</col>
</row>
<row>
<literal_col>OverrideAssignments</literal_col>
<col>The assignment overwrites all other assignments for the same control with the same press/release trigger mode.</col>
</row>
</table>
</col>
</row>
</table>
</part>
<h id="Script">Script callbacks</h>
<text>To initialize the player control the script function InitializePlayerControl is called for each player. This call might be delayed by a few frames with respect to InitializePlayer since the initialization of the control needs to be transmitted in the network. When continuing savegames InitalizePlayerControl will be called again. The chosen control might be different from the original one. The same can happen if a player chooses to change its controls during the game.</text>

View File

@ -25,6 +25,10 @@
<dt id="Landscapetxt"><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="scenario/MapCreatorS2.html">Landscape.txt</emlink></dt>
<dd>
<text>Advanced scenario designers can use this component to define highly complex, fully random generated dynamic landscapes. This does require certain mathematical skill and some patience, however.</text>
</dd>
<dt id="Scriptc"><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="script/MapScript.html">Map.c</emlink></dt>
<dd>
<text>Script for dynamic generation of map. See <emlink href="script/MapScript.html">map script documentation</emlink>.</text>
</dd>
</dl>

View File

@ -218,7 +218,7 @@
<row>
<literal_col>BottomOpen</literal_col>
<col>Integer</col>
<col>0 or 1. Determines wether the bottom of the game world should be open.</col>
<col>0, 1 or 2. Determines wether the bottom of the game world should be open. 0=Bottom is closed, 1=Bottom is open, 2=Bottom is closed if the corresponding map pixel in the bottom row has tunnel background and open otherwise.</col>
</row>
<row>
<literal_col>TopOpen</literal_col>

View File

@ -9,8 +9,8 @@
<text>The keywords <code>break</code> and <code>continue</code> are used for finer control of loops:</text>
<text>
<ul>
<li><code>break</code> ends the enclosing loop. Execution is continued after the end of the loop.</li>
<li><code>continue</code> ends the current loop execution and continues with the next loop item from the beginning of the loop.</li>
<li id="break"><code>break</code> ends the enclosing loop. Execution is continued after the end of the loop.</li>
<li id="continue"><code>continue</code> ends the current loop execution and continues with the next loop item from the beginning of the loop.</li>
</ul>
</text>
<h>Example:</h>

View File

@ -41,7 +41,7 @@ func MyCall()
<text>The function Activate() in the script of object B will first search for the closest object of type A (definition ID TestObjectA) and store a reference to this object in the variable "obj". Then the function Activate() is called in the script of object A. To do this we first specifiy the variable containing the pointer to the object, followed by an arrow, then the function name including the parameter list (no parameters in this case).</text>
<text>Calling Activate() in object B will cause the closest object of type A to be blown up. You may consider this a very primitive type of remote control. By the way, this script will cause an error if no object of type A can be found. To prevent this, first check whether obj is not <code>nil</code> before calling Activate().</text>
<h>Remarks</h>
<text>You don't <i>have</i> to store the object pointer in a variable as done in this example. You could also continue calling the function directly on the search result as in this case:</text>
<text>You don't <em>have</em> to store the object pointer in a variable as done in this example. You could also continue calling the function directly on the search result as in this case:</text>
<code>func Activate()
{
<funclink>FindObject</funclink>(<funclink>Find_Id</funclink>(TestObjectA), <funclink>Sort_Distance</funclink>())-&gt;Activate();

View File

@ -0,0 +1,476 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Map script</title>
<h>Map script</h>
<part>
<text>Map scripts provide a powerful method to generate diverse, dynamic maps with just a few lines of simple script code. Map scripts can be used to generate new maps, as well as modify existing maps defined as static Map.bmp or dynamic Landscape.txt.</text>
<h>Introduction</h>
<text>A map script is simply a script file called Map.c placed in a scenario. On scenario initialization, the engine calls the local function called InitializeMap in this script. If the function returns true, the map will be used by the engine. If false is returned, the map is discarded and the regular fallback map is created.</text>
<text>Here an example of a simple map script:</text>
<code>/* A simple map */
#include Library_Map
func InitializeMap(proplist map)
{
// Create a big map
Resize(150,150);
// Draw earth
DrawRegularGround();
// Draw some resources into the ground
DrawWaterVeins(3, [0,map.Hgt/3,map.Wdt,map.Hgt*2/3]);
DrawCoal(6);
DrawSulphur(4);
DrawRock(15);
DrawOre(4);
DrawGold(2*GetStartupPlayerCount()); // amount of gold depends on player count!
// Make sure liquids don't border tunnel or sky sideways
FixLiquidBorders();
// Done. Use this map.
return true;
}</code>
<text>This draws a pretty boring standard map with basic resources. It makes use of some high-level helper functions such as DrawRegularGround or DrawCoal. which are included in the definition named Library_Map in Objects.ocd/Libraries.ocd. All map scripts should include this definition.</text>
<h>Layers</h>
<part>
<text>All map draw functions work on layers, which are simply 8 bit image surfaces. The map itself is a layer, but additional layers can be created as temporary buffers using the CreateLayer or Duplicate script functions. Additional layers are bound to the map they were created from and destroyed alongside with it when map drawing is complete.</text>
<text>In C4Script, map layers are represented as prop lists. They have the implicit properties Wdt and Hgt, which contain the width and height of the surface respectively. To resize a map or layer, use the Resize() function. Do not modify Wdt or Hgt directly.</text>
<text>For example, the following code:</text>
<code>var layer = CreateLayer("Earth");
layer->DrawCoal();
Blit(layer, [0,0,layer.Wdt/2,layer.Hgt]);</code>
<text>would create a secondary layer filled with earth. It would then draw coal onto the layer and finally copy only the left half of its contents to the main map.</text>
</part>
<h>Algorithms</h>
<part>
<text>Algorithms are the core concept of dynamic map creation to point drawing operations to specific subregions of the map only. An algorithm is a function that maps a position (int x, int y) to either a pixel color (int) or a mask value (bool).</text>
<text>Algorithms are defined as prop list with the Algo property set to one of the MAPALGO_* constants and additional algorithm parameters set as properties. They can then be passed to one of the drawing functions (Draw or Blit), which will evaluate the algorithm at all positions and draw pixel values accordingly.</text>
<text>For example, the following code would draw rectangles of earth in a checkerboard pattern:</text>
<code>Draw("Earth", {Algo=MAPALGO_RndChecker, Wdt=5, Hgt=5});</code>
<text>In addition to pattern-generating algorithms, there are also modifier algorithms that take other algorithms as parameters. For example, the Turbulence algorithm jumbles all pixels of the underlying algorithm around to create a noisy pattern:</text>
<code>var checkerboard = {Algo=MAPALGO_RndChecker, Wdt=10, Hgt=10};
var jumbled_checkerboard = {Algo=MAPALGO_Turbulence, Amplitude=10, Scale=10};
Draw("Earth", jumbled_checkerboard);</code>
<text>Modifier algorithms can also be applied to layer contents directly. For example, to flip the contents of the current map, one could write:</text>
<code>// Backup contents of current map
var copy_layer = Duplicate();
// Redraw flipped horizontally
Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
</code>
<text>Note: If you are using the target layer in a drawing command, always draw from a copy. Otherwise, the result is undefined.</text>
<h>SCRIPTALGO_Layer</h><part>
<text>Returns the pixel value at the x,y position of the given layer. Instead of passing a SCRIPTALGO_Layer prop list, layers can also be passed directly as algorithms.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Layer</col>
<col></col>
<col>The layer from which pixel values are taken.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_RndChecker</h><part>
<text>Returns values from a checkerboard pattern of rectangles that are filled with ones or zeros.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Seed</col>
<col>Random(65536)</col>
<col>If nonzero, the checkerboard pattern is generated from a fixed seed.</col>
</row><row>
<col>Ratio</col>
<col>50</col>
<col>Percentage of checkerboard fields that are one.</col>
</row><row>
<col>Wdt</col>
<col>10</col>
<col>Width of rectangles.</col>
</row><row>
<col>Hgt</col>
<col>10</col>
<col>Height of rectangles</col>
</row><row>
<col>FixedOffset</col>
<col>false</col>
<col>If true, the pattern always starts at position (0,0). Otherwise, it is offset by a random phase.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Rect</h><part>
<text>Returns one if the position is in a given rectangle and zero otherwise.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>X</col>
<col>0</col>
<col>Left side of rectangle (pixel is included).</col>
</row><row>
<col>Y</col>
<col>0</col>
<col>Top side of rectangle (pixel is included).</col>
</row><row>
<col>Wdt</col>
<col>0</col>
<col>Width of rectangle.</col>
</row><row>
<col>Hgt</col>
<col>0</col>
<col>Height of rectangle.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Ellipsis</h><part>
<text>Returns one if the position is in a given ellipsis and zero otherwise.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>X</col>
<col>0</col>
<col>Horizontal center of ellipsis.</col>
</row><row>
<col>Y</col>
<col>0</col>
<col>Vertical center of ellipsis.</col>
</row><row>
<col>Wdt</col>
<col>10</col>
<col>Horizontal radius of ellipsis.</col>
</row><row>
<col>Hgt</col>
<col>10</col>
<col>Vertical radius of ellipsis</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Polygon</h><part>
<text>Returns one if the position is in a given polygon or on its border and zero otherwise.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>X</col>
<col></col>
<col>Array of x coordinates of polygon points.</col>
</row><row>
<col>Y</col>
<col></col>
<col>Array of y coordinates of polygon points.</col>
</row><row>
<col>Wdt</col>
<col>1</col>
<col>Width of border lines of polygon.</col>
</row><row>
<col>Empty</col>
<col>false</col>
<col>If true, the polygon is not filled and only the border is drawn.</col>
</row><row>
<col>Open</col>
<col>false</col>
<col>If true, the last segment of the polygon is not drawn. Useful to draw lines. Only valid if Empty is true.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_And</h><part>
<text>Returns zero if any of the operands is zero. Otherwise, returns the value of the last operand. If there are zero operands, always returns zero.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Array of algorithms that are tested.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Or</h><part>
<text>Returns the first operand that is nonzero. If all operands are zero, returns zero. If there are zero operands, always returns zero.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Array of algorithms that are tested.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Not</h><part>
<text>Returns one if the operand is zero. Returns zero otherwise.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Algorithms that is negated.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Xor</h><part>
<text>If exactly one of the two operands is nonzero, returns that operand. Otherwise, returns zero.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Array of two algorithms that are tested.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Offset</h><part>
<text>Moves its operand by an offset.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Algorithms that is being manipulated.</col>
</row><row>
<col>OffX</col>
<col>0</col>
<col>Horizontal offset to the right.</col>
</row><row>
<col>OffY</col>
<col></col>
<col>Vertical offset downwards.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Scale</h><part>
<text>Scales its operand by a point.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Algorithms that is being manipulated.</col>
</row><row>
<col>X</col>
<col>100</col>
<col>Horizontal scaling in percent. Values smaller than zero flip the operand horizontally.</col>
</row><row>
<col>Y</col>
<col>100</col>
<col>Vertical scaling in percent. Values smaller than zero flip the operand vertically.</col>
</row><row>
<col>OffX</col>
<col>0</col>
<col>X position of fixed point that remains in position.</col>
</row><row>
<col>OffY</col>
<col>0</col>
<col>Y position of fixed point that remains in position.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Rotate</h><part>
<text>Rotates its operand around a point.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Algorithms that is being manipulated.</col>
</row><row>
<col>R</col>
<col>0</col>
<col>Rotation angle in degrees (0 to 360). Positive values rotate counter-clockwise.</col>
</row><row>
<col>OffX</col>
<col>0</col>
<col>X position of fixed point that remains in position.</col>
</row><row>
<col>OffY</col>
<col>0</col>
<col>Y position of fixed point that remains in position.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Turbulence</h><part>
<text>Jumbles its operand around by moving points by a randomized offset.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Seed</col>
<col>Random(65536)</col>
<col>If nonzero, the offset map is generated from a fixed seed.</col>
</row><row>
<col>Amplitude</col>
<col>10</col>
<col>Maximum range by which pixels may be moved in a single step. Movement in any direction is half of the amplitude. Can be an single integer for equal movement in both dimensions or an array of two integers for separate amplitudes for horizontal and vertical movement.</col>
</row><row>
<col>Scale</col>
<col>10</col>
<col>Distance of points for which the amplitude is randomized. A large scale relative to the amplitude creates more broadly scaled, regular turbulence, while a small scale can cause borders to look more jumpey. Can be an single integer for equal scale in both dimensions or an array of two integers for separate scales horizontally and vertically.</col>
</row><row>
<col>Iterations</col>
<col>2</col>
<col>Number of times each point is pushed around. The amplitude of the n'th successive push is reduced by 1/n.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Border</h><part>
<text>Returns true for positions that lie on an inner or outer border of an operand. An inner border is defined as a position where the operand is nonzero and a position where it is zero lies within inner border width range. An outer border is defined as a position where the operand is zero and a position where it is nonzero lies within outer border width range. Note that borders are only searched in four directions (left, right, upwards, downwards) and not diagonally. This means that for a square, outer borders to not catch the corners.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Algorithm of which the border is to be determined.</col>
</row><row>
<col>Wdt</col>
<col>1</col>
<col>Border width in all directions. Positive integer for inner border; negative integer for outer border. Can also be an array of two integers of opposing signs for inner and outer borders.</col>
</row><row>
<col>Left</col>
<col></col>
<col>Border width to the left side. Definition like Wdt. Falls back to Wdt if not specified.</col>
</row><row>
<col>Top</col>
<col></col>
<col>Border width upwards. Definition like Wdt. Falls back to Wdt if not specified.</col>
</row><row>
<col>Right</col>
<col></col>
<col>Border width to the right side. Definition like Wdt. Falls back to Wdt if not specified.</col>
</row><row>
<col>Bottom</col>
<col></col>
<col>Border width downwards. Definition like Wdt. Falls back to Wdt if not specified.</col>
</row>
</table></text></part>
<h>SCRIPTALGO_Filter</h><part>
<text>Return only pixel values of the operand that match the mask specification. Returns zero for other pixels.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>Op</col>
<col></col>
<col>Operand algorithm that is being filtered.</col>
</row><row>
<col>Filter</col>
<col></col>
<col>Mask specification (see section "Material-texture masks" below)</col>
</row>
</table></text></part>
</part>
<h>Script function parameters</h>
<part>
Map drawing functions follow a common syntax for passing certain structures:
<h>Rectangles (array rect)</h>
<text>All rectangles are given in the format <code>[left, top, width, height]</code>, where the left and top pixel rows are included and left+width and top+height pixel rows are excluded. Unless otherwise specified, rect can always be nil, in which case the area defaults to the whole map or layer (<code>[0,0,this.Wdt,this.Hgt]</code>).</text>
<h>Material-texture definitions (string mattex)</h>
<text>When a material is specified for the drawing functions, the following definitions are valid:</text>
<text>
<table>
<rowh>
<col>String</col>
<col>Example</col>
<col>Meaning</col>
</rowh>
<row>
<col>Material</col>
<col>Earth</col>
<col>Draws the given material in its default texture as underground (tunnel background) material.</col>
</row>
<row>
<col>Material-Texture</col>
<col>Earth-earth_topSoil</col>
<col>Draws the given material with the given texture as underground material.</col>
</row>
<row>
<col>^Material</col>
<col>^Water</col>
<col>Draws the given material with its default texture as overground (sky background) material.</col>
</row>
<row>
<col>^Material-Texture</col>
<col>^Earth-earth_rough</col>
<col>Draws the given material with the given texture as overground material.</col>
</row>
<row>
<col>Sky</col>
<col>Sky</col>
<col>Draws a sky material. Within the map generator, explicit sky is drawn as IFT (0x80), which is converted to index zero on map drawing. That way, sky can be blitted to other layers without being transparent.</col>
</row>
<row>
<col>Transparent</col>
<col>Transparent</col>
<col>Draws with index 0.</col>
</row>
</table>
</text>
<h>Material-texture masks (string mask_spec)</h>
<text>When a material is specified as a masking function, the following definitions are valid:</text>
<text>
<table>
<rowh>
<col>String</col>
<col>Example</col>
<col>Meaning</col>
</rowh>
<row>
<col>Material</col>
<col>Earth</col>
<col>True for given material with any texture and any (sky or tunnel) background.</col>
</row>
<row>
<col>Material-Texture</col>
<col>Earth-earth_topSoil</col>
<col>True for the given material with the given texture and any (sky or tunnel) background.</col>
</row>
<row>
<col>Sky</col>
<col>Sky</col>
<col>True for explicit sky material (0x80) only. Not true for transaprent (0) pixels.</col>
</row>
<row>
<col>Transparent</col>
<col>Transparent</col>
<col>True for transparent pixels (index 0) only.</col>
</row>
<row>
<col>Background</col>
<col>Background</col>
<col>True for all background materials (e.g. Tunnel, BrickBack and Sky).</col>
</row>
<row>
<col>Liquid</col>
<col>Liquid</col>
<col>True for all liquids (e.g. Water, Acid, Lava and DuroLava).</col>
</row>
<row>
<col>Solid</col>
<col>Solid</col>
<col>True for solid materials (e.g. Earth, Rock, Brick, etc.).</col>
</row>
<row>
<col>*</col>
<col>*</col>
<col>True for all materials.</col>
</row>
<row>
<col>^Definition</col>
<col>^Rock-rock_cracked</col>
<col>True for the definition if overground (sky background) only.</col>
</row>
<row>
<col>&amp;Definition</col>
<col>&amp;Liquid</col>
<col>True for the definition if underground (tunnel background) only. The example would match all underground liquids.</col>
</row>
<row>
<col>~Definition</col>
<col>~^*</col>
<col>Inverts the definition, i.e. true only if the definition would originally be false. The example would match all underground materials.</col>
</row>
</table>
</text>
</part>
<h>Script functions</h>
<part>
<text>All drawing functions are defined in the MapLayer static prop list. Because the Map.c script file is also evaluated in this context with the current map as this pointer, all drawing functions can be called directly by name in that script (e.g.: Resize(150,150)). In other script contexts or if the function is to be executed on a layer instead of on the main map, the base object must be given explicitely (e.g.: map->Resize(150,150), where map is the parameter passed to InitializeMap).</text>
<text>Because layers derive from the MapLayer prop list, all script functions defined in the Map.c and included script files are also available on any layer.</text>
<h>Internal engine functions</h>
<part>
<text><code>bool Draw(string mattex, proplist mask_algo, array rect);</code></text>
<text>Draws the material given by mattex on all pixels within rect if the algorithm given by mask_algo returns a value other than zero. Returns true on success.</text>
<text><code>bool Blit(proplist mask_algo, array rect);</code></text>
<text>Same as draw, but draws the result of evaluation of mask_algo directly instead of a material given by mattex. Because mask_algo can also be a layer, this function can be used to copy layer contents onto other layers or the map. If mask_algo evaluates to zero, nothing is drawn and the original pixel value is kept.</text>
<text><code>proplist CreateLayer(string mattex_fill, int width, int height);</code></text>
<text>Creates a new layer of size width,height. If no size is given, the layer is created in the same size as the calling context layer or map. The new layer is filled with the pixel color given by mattex_fill, or with zeroes if mattex_fill is nil. Returns the newly created layer.</text>
<text><code>bool Resize(int new_width, int new_height);</code></text>
<text>Recreates the calling layer or map surface in the given size. All contents are deleted and the layer is filled with zeroes. Use functions Duplicate and Blit to backup and restore any old layer contents if you want to extent the map without losing its contents. Returns true on success.</text>
<text><code>proplist Duplicate(any mask_spec, array rect);</code></text>
<text>Creates a new layer with the same size and surface contents as this layer. If a rect is given, the new layer is smaller and contains only the portion included in rect. If mask_spec is given, only pixels passing the mask are set and all other pixels in the new layer are zero.</text>
<text><code>int GetPixel(int x, int y);</code></text>
<text>Gets the pixel color at the given position in this layer. If x,y is outside the layer, zero is returned.</text>
<text><code>bool SetPixel(int x, int y, int new_color);</code></text>
<text>Sets the pixel at position x,y in this layer to new_color. Returns true on success.</text>
<text><code>int GetPixelCount(any mask_spec, array rect);</code></text>
<text>Returns number of pixels on this layer or map within rect that fulfill mask_spec.</text>
<text><code>bool FindPosition(proplist out_pos, mask_spec, array rect, int max_tries);</code></text>
<text>Tries to find a position on this layer for which the pixel color matches mask_spec. If a position is found, true is returned and the position is set as X and Y parameters in the out_pos prop list. If no position is found after max_tries, the function will walk through all pixels of the layer starting from a random starting position to find a point. If still no position is found, false is returned and out_pos is not changed. max_tries defaults to 500.</text>
<text><code>array CreateMatTexMask(any mask_spec);</code></text>
<text>Returns mask_spec as an array of 256 bools to be used e.g. in conjunction with the return value of GetPixel.</text>
</part>
</part>
</part>
<author>Sven2</author><date>2013-03</date>
</doc>

View File

@ -7,8 +7,7 @@
<title>Call</title>
<category>Script</category>
<subcat>Function call</subcat>
<version>5.1 OC</version>
<extversion>5.4 OC</extversion>
<version>5.1 OC<extversion>5.4 OC</extversion></version>
<syntax>
<rtype>any</rtype>
<params>

View File

@ -21,7 +21,7 @@
</syntax>
<desc>Checks whether this object is visible for the given player.</desc>
<related>
<emlink href="definition/visibility.html">Visibility</emlink>-Property
<emlink href="definition/visibility.html">Visibility Property</emlink>
</related>
</func>
<author>Newton</author><date>2009-07</date>

View File

@ -13,7 +13,7 @@
<examples>
<example>
<code><funclink>GetCursor</funclink>(0)-&gt;<funclink>SetComDir</funclink>(<funclink>COMD_None</funclink>);
<funclink><funclink>GetCursor</funclink>()-&gt;SetDir</funclink>(DIR_Left);</code>
<funclink>GetCursor</funclink>()-&gt;<funclink>SetDir</funclink>(DIR_Left);</code>
<text>The selected clonk stops and looks to the left.</text>
</example>
</examples>

View File

@ -25,11 +25,16 @@
<name>radius</name>
<desc>Radius</desc>
</param>
<param>
<param>
<type>bool</type>
<name>no_dig2objects</name>
<desc>Prevent objects from being dug out</desc>
</param>
<param>
<type>bool</type>
<name>no_instability_check</name>
<desc>Does not perform instability checks around dug pixels, i.e. prevents surrounding single pixels and liquids from becoming loose.</desc>
</param>
</params>
</syntax>
<desc>Makes a circular hole in semi-solid materials. The return value is the amount of pixels that were dug free. If no_dig2objects is true, the dug out material does neither create objects according to the Dig2Objects in the <emlink href="material/ocm.html">*.ocm</emlink> nor will the amount be stored in the internal buffer.</desc>

View File

@ -30,11 +30,16 @@
<name>height</name>
<desc>Height</desc>
</param>
<param>
<param>
<type>bool</type>
<name>no_dig2objects</name>
<desc>Prevent objects from being dug out</desc>
</param>
<param>
<type>bool</type>
<name>no_instability_check</name>
<desc>Does not perform instability checks around dug pixels, i.e. prevents surrounding single pixels and liquids from becoming loose.</desc>
</param>
</params>
</syntax>
<desc>Makes a rectangular hole in semi-solid materials. The return value is the amount of pixels that were dug free. If no_dig2objects is true, the dug out material does neither create objects according to the Dig2Objects in the <emlink href="material/ocm.html">*.ocm</emlink> nor will the amount be stored in the internal buffer.</desc>

View File

@ -11,10 +11,10 @@
<rtype>bool</rtype>
<params>
<param>
<optional/>
<type>string</type>
<name>message</name>
<desc>Error message to be displayed</desc>
<optional/>
</param>
</params>
</syntax>

View File

@ -6,9 +6,9 @@
<func>
<title>GetID</title>
<category>Objects</category>
<version>5.1 OC</version>
<syntax><rtype>id</rtype></syntax>
<desc>Returns the object definition id of an object.</desc>
<version>5.1 OC<extversion>5.4 OC</extversion></version>
<syntax><rtype>proplist</rtype></syntax>
<desc>Returns the definition of an object. This is most often a <code>def</code>, but can also be a <code>proplist</code> deriving from a <code>def</code>.</desc>
<examples>
<example>
<code><funclink>CreateObject</funclink>(GetID())</code>
@ -17,4 +17,5 @@
</examples>
</func>
<author>jwk</author><date>2002-04</date>
<author>Günther</author><date>2013</date>
</funcs>

View File

@ -26,6 +26,7 @@
</example>
</examples>
<related>
<funclink>GetStartupPlayerCount</funclink>
<funclink>GetPlayerName</funclink>
<funclink>GetPlayerByIndex</funclink>
<funclink>EliminatePlayer</funclink>

View File

@ -20,13 +20,15 @@
</params>
</syntax>
<desc>Returns the names of all properties of <code>object</code>.</desc>
<related><funclink>SetProperty</funclink></related>
<related><funclink>GetProperty</funclink></related>
<examples>
<example>
<code>GetProperties({foo = 1, bar = 2}) == ["bar", "foo"]</code>
</example>
</examples>
<related>
<funclink>SetProperty</funclink>
<funclink>GetProperty</funclink>
</related>
</func>
<author>Günther</author><date>2012</date>
</funcs>

View File

@ -26,8 +26,10 @@
</params>
</syntax>
<desc>Returns the property <code>key</code> of <code>object</code>.</desc>
<related><funclink>SetProperty</funclink></related>
<related><funclink>GetProperties</funclink></related>
<related>
<funclink>SetProperty</funclink>
<funclink>GetProperties</funclink>
</related>
</func>
<author>Günther</author><date>2009-05</date>
</funcs>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GetStartupPlayerCount</title>
<category>Player</category>
<version>5.4 OC</version>
<syntax>
<rtype>int</rtype>
</syntax>
<desc>Returns the number of players scheduled to join the game when it intiially started. This value is determined before game start, so it can be used in early scenario initialization functions such as Initialize or InitializeMap.</desc>
<remark>The startup player count is not updated when a savegame is resumed with a different number of players.</remark>
<remark>The number of players actually joining the game might be lower due to clients disconnecting at game start or players trying to join with invalid player files. To get a reliable number of players, handle player joins and leaves directly in InitializePlayer and RemovePlayer callbacks or call <funclink>GetPlayerByCount</funclink> shortly after game start.</remark>
<related>
<funclink>GetPlayerCount</funclink>
</related>
</func>
<author>Sven2</author><date>2013-03</date>
</funcs>

View File

@ -40,9 +40,22 @@
<desc>vertical speed of material pixel to be inserted</desc>
<optional />
</param>
<param>
<type>proplist</type>
<name>out_insertpos</name>
<desc>If a writeable proplist is passed, members x and y are filled with the actual insertion position.</desc>
<optional />
</param>
<param>
<type>bool</type>
<name>query_only</name>
<desc>If set, the material is not actually inserted. Use this if you are only interested if insertion would be possible and where it would take place.</desc>
<optional />
</param>
</params>
</syntax>
<desc>Inserts a material pixel at the given position and given speed.</desc>
<remark>If the target position already contains material of the same density as the inserted material, the engine will search upwards for a proper insertion position. Use the parameter out_insertpos to find out where material was actually inserted.</remark>
<related>
<funclink>Material</funclink>
</related>

View File

@ -41,7 +41,7 @@
<text>Makes a clonk explode after 1000 ticks delay.</text>
</example>
<example>
<code>Schedule(<code>nil</code>, &quot;<funclink>DoWealth</funclink>(<funclink>GetPlayerByIndex</funclink>(0), 1)&quot;<funclink></funclink>, 1, 100);</code>
<code>Schedule(nil, &quot;<funclink>DoWealth</funclink>(<funclink>GetPlayerByIndex</funclink>(0), 1)&quot;<funclink></funclink>, 1, 100);</code>
<text>Gives one unit of money per frame to the first player for 100 frames. Notice that if the first player is eliminated, the donations will continue for the next (first) player, since the receiving player is determined anew in each execution.</text>
</example>
</examples>

View File

@ -21,28 +21,28 @@
</rowh>
<row>
<col>15</col>
<col>++</col>
<col id="++">++</col>
<col>Increases the value of the <strong>following</strong> variable by 1.</col>
<col>prefix</col>
<col>reference, reference</col>
</row>
<row>
<col>15</col>
<col>--</col>
<col id="--">--</col>
<col>Decreases the value of the <strong>following</strong> variable by 1.</col>
<col>prefix</col>
<col>reference, reference</col>
</row>
<row>
<col>15</col>
<col>~</col>
<col id="~">~</col>
<col>Bitwise negation of the following value.</col>
<col>prefix</col>
<col>int, int</col>
</row>
<row>
<col>15</col>
<col>!</col>
<col id="!">!</col>
<col>Logical negation of the following value.</col>
<col>prefix</col>
<col>bool, bool</col>
@ -77,70 +77,70 @@
</row>
<row>
<col>14l</col>
<col>**</col>
<col id="**">**</col>
<col>Yields the power of a to b.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>13l</col>
<col>/</col>
<col id="/">/</col>
<col>Divides a by b.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>13l</col>
<col>*</col>
<col id="*">*</col>
<col>Multiplies a by b.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>13l</col>
<col>%</col>
<col id="%">%</col>
<col>Yields the remainder of the devision of a by b.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>12l</col>
<col>-</col>
<col id="-">-</col>
<col>Subtracts b from a.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>12l</col>
<col>+</col>
<col id="+">+</col>
<col>Adds a to b.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>11l</col>
<col>&lt;&lt;</col>
<col id="&lt;&lt;">&lt;&lt;</col>
<col>Performs a bit shift operation to the left.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>11l</col>
<col>&gt;&gt;</col>
<col id="&gt;&gt;">&gt;&gt;</col>
<col>Performs a bit shift operation to the right.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>10l</col>
<col>&lt;</col>
<col id="&lt;">&lt;</col>
<col>Returns whether a is less than b.</col>
<col>postfix</col>
<col>bool, int/int</col>
</row>
<row>
<col>10l</col>
<col>&lt;=</col>
<col id="&lt;=">&lt;=</col>
<col>Returns whether a is less than or equal to b.</col>
<col>postfix</col>
<col>bool, int/int</col>
@ -148,125 +148,125 @@
<row>
<col>10l</col>
<col>&gt;</col>
<col>Returns whether a is greater than b.</col>
<col id="&gt;">Returns whether a is greater than b.</col>
<col>postfix</col>
<col>bool, int/int</col>
</row>
<row>
<col>10l</col>
<col>&gt;=</col>
<col id="&gt;=">&gt;=</col>
<col>Returns whether the first value is greater than or equal to the second.</col>
<col>postfix</col>
<col>bool, int/int</col>
</row>
<row>
<col>9l</col>
<col>==</col>
<col id="==">==</col>
<col>Returns whether a equals b.</col>
<col>postfix</col>
<col>bool, any/any</col>
</row>
<row>
<col>9l</col>
<col>!=</col>
<col id="!=">!=</col>
<col>Returns whether a is unequal to b.</col>
<col>postfix</col>
<col>bool, any/any</col>
</row>
<row>
<col>9l</col>
<col>===</col>
<col id="===">===</col>
<col>Returns whether a and b refer to the same thing.</col>
<col>postfix</col>
<col>bool, any/any</col>
</row>
<row>
<col>9l</col>
<col>!==</col>
<col id="!==">!==</col>
<col>Returns whether a and b do not refer to the same thing.</col>
<col>postfix</col>
<col>bool, any/any</col>
</row>
<row>
<col>8l</col>
<col>&amp;</col>
<col id="&amp;">&amp;</col>
<col>Performs a bitwise AND operation.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>6l</col>
<col>^</col>
<col id="^">^</col>
<col>Performs a bitwise XOR operation.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>6l</col>
<col>|</col>
<col id="|">|</col>
<col>Performs a bitwise OR operation.</col>
<col>postfix</col>
<col>int, int/int</col>
</row>
<row>
<col>5l</col>
<col>&amp;&amp;</col>
<col id="&amp;&amp;">&amp;&amp;</col>
<col>Performs a logical AND operation.</col>
<col>postfix</col>
<col>any, any/any</col>
</row>
<row>
<col>4l</col>
<col>||</col>
<col id="||">||</col>
<col>Performs a logical OR operation.</col>
<col>postfix</col>
<col>any, any/any</col>
</row>
<row>
<col>3l</col>
<col>??</col>
<col id="??">??</col>
<col>Returns the left-hand operand if the operand is not <code>nil</code>, or the right-hand operand otherwise.</col>
<col>postfix</col>
<col>any, any/any</col>
</row>
<row>
<col>2r</col>
<col>*=</col>
<col id="*=">*=</col>
<col>Multiplies the preceeding variables by the following value.</col>
<col>postfix</col>
<col>reference, reference/int</col>
</row>
<row>
<col>2r</col>
<col>/=</col>
<col id="/=">/=</col>
<col>Divides the preceeding variable by the following value.</col>
<col>postfix</col>
<col>reference, reference/int</col>
</row>
<row>
<col>2r</col>
<col>%=</col>
<col id="%=">%=</col>
<col>Sets the preceeding variable to the remainder of the devision of that variable by the following value.</col>
<col>postfix</col>
<col>reference, reference/int</col>
</row>
<row>
<col>2r</col>
<col>+=</col>
<col id="+=">+=</col>
<col>Increases the preceeding variable by the following value.</col>
<col>postfix</col>
<col>reference, reference/int</col>
</row>
<row>
<col>2r</col>
<col>-=</col>
<col id="-=">-=</col>
<col>Decreases the preeceding variable by the following value.</col>
<col>postfix</col>
<col>reference, reference/int</col>
</row>
<row>
<col>2r</col>
<col>=</col>
<col id="=">=</col>
<col>Assigns the following value to the preceeding variable.</col>
<col>postfix</col>
<col>reference, reference/any</col>

View File

@ -1,7 +1,7 @@
[Material]
Name=Brick
Shape=Flat
Density=50
Density=90
Friction=15
Placement=80
TextureOverlay=brick1

View File

@ -1,7 +1,7 @@
[Material]
Name=BrickSoft
Shape=Flat
Density=50
Density=90
Friction=15
Placement=60
TextureOverlay=brick1

View File

@ -1,7 +1,7 @@
[Material]
Name=Ice
Shape=TopFlat
Density=50
Density=60
Friction=15
BlastFree=1
Blast2Object=Ice

View File

@ -1,7 +1,7 @@
[Material]
Name=Ametyst
Shape=Rough
Density=50
Density=70
Friction=15
BlastFree=1
Blast2Object=Ice

View File

@ -1,7 +1,7 @@
[Material]
Name=Ruby
Shape=Rough
Density=50
Density=70
Friction=15
BlastFree=1
Blast2Object=Ice

View File

@ -1,7 +1,7 @@
[Material]
Name=Ice
Shape=TopFlat
Density=50
Density=60
Friction=15
DigFree=1
BlastFree=1

View File

@ -13,8 +13,8 @@ Rules=Rule_KillLogs=1;Rule_Gravestones=1;
MapWidth=20
MapHeight=20
TopOpen=1
BottomOpen=0
MapZoom=20,0,0,20
BottomOpen=1
MapZoom=18,0,0,18
[Weather]
Climate=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -90,6 +90,7 @@ global func CreateAttackWave(int angle, int rockets, int anglespread)
gui_arrow->SetObjectBlitMode(GFX_BLIT_Mod2);
}
gui_arrow->SetR(angle);
gui_arrow.Plane = 500;
}
}

View File

@ -4,7 +4,7 @@
public func SetStackCount(int amount)
{
count = MaxStackCount();
Update();
UpdateStackDisplay();
}
public func Hit()
@ -17,7 +17,7 @@ public func HitObject(object obj)
{
if(obj->GetOCF() & OCF_CrewMember) return;
inherited(obj,...);
RemoveObject();
if (this) RemoveObject();
}
func UpdatePicture()

View File

@ -3,4 +3,7 @@
func Damage()
{
Explode(30);
}
}
// No lightbulbs
func MakePowerProducer(power) { return false; }

View File

@ -1,17 +0,0 @@
// Editor tweak
#appendto Clonk
func EditCursorSelection()
{
var ai = S2AI->GetAI(this);
if (ai) Call(S2AI.EditCursorSelection, ai);
return _inherited(...);
}
func EditCursorDeselection()
{
var ai = S2AI->GetAI(this);
if (ai) Call(S2AI.EditCursorDeselection, ai);
return _inherited(...);
}

Binary file not shown.

View File

@ -34,7 +34,7 @@ VegetationLevel=100,0,0,100
InEarth=Rock=1;Gold=1;Fireglobe=1;Loam=1
InEarthLevel=65,0,0,100
Sky=Clouds2
BottomOpen=1
BottomOpen=0
MapWidth=500,0,64,10000
MapHeight=100,0,40,10000
MapZoom=10

View File

@ -1,2 +1,2 @@
DE:Experimental
DE:Experimentelles
US:Experimental

View File

@ -12,4 +12,5 @@ WindDrift=60
Corrode=75
Soil=1
Placement=30
TextureOverlay=ashes
TextureOverlay=ashes
Instable=1

View File

@ -1,7 +1,7 @@
[Material]
Name=Brick
Shape=Smoother
Density=50
Density=90
Friction=15
Placement=80
TextureOverlay=brick1

View File

@ -1,7 +1,7 @@
[Material]
Name=BrickSoft
Shape=Smoother
Density=50
Density=90
Friction=15
Placement=60
TextureOverlay=brick1

View File

@ -1,7 +1,7 @@
[Material]
Name=Coal
Shape=Rough
Density=50
Density=60
Friction=75
DigFree=1
BlastFree=1

View File

@ -1,7 +1,7 @@
[Material]
Name=Earth
Shape=Smooth
Density=50
Density=60
Friction=80
DigFree=1
BlastFree=1

View File

@ -1,7 +1,7 @@
[Material]
Name=Gold
Shape=Rough
Density=50
Density=70
Friction=100
BlastFree=1
Blast2Object=Nugget

View File

@ -1,7 +1,7 @@
[Material]
Name=Granite
Shape=Rough
Density=50
Density=80
Friction=100
MaxAirSpeed=100
MaxSlide=250

View File

@ -1,7 +1,7 @@
[Material]
Name=Ice
Shape=TopFlat
Density=50
Density=60
Friction=15
DigFree=1
BlastFree=1

View File

@ -1,7 +1,7 @@
[Material]
Name=Ore
Shape=Rough
Density=50
Density=70
Friction=100
BlastFree=1
Blast2Object=Ore

View File

@ -1,7 +1,7 @@
[Material]
Name=Rock
Shape=Rough
Density=50
Density=70
Friction=100
BlastFree=1
Blast2Object=Rock

View File

@ -1,7 +1,7 @@
[Material]
Name=Sand
Shape=Smooth
Density=50
Density=60
Friction=80
DigFree=1
BlastFree=1

View File

@ -1,7 +1,7 @@
[Material]
Name=Sulphur
Shape=Rough
Density=50
Density=60
Friction=75
DigFree=1
BlastFree=1

View File

@ -1,40 +1,34 @@
# Static Map Material/Texture Table
# Index +128 for underground materials
10=Tunnel-tunnel
11=Tunnel-tunnel
12=Tunnel-brickback
13=BrickSoft-brick1
19=DuroLava-lava_red
20=Water-water1-water2-water3-water1-water3-water2
#21=Oil-Liquid
22=Acid-acid
23=Lava-lava_red
24=DuroLava-lava_red
25=Water-water
#26=Oil-Smooth
27=Acid-acid
28=Lava-lava_red
28=Earth-earth
29=Earth-earth_dry
30=Earth-earth_rough
31=Earth-earth_topsoil
32=Earth-earth_midsoil
33=Ashes-ashes
#34=Ashes-Rough
#35=Ashes-Ridge
35=SandDry-sand_rough
36=Ore-ore
37=Ore-ore
38=Ore-ore
40=Granite-granite
41=Granite-granite
42=Granite-rock
45=Gold-gold
50=Rock-rock
51=Rock-rock_cracked
52=Rock-rock
53=Sulphur-sulphur
@ -42,28 +36,10 @@
55=Sand-sand_rough
56=Sand-sand_smooth
#57=Sand-Smooth3
#59=FlyAshes-Smooth
#60=Crystal-Flare
#61=Crystal-Structure
#62=Crystal-Structure2
65=Ice-ice2
66=Ice-ice2
67=Ice-ice3
68=Ice-ice3
70=Snow-snow1
71=Snow-snow1
72=Snow-snow1
73=Brick-brick1
#80=FlySand-Smooth2
#81=FlySand-Smooth3
#82=FlySand-Smooth

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -30,10 +30,11 @@ material Clonk_Body
}
texture_unit Light
{
// apply lighting
// apply lighting -- note this texture unit does not need an
// actual texture image: no hardware TIU will be used.
colour_op_ex modulate src_current src_diffuse
alpha_op_ex modulate src_current src_diffuse
}
}
}
}
}

View File

@ -197,6 +197,14 @@ public func Eat(object food)
}
}
func DigOutObject(object obj)
{
// Collect fragile objects when dug out
if (obj->GetDefFragile())
return Collect(obj,nil,nil,true);
return false;
}
/* Status */
// TODO: Make this more sophisticated, readd turn animation and other
@ -557,6 +565,24 @@ func SetSkin(int skin)
}
func GetSkinCount() { return 4; }
/* AI editor helper */
func EditCursorSelection()
{
var ai = S2AI->GetAI(this);
if (ai) Call(S2AI.EditCursorSelection, ai);
return _inherited(...);
}
func EditCursorDeselection()
{
var ai = S2AI->GetAI(this);
if (ai) Call(S2AI.EditCursorDeselection, ai);
return _inherited(...);
}
/* Act Map */
local ActMap = {
@ -882,7 +908,7 @@ Eat = {
};
local Name = "Clonk";
local MaxEnergy = 50000;
local MaxBreath = 252; // Clonk can breathe for 7 seconds under water.
local MaxBreath = 720; // Clonk can breathe for 20 seconds under water.
local JumpSpeed = 400;
local ThrowSpeed = 294;
local NoBurnDecay = 1;

View File

@ -11,6 +11,11 @@ global func Bubble(int amount, int x, int y)
return;
}
global func CastBubbles(int num, int level, int x, int y)
{
return CastObjects(Fx_Bubble, num, level, x, y);
}
protected func Initialize()
{
DoCon(RandomX(25, 100));

View File

@ -237,6 +237,6 @@ local ActMap = {
protected func Definition(def)
{
SetProperty("MeshTransformation", Trans_Mul(Trans_Translate(-79000, 1000, 0), Trans_Rotate(60, 0, 1, 0)), def);
SetProperty("MeshTransformation", Trans_Mul(Trans_Translate(-9000, 1000, 0), Trans_Rotate(60, 0, 1, 0)), def);
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(60, 0, 1, 0), Trans_Scale(1200), Trans_Translate(-4000, 6500, -3000)), def);
}

View File

@ -24,12 +24,14 @@ local respawn_list; // List of last reached respawn CP per player.
local plr_list; // Number of checkpoints the player completed.
local team_list; // Number of checkpoints the team completed.
local time_store; // String for best time storage in player file.
local no_respawn_handling; // set to true if this goal should not handle respawn
/*-- General --*/
protected func Initialize()
{
finished = false;
no_respawn_handling = false;
cp_list = [];
cp_count = 0;
respawn_list = [];
@ -79,6 +81,7 @@ public func SetFinishpoint(int x, int y, bool team)
cp->SetCPController(this);
cp_count++;
cp_list[cp_count] = cp;
UpdateScoreboardTitle();
return cp;
}
@ -105,9 +108,20 @@ public func AddCheckpoint(int x, int y, int mode)
cp_list[cp_count + 1] = cp;
}
cp_count++;
UpdateScoreboardTitle();
return cp;
}
public func DisableRespawnHandling()
{
// Call this to disable respawn handling by goal
// This might be useful if
// a) you don't want any respawns or
// b) the scenario already provides an alternate respawn handling
no_respawn_handling = true;
return true;
}
/*-- Checkpoint interaction --*/
// Called from a finish CP to indicate that plr has reached it.
@ -335,6 +349,7 @@ protected func InitializePlayer(int plr, int x, int y, object base, int team)
protected func RelaunchPlayer(int plr)
{
if (no_respawn_handling) return;
var clonk = CreateObject(Clonk, 0, 0, plr);
clonk->MakeCrewMember(plr);
SetCursor(plr, clonk);
@ -378,20 +393,24 @@ protected func RemovePlayer(int plr)
static const SBRD_Checkpoints = 0;
static const SBRD_BestTime = 1;
private func InitScoreboard()
private func UpdateScoreboardTitle()
{
if (cp_count > 0)
var caption = Format("$MsgCaptionX$", cp_count);
else
var caption = "$MsgCaptionNone$";
return Scoreboard->SetTitle(caption);
}
private func InitScoreboard()
{
Scoreboard->Init(
[
{key = "checkpoints", title = ParkourCheckpoint, sorted = true, desc = true, default = 0, priority = 80},
{key = "besttime", title = "T", sorted = true, desc = true, default = 0, priority = 70}
]
);
Scoreboard->SetTitle(caption);
UpdateScoreboardTitle();
return;
}

View File

@ -0,0 +1,5 @@
[DefCore]
id=Goal_RubyHunt
Version=5,2,0,1
Category=C4D_StaticBack|C4D_Goal
Picture=0,0,128,128

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,89 @@
/*--
Ruby hunt
Author: Sven2
Mine one ruby and return to start
--*/
#include Library_Goal
local goal_rect, has_winner;
protected func Initialize()
{
return inherited(...);
}
func SetGoalRect(r)
{
goal_rect = r;
return true;
}
/*-- Goal interface --*/
// The goal is fulfilled if a ruby is in the goal rectangle
public func IsFulfilled()
{
var winner=NO_OWNER, winners, winner_teams;
if (has_winner) return true;
for (var ruby in FindObjects(Find_InRect(goal_rect.x, goal_rect.y, goal_rect.w, goal_rect.h), Find_ID(Ruby)))
{
if (ruby->Contained()) winner = ruby->Contained()->GetOwner();
if (winner==NO_OWNER) winner = ruby->GetController();
if (winner==NO_OWNER) continue;
if (!winners) winners = [winner]; else winners[GetLength(winners)] = winner;
var team = GetPlayerTeam(winner);
if (team) if (!winner_teams) winner_teams = [team]; else winner_teams[GetLength(winner_teams)] = team;
}
if (!winners) return false;
has_winner = true;
var iplr=GetPlayerCount();
while (iplr--)
{
var plr = GetPlayerByIndex(iplr);
// Free view when game is over
for (var flag in [PLRZOOM_LimitMax, PLRZOOM_Direct])
SetPlayerZoomByViewRange(plr,LandscapeWidth(),LandscapeWidth(),flag);
SetPlayerViewLock(plr, false);
if (GetIndexOf(winners, plr) >= 0) continue;
if (winner_teams) if (GetIndexOf(winner_teams, GetPlayerTeam(plr)) >= 0) continue;
EliminatePlayer(plr);
}
return true;
}
// Shows or hides a message window with information.
public func Activate(int plr)
{
// If goal message open -> hide it.
if (GetEffect("GoalMessage", this))
{
CustomMessage("", nil, plr, nil, nil, nil, nil, nil, MSG_HCenter);
RemoveEffect("GoalMessage", this);
return;
}
// Otherwise open a new message.
AddEffect("GoalMessage", this, 100, 0, this);
var message;
if (IsFulfilled())
message = "@$MsgGoalFulfilled$";
else
message = "@$MsgGoalUnfulfilled$";
CustomMessage(message, nil, plr, 0, 16 + 64, 0xffffff, GUI_MenuDeco, this, MSG_HCenter);
return;
}
protected func FxGoalMessageStart() {}
public func GetShortDescription(int plr)
{
return nil;
}
/*-- Proplist --*/
local Name = "$Name$";

View File

@ -0,0 +1,4 @@
Name=Rubinsuche
#Goal window
MsgGoalFulfilled=Ein Rubin wurde abgeliefert.
MsgGoalUnfulfilled=Noch kein Rubin am Start.

View File

@ -0,0 +1,5 @@
Name=Sell gems
#Goal window
MsgGoalFulfilled=A ruby has been delivered.
MsgGoalUnfulfilled=Mine a ruby and deliver it to the starting platform.

View File

@ -0,0 +1,5 @@
[DefCore]
id=Goal_SellGems
Version=5,2,0,1
Category=C4D_StaticBack|C4D_Goal
Picture=0,0,128,128

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,76 @@
/*--
Sell Gems
Author: Sven2
Sell n gems at flagpole.
--*/
#include Library_Goal
local gems_to_sell;
protected func Initialize()
{
gems_to_sell = 20; // default
return inherited(...);
}
func SetTargetAmount(int new_amount)
{
gems_to_sell = new_amount;
return true;
}
func OnGemSold()
{
// A gem was sold. Subtract.
gems_to_sell = Max(gems_to_sell-1);
return true;
}
/*-- Goal interface --*/
// The goal is fulfilled if no more gems need to be sold
public func IsFulfilled()
{
return (gems_to_sell<=0);
}
// Shows or hides a message window with information.
public func Activate(int plr)
{
// If goal message open -> hide it.
if (GetEffect("GoalMessage", this))
{
CustomMessage("", nil, plr, nil, nil, nil, nil, nil, MSG_HCenter);
RemoveEffect("GoalMessage", this);
return;
}
// Otherwise open a new message.
AddEffect("GoalMessage", this, 100, 0, this);
var message;
if (IsFulfilled())
message = "@$MsgGoalFulfilled$";
else
message = Format("@$MsgGoalUnfulfilled$", gems_to_sell);
CustomMessage(message, nil, plr, 0, 16 + 64, 0xffffff, GUI_MenuDeco, this, MSG_HCenter);
return;
}
protected func FxGoalMessageStart() {}
public func GetShortDescription(int plr)
{
// Show acquired wealth compared to goal.
var clr = RGB(255, 0, 0);
if (gems_to_sell<=0)
clr = RGB(0, 255, 0);
var msg = Format("<c %x>%d</c>{{%i}}", clr, gems_to_sell, Ruby);
return msg;
}
/*-- Proplist --*/
local Name = "$Name$";

View File

@ -0,0 +1,4 @@
Name=Edelsteine verkaufen
#Goal window
MsgGoalFulfilled=Ihr habt genug Edelsteine verkauft!
MsgGoalUnfulfilled=Ihr müsst noch %d Edelsteine verkaufen.

View File

@ -0,0 +1,5 @@
Name=Sell gems
#Goal window
MsgGoalFulfilled=You've sold enough gems!
MsgGoalUnfulfilled=You need to sell %d more gems.

View File

@ -50,3 +50,65 @@ func Update()
SetObjDrawTransform((width * 1000) / 110, 0, 0, 0, (height * 1000) / 19, 0, 0);
SetObjDrawTransform(l, 0, -(w-l) * 55, 0, (height * 1000) / 19, 100, 1);
}
/*
adds an energy bar above the object.
The energy bar uses either target.HitPoints & GetDamage() or target->GetMaxEnergy() & target->GetEnergy().
*/
global func AddEnergyBar()
{
var e = AddEffect("ShowEnergyBar", this, 1, 0, nil, nil);
if (e)
return e.bar;
}
global func FxShowEnergyBarStart(target, effect, temp)
{
if (temp) return;
var attachpoint = { x = 0, y = target->GetDefOffset(1) - 5};
var current, max;
if (target->GetCategory() & C4D_Living)
{
max = target->~GetMaxEnergy();
current = target->GetEnergy();
}
else
{
max = target.HitPoints;
current = max - target->GetDamage();
}
if (current == nil || max == nil)
return -1;
effect.bar = target->CreateProgressBar(GUI_ShadedSimpleProgressBar, max, current, 0, target->GetOwner(), attachpoint, nil, { width = 28, height = 6, color = RGB(200, 1, 1) });
effect.bar->SetPlane(750);
// update once
effect.Interval = 1;
return 1;
}
global func FxShowEnergyBarTimer(target, effect, time)
{
var value;
if (target->GetCategory() & C4D_Living) value = target->GetEnergy();
else value = target.HitPoints - target->GetDamage();
effect.bar->SetValue(value);
effect.Interval = 0;
return 1;
}
global func FxShowEnergyBarDamage(target, effect, dmg, cause)
{
effect.Interval = 1;
return dmg;
}
global func FxShowEnergyBarStop(target, effect, reason, temp)
{
if (temp) return;
if (effect.bar)
effect.bar->Close();
}

View File

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 141 B

View File

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -1,3 +1,3 @@
Name=Gekochter Pilz
Description=Diese fantastische Mahlzeit gibt dem Clonk einige Lebenspunkte zurück.
UsageHelp=Drücke [Benutzen] um das Brot zu essen.
Name=Gekochter Pilz
Description=Diese fantastische Mahlzeit gibt dem Clonk einige Lebenspunkte zurück.
UsageHelp=Drücke [Benutzen] um den Pilz zu essen.

View File

@ -0,0 +1,15 @@
[DefCore]
id=Amethyst
Version=5,2,0,1
Category=C4D_Object
Width=8
Height=8
Offset=-4,-4
Vertices=4
VertexX=-4,0,4,0
VertexY=0,-4,0,4
VertexFriction=70,70,70,70
Value=50
Mass=10
Components=Sulphur=1
Rotate=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Some files were not shown because too many files have changed in this diff Show More