Compare commits

..

8 Commits

Author SHA1 Message Date
Tobias Zwick d8a4b2a7bf buildfix msvc 2013-05-26 17:59:12 +02:00
Armin Burgmeier 12f10f070d Add missing scancodes for linux 2013-05-26 16:42:35 +02:00
Tobias Zwick 3cbd53bada convert windows scancodes to linux scancodes where they differ; make linux compile 2013-05-26 15:13:02 +02:00
Tobias Zwick 120cff1262 convert windows scancodes to linux scancodes where they differ; make linux compile 2013-05-26 15:01:23 +02:00
Tobias Zwick 5877cab4c7 convert windows scancodes to linux scancodes where they differ; make linux compile 2013-05-26 15:00:03 +02:00
Martin Plicht 3d2a1ce9a3 mac: Compile fix 2013-05-26 14:21:43 +02:00
Tobias Zwick e000b268dd write down all scancodes for windows 2013-05-26 13:06:21 +02:00
Tobias Zwick 40547be458 stop and play icons 2013-05-26 02:04:01 +02:00
7044 changed files with 139246 additions and 344802 deletions

View File

@ -1,2 +1 @@
node: $Format:%H$
date: $Format:%ci$

3
.gitattributes vendored
View File

@ -1,6 +1,3 @@
.git_archival export-subst
.gitattributes export-ignore
.gitignore export-ignore
*.sh text eol=lf
tools/osx_bundle_libs text eol=lf

68
.gitignore vendored
View File

@ -1,24 +1,37 @@
autom4te.cache
*~
*.bak
.deps
deps
*.o
/openclonk
/openclonk-server
/netpuncher
/c4group
/c4script
.dirstamp
*.a
*.c4p
planet/Records.c4f
*.lib
*.dll
stamp-h1
config.h
config.log
config.status
C4Version.h
Makefile
C4Include.h.gch
Makefile.in
aclocal.m4
autotools/config.guess
autotools/config.sub
autotools/compile
autotools/depcomp
autotools/install-sh
autotools/missing
configure
intermediate
/build*
build*
CMakeScripts
CMakeFiles
CMakeCache.txt
@ -29,25 +42,19 @@ CPackSourceConfig.cmake
*.rule
editor-icons.h
oc-icon.h
NativeToolsExport.cmake
engine-resource.c
tests/CTestTestfile.cmake
# Documentation
*.pyc
node_modules
/docs/online
/docs/chm
/docs/sdk-de
/docs/sdk/content.xml
/docs/*.mo
/docs/doku.pot
/docs/Functions.txt
/docs/lunr.js
docs/online
docs/chm
docs/sdk-de
docs/sdk/content.xml
docs/*.mo
docs/doku.pot
docs/Functions.txt
# Visual studio files
openclonk.opensdf
openclonk.manifest
deps/
planet/Release
planet/RelWithDebInfo
@ -60,10 +67,6 @@ planet/fmod.dll
planet/cmake_install.cmake
planet/clonk.sln
planet/clonk.ilk
*.ipdb
*.iobj
openclonk.VC.db
openclonk.VC.VC.opendb
build
planet/clonk.app
@ -84,16 +87,6 @@ openclonk.ilk
*.vcxproj
*.vcxproj.filters
/ipch
.vs/
c4group_autogen/
c4script_autogen/
libc4script_autogen/
libmisc_autogen/
libopenclonk_autogen/
netpuncher_autogen/
openclonk-server_autogen/
openclonk_autogen/
thirdparty/blake2/blake2_autogen/
# Temporary files created by Microsoft Visual Studio
*.ncb
@ -124,7 +117,6 @@ xcode/build
# Development files explicitely excluded
planet/nohg*
*.nohg*
# Eclipse project file
planet/.project
@ -134,7 +126,6 @@ openclonk.layout
openclonk.sdf
openclonk.cbp
tests/openclonk_unittest.cbp
tests/openclonk_unittest.sln
# MacOSX saved searches
*.savedSearch
@ -143,20 +134,7 @@ planet/openclonk.sln
WindowsGamesExplorer.xml
# Mape
./mape
/mape
mape
mape-icons.h
mape-resource.c
# Packed groups created directly in root path
/*.oc*
# QMake stuff
*_automoc.cpp
moc_*.cpp
qrc_resource.cpp
ui_C4ConsoleQt*.h
resource.qrc.depends
*.exp
qt.conf

View File

@ -1,84 +0,0 @@
# thanks to http://stackoverflow.com/questions/29312015/building-with-more-than-one-version-of-a-compiler for the template
language: cpp
dist: trusty
sudo: required # for Qt libraries. Additionally, the virtualization builds are more stable and have better single core performance.
matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9', 'build-essential', 'cmake3', 'libfreetype6-dev', 'libgl1-mesa-dev', 'libglew-dev', 'libgtk-3-dev', 'libjpeg-dev', 'libpng-dev', 'libsdl2-dev', 'libupnp-dev', 'libxrandr-dev', 'x11proto-core-dev', 'zlib1g-dev', 'libalut0', 'libgtest-dev']
env:
- CCOMPILER=gcc-4.9
- CXXCOMPILER=g++-4.9
- TYPE=Debug # somehow, the linking fails for release builds. If someone could fix that, that would be great.
- BSYS="Unix Makefiles#make -k"
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: ppa:beineri/opt-qt596-trusty
packages: ['g++-5', 'build-essential', 'cmake3', 'libpng-dev', 'libjpeg-dev', 'libfreetype6-dev', 'libglew-dev', 'libreadline-dev', 'libsdl2-dev', 'qt59base', 'libalut-dev', 'libvorbis-dev', 'libopenal-dev', 'libdw-dev', 'libgtest-dev', 'ninja-build']
env:
- CCOMPILER=gcc-5
- CXXCOMPILER=g++-5
- TYPE=RelWithDebInfo
- CXX_FLAGS="-fdiagnostics-color -I/usr/include/AL"
- BSYS="Ninja#ninja -k30" PCH=on
- UPLOAD_SNAPSHOT=1
- CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/usr -DWITH_AUTOMATIC_UPDATE=ON -DWITH_APPDIR_INSTALLATION=ON"
- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8']
packages: ['clang-3.8', 'build-essential', 'cmake3', 'libfreetype6-dev', 'libgl1-mesa-dev', 'libglew-dev', 'libgtk-3-dev', 'libjpeg-dev', 'libpng-dev', 'libsdl2-dev', 'libupnp-dev', 'libxrandr-dev', 'x11proto-core-dev', 'zlib1g-dev', 'libalut0', 'ninja-build', 'libc++-dev', 'libc++1', 'libgtest-dev']
env:
- CCOMPILER=clang-3.8
- CXXCOMPILER=clang++-3.8
- CXX_FLAGS="-stdlib=libc++ -fcolor-diagnostics"
- TYPE=Debug
- BSYS="Ninja#ninja -k30"
before_install:
- for t in test mock; do wget https://github.com/google/google$t/archive/release-1.7.0.tar.gz -Og$t.tgz && tar xvf g$t.tgz; done
install:
- '[ -e /opt/qt59/bin/qt59-env.sh ] && source /opt/qt59/bin/qt59-env.sh || echo building without Qt'
before_script:
- export CXX="$CXXCOMPILER" CC="$CCOMPILER"
- export C4REVISION_BRANCH="$TRAVIS_BRANCH"
- >
cmake
-G"${BSYS/\#*/}"
-DCMAKE_BUILD_TYPE="$TYPE"
-DCMAKE_CXX_FLAGS="$CXX_FLAGS"
-DUSE_GCC_PCH=${PCH:-off}
-DGTEST_ROOT=$PWD/googletest-release-1.7.0
-DGMOCK_ROOT=$PWD/googlemock-release-1.7.0
$CMAKE_FLAGS
.
script:
- ${BSYS/*#/} all netpuncher tests aul_test
# TODO: Remove SKIP_IPV6_TEST once Travis generally adds ::1 as loopback address.
- SKIP_IPV6_TEST=1 ./tests/tests
- ./tests/aul_test
after_success:
- >
[ "$UPLOAD_SNAPSHOT" = 1 ] &&
echo "Creating AppImage..." &&
tools/create_appimage.sh &&
echo "Uploading snapshot..." &&
tools/upload_snapshot.sh OpenClonk-x86_64.AppImage OpenClonk-x86_64.AppImage.zsync ||
echo "Snapshot creation has failed"

File diff suppressed because it is too large Load Diff

50
COPYING
View File

@ -1,50 +0,0 @@
Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
Copyright (c) 2009-2016, The OpenClonk Team and contributors
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.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
(This is the ISC license. <http://opensource.org/licenses/ISC>)
Portions of the code have been contributed by other authors:
Copyright (c) 2006-2007 Alexander Post
Copyright (c) 2004-2013 Armin Burgmeier
Copyright (c) 2005-2006, 2008-2010 Asmageddon
Copyright (c) 2010, 2012 Benjamin Herr
Copyright (c) 2006, 2012 Bernhard Bonigl
Copyright (c) 2009-2010 Carl-Philip Hänsch
Copyright (c) 2001 Carlo Teubner
Copyright (c) 2009, 2011-2013 David Dormagen
Copyright (c) 2011-2012 Felix Wagner
Copyright (c) 2006 Florian Groß
Copyright (c) 2004-2012 Günther Brammer
Copyright (c) 2006-2008 Julian Raschke
Copyright (c) 2010-2012 Julius Michaelis
Copyright (c) 2010-2011 Maikel de Vries
Copyright (c) 2010 Manuel Riecke
Copyright (c) 2009 Mark Haßelbusch
Copyright (c) 2009-2012 Martin Plicht
Copyright (c) 1998-2009 Matthes Bender
Copyright (c) 2001 Michael Käser
Copyright (c) 2009 mizipzor
Copyright (c) 2009-2013 Nicolas Hake
Copyright (c) 2013 Oliver Schneider
Copyright (c) 2010 Peewee
Copyright (c) 2001-2011 Peter Wortmann
Copyright (c) 2012 Philipp Kern
Copyright (c) 2009-2010 Richard Gerum
Copyright (c) 2001-2013 Sven Eberhardt
Copyright (c) 2004-2005, 2009-2013 Tobias Zwick
Code inside the "thirdparty" directory has been included for convenience
and may be licensed under different terms. See the respective directories
for details.

View File

@ -1,35 +1,25 @@
<Engine and Tools>
Sven Eberhardt (Sven2)
Günther Brammer (Günther)
Nicolas Hake (Isilkor)
Armin Burgmeier (Clonk-Karl)
Lukas Werling (Luchs)
Günther Brammer (Günther)
Nicolas Hake (Isilkor)
Sven Eberhardt (Sven2)
Martin Plicht (Mortimer)
Julius Michaelis (JCaesar)
Peter Wortmann (PeterW)
<Scripting and Content>
Maikel de Vries (Maikel)
David Dormagen (Zapper)
Mark Haßelbusch (Marky)
Felix Wagner (Clonkonaut)
Bernhard Bonigl (Boni)
Julius Michaelis (Caesar)
<Art and Content>
Charles Spurrill (Ringwaul)
Richard Gerum (Randrian)
Timo Stabbert (Mimmo)
Matthias Rottländer (Matthi)
<Music and Sound>
David Oerther (ala)
Martin Strohmeier (K-Pone)
<Scripting and Content>
Maikel de Vries (Maikel)
Bernhard Bonigl (Boni)
Felix Wagner (Clonkonaut)
David Dormagen (Zapper)
<Administration>
<Coordination, Administration>
Tobias Zwick (Newton)
<Special Thanks to Contributors>
Contributors for OpenClonk 8.0: George Tokmaji (Fulgen), Martin Adam (Win), Merten Ehmig (pluto), Florian Graier (Nachtfalter), Philip Holzmann (Foaly), Dominik Bayerl (Kanibal), Linus Heckemann (sphalerite), Pyrit, Armin Schäfer, Tushar Maheshwari, jok, Tarte, Philip Kern (pkern), Arne Schauf (NativeException), Matthias Mailänder, marsmoon
Previous contributors: Tim Blume, Sven-Hendrik Haase, Carl-Philip Hänsch (Carli), Jan Heberer, Benjamin Herr (Loriel), Lauri Niskanen (Ape), Johannes Nixdorf (mixi), Misty de Meo, Fabian Pietsch, Manuel Rieke (MrBeast), Felix Riese (Fungiform), Sebastian Rühl, Oliver Schneider (ker), Lorenz Schwittmann, Alexander Semeniuk (AlteredARMOR), Daniel Theuke (ST-DDT), Andriel, Apfelclonk, Asmageddon, Checkmaty, Clonkine, dylanstrategie, Faby, grgecko, Gurkenglas, hasufell, Koronis, mizipzor, Peewee, Russell, Stan, TomyLobo
Also thanks to our Linux package maintainers Benedict Etzel (B_E), Linus Heckemann (sphalerite), Philip Kern (pkern), Matthias Mailänder, Julian Ospald (hasufell), Kevin Zheng, and more
Finally, a big thanks to Matthes Bender and all those who contributed to previous Clonk titles for the passion they put into the game and for agreeing to make Clonk open source.
<Thanks to Contributors>
Benjamin Herr (Loriel), Matthias Rottländer (Matthi), Felix Riese (Fungiform), Manuel Riecke (MrBeast), Benedict Etzel (B_E), Carl-Philip Hänsch (Carli), Alexander Semeniuk (AlteredARMOR), Florian Graier (Nachtfalter), Daniel Theuke (ST-DDT), Asmageddon, Merten Ehmig (Pluto), Mark Haßelbusch (Marky), Luchs, Peewee, Lauri Niskanen (Ape), Dominik Bayerl (Kanibal), Faby, Checkmaty, Gurkenglas, Clonkine, mizipzor, mixi, Pyrit, grgecko, Koronis, RedWolf Design GmbH and all those who contributed to previous Clonk titles for the passion they put into the game and for agreeing to make Clonk open source.

985
Makefile.am 100644
View File

@ -0,0 +1,985 @@
# Copyright (c) 2005-2011 Günther Brammer
# Copyright (c) 2009 Armin Burgmeier
# Copyright (c) 2010-2011 Nicolas Hake
# Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de
# 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.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ACLOCAL_AMFLAGS = -I autotools --install
bin_PROGRAMS = openclonk c4group puncher c4script
if MAPE
bin_PROGRAMS += mape
endif
EXTRA_PROGRAMS = tstc4netio gunzip4c4group
noinst_LIBRARIES = libmisc.a libc4script.a
# Some defines and warning options
if RECENT_GCC
WARNING_FLAGS = -Wall -Wextra -Wredundant-decls -Wendif-labels -Wpointer-arith \
-Wcast-qual -Wcast-align -Wwrite-strings -Winit-self -Wsign-promo \
-Wno-reorder -Wno-unused-parameter -Wnon-virtual-dtor -Woverloaded-virtual
##-Wmissing-format-attribute -Wdisabled-optimization -Wlogical-op
##-Weffc++ -Wold-style-cast -Wunsafe-loop-optimizations
else
WARNING_FLAGS = -Wall
endif
AM_CXXFLAGS = $(PTHREAD_CFLAGS) $(WINDOWS_CFLAGS) $(WARNING_FLAGS)
AM_CFLAGS = -Wall
AM_CPPFLAGS = \
-I$(builddir) \
-I$(srcdir)/src \
-I$(srcdir)/src/c4group \
-I$(srcdir)/src/config \
-I$(srcdir)/src/control \
-I$(srcdir)/src/editor \
-I$(srcdir)/src/game \
-I$(srcdir)/src/gamescript \
-I$(srcdir)/src/graphics \
-I$(srcdir)/src/gui \
-I$(srcdir)/src/landscape \
-I$(srcdir)/src/lib \
-I$(srcdir)/src/network \
-I$(srcdir)/src/object \
-I$(srcdir)/src/platform \
-I$(srcdir)/src/player \
-I$(srcdir)/src/res \
-I$(srcdir)/src/script \
-I$(srcdir)/thirdparty \
$(BOOST_CPPFLAGS)
BUILT_SOURCES = C4Version.h
CLEANFILES =
DISTCLEANFILES = C4Version.h
do_subst = sed -e 's,[@]C4PROJECT[@],'"$$(sed -n 's/SET(C4PROJECT\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4PROJECT_DOMAIN[@],'"$$(sed -n 's/SET(C4PROJECT_DOMAIN\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4PROJECT_TLD[@],'"$$(sed -n 's/SET(C4PROJECT_TLD\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4PROJECT_URL[@],http://www.openclonk.org,g' \
-e 's,[@]C4COPYRIGHT_YEAR[@],'"$$(date '+%Y')"',g' \
-e 's,[@]C4ENGINENAME[@],'"$$(sed -n 's/SET(C4ENGINENAME\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4ENGINENICK[@],'"$$(sed -n 's/SET(C4ENGINENICK\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4ENGINEID[@],org.openclonk." C4ENGINENICK ",g' \
-e 's,[@]C4XVER1[@],'"$$(sed -n 's/SET(C4XVER1\s\+\(.\+\))/\1/ p' $(srcdir)/Version.txt)"',g' \
-e 's,[@]C4XVER2[@],'"$$(sed -n 's/SET(C4XVER2\s\+\(.\+\))/\1/ p' $(srcdir)/Version.txt)"',g' \
-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,[@]OC_BUILD_ID[@],,g'
C4Version.h: $(srcdir)/src/C4Version.h.in $(srcdir)/Version.txt
$(do_subst) < $< > $@
WindowsGamesExplorer.xml: $(srcdir)/src/res/WindowsGamesExplorer.xml.in $(srcdir)/Version.txt
$(do_subst) < $< > $@
src/res/engine.o: WindowsGamesExplorer.xml
#various hacks to get dependency tracking working with a precompiled C4Include
if RECENT_GCC
BUILT_SOURCES += C4Include.h.gch
CLEANFILES += C4Include.h.gch
DISTCLEANFILES += @am__quote@$(DEPDIR)/C4Include.Po@am__quote@
# Adapted from the automake compile-command for normal source files.
# Has to be updated after certain changes in this file.
C4Include.h.gch: src/C4Include.h
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -x c++-header -MT C4Include.h.gch -MD -MP -MF $(DEPDIR)/C4Include.Tpo -c -o $@ $(srcdir)/src/C4Include.h
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/C4Include.Tpo $(DEPDIR)/C4Include.Po
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -x c++-header -c -o $@ $(srcdir)/src/C4Include.h
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/C4Include.Po@am__quote@
if am__fastdepCXX
AM_CXXFLAGS += -fpch-deps
endif
WARNING_FLAGS += -Winvalid-pch
endif
libmisc_a_SOURCES = \
src/c4group/C4Group.cpp \
src/c4group/C4Group.h \
src/c4group/C4Update.cpp \
src/c4group/C4Update.h \
src/c4group/CStdFile.cpp \
src/c4group/CStdFile.h \
src/lib/C4InputValidation.cpp \
src/lib/C4InputValidation.h \
src/lib/SHA1.h \
src/lib/Standard.cpp \
src/lib/Standard.h \
src/lib/StdBuf.cpp \
src/lib/StdBuf.h \
src/lib/StdCompiler.cpp \
src/lib/StdCompiler.h \
src/lib/C4Markup.cpp \
src/lib/C4Markup.h \
src/lib/StdResStr2.cpp \
src/lib/StdResStr2.h \
src/network/C4NetIO.cpp \
src/platform/GetTime.cpp \
src/platform/StdFile.cpp \
src/platform/StdFile.h \
src/platform/StdRegistry.cpp \
src/platform/StdRegistry.h \
src/platform/StdScheduler.cpp \
src/platform/StdScheduler.h \
src/zlib/gzio.c \
src/zlib/gzio.h \
src/zlib/zutil.h
libc4script_a_SOURCES = \
src/c4group/C4GroupSet.cpp \
src/c4group/C4GroupSet.h \
src/c4group/C4ComponentHost.cpp \
src/c4group/C4ComponentHost.h \
src/c4group/C4LangStringTable.cpp \
src/c4group/C4LangStringTable.h \
src/lib/C4Real.cpp \
src/lib/C4Real.h \
src/lib/C4Random.cpp \
src/lib/C4Random.h \
src/object/C4Id.cpp \
src/object/C4Id.h \
src/script/C4Aul.cpp \
src/script/C4AulDefFunc.h \
src/script/C4AulExec.cpp \
src/script/C4AulExec.h \
src/script/C4AulFunc.cpp \
src/script/C4AulFunc.h \
src/script/C4Aul.h \
src/script/C4AulLink.cpp \
src/script/C4AulParse.cpp \
src/script/C4PropList.cpp \
src/script/C4PropList.h \
src/script/C4Script.cpp \
src/script/C4ScriptHost.cpp \
src/script/C4ScriptHost.h \
src/script/C4StringTable.cpp \
src/script/C4StringTable.h \
src/script/C4ValueArray.cpp \
src/script/C4ValueArray.h \
src/script/C4Value.cpp \
src/script/C4Value.h \
src/script/C4ValueMap.cpp \
src/script/C4ValueMap.h
openclonk_SOURCES = \
src/C4Globals.cpp \
src/c4group/C4Components.h \
src/c4group/C4Extra.cpp \
src/c4group/C4Extra.h \
src/c4group/C4Language.cpp \
src/c4group/C4Language.h \
src/C4Include.h \
src/C4Prototypes.h \
src/C4Version.h.in \
src/config/C4Config.cpp \
src/config/C4Config.h \
src/config/C4Constants.h \
src/config/C4Reloc.cpp \
src/config/C4Reloc.h \
src/control/C4Control.cpp \
src/control/C4Control.h \
src/control/C4GameControl.cpp \
src/control/C4GameControl.h \
src/control/C4GameParameters.cpp \
src/control/C4GameParameters.h \
src/control/C4GameSave.cpp \
src/control/C4GameSave.h \
src/control/C4PlayerControl.cpp \
src/control/C4PlayerControl.h \
src/control/C4PlayerInfoConflicts.cpp \
src/control/C4PlayerInfo.cpp \
src/control/C4PlayerInfo.h \
src/control/C4Record.cpp \
src/control/C4Record.h \
src/control/C4RoundResults.cpp \
src/control/C4RoundResults.h \
src/control/C4Teams.cpp \
src/control/C4Teams.h \
src/editor/C4Console.cpp \
src/editor/C4ConsoleGUICommon.h \
src/editor/C4ConsoleGUI.h \
src/editor/C4Console.h \
src/editor/C4EditCursor.cpp \
src/editor/C4EditCursor.h \
src/editor/C4ObjectListDlg.cpp \
src/editor/C4ObjectListDlg.h \
src/editor/C4ToolsDlg.cpp \
src/editor/C4ToolsDlg.h \
src/editor/C4ViewportWindow.cpp \
src/editor/C4ViewportWindow.h \
src/game/C4Application.cpp \
src/game/C4Application.h \
src/game/C4FullScreen.cpp \
src/game/C4FullScreen.h \
src/game/C4Game.cpp \
src/game/C4Game.h \
src/game/C4GameVersion.h \
src/game/C4GraphicsSystem.cpp \
src/game/C4GraphicsSystem.h \
src/game/C4Physics.h \
src/game/C4Viewport.cpp \
src/game/C4Viewport.h \
src/gamescript/C4Effect.cpp \
src/gamescript/C4Effects.h \
src/gamescript/C4FindObject.cpp \
src/gamescript/C4FindObject.h \
src/gamescript/C4GameScript.cpp \
src/gamescript/C4Script.h \
src/gamescript/C4TransferZone.cpp \
src/gamescript/C4TransferZone.h \
src/graphics/Bitmap256.cpp \
src/graphics/Bitmap256.h \
src/graphics/C4Draw.cpp \
src/graphics/C4DrawD3D.cpp \
src/graphics/C4DrawD3D.h \
src/graphics/C4DrawD3DShader.cpp \
src/graphics/C4DrawD3DShader.h \
src/graphics/C4DrawGL.cpp \
src/graphics/C4DrawGLCtx.cpp \
src/graphics/C4DrawGL.h \
src/graphics/C4DrawMeshGL.cpp \
src/graphics/C4DrawT.cpp \
src/graphics/C4DrawT.h \
src/graphics/C4Draw.h \
src/graphics/C4Facet.cpp \
src/graphics/C4FacetEx.cpp \
src/graphics/C4FacetEx.h \
src/graphics/C4Facet.h \
src/graphics/C4FontLoader.cpp \
src/graphics/C4FontLoader.h \
src/graphics/C4GraphicsResource.cpp \
src/graphics/C4GraphicsResource.h \
src/graphics/C4Surface.cpp \
src/graphics/C4Surface.h \
src/graphics/C4SurfaceLoaders.cpp \
src/graphics/CSurface8.cpp \
src/graphics/CSurface8.h \
src/graphics/StdPNG.cpp \
src/graphics/StdPNG.h \
src/gui/C4ChatDlg.cpp \
src/gui/C4ChatDlg.h \
src/gui/C4DownloadDlg.cpp \
src/gui/C4DownloadDlg.h \
src/gui/C4FileSelDlg.cpp \
src/gui/C4FileSelDlg.h \
src/gui/C4Folder.cpp \
src/gui/C4Folder.h \
src/gui/C4GameDialogs.cpp \
src/gui/C4GameDialogs.h \
src/gui/C4GameLobby.cpp \
src/gui/C4GameLobby.h \
src/gui/C4GameMessage.cpp \
src/gui/C4GameMessage.h \
src/gui/C4GameOptions.cpp \
src/gui/C4GameOptions.h \
src/gui/C4GameOverDlg.cpp \
src/gui/C4GameOverDlg.h \
src/gui/C4GfxErrorDlg.cpp \
src/gui/C4GfxErrorDlg.h \
src/gui/C4GuiButton.cpp \
src/gui/C4GuiCheckBox.cpp \
src/gui/C4GuiComboBox.cpp \
src/gui/C4GuiContainers.cpp \
src/gui/C4Gui.cpp \
src/gui/C4GuiDialogs.cpp \
src/gui/C4GuiEdit.cpp \
src/gui/C4Gui.h \
src/gui/C4GuiLabels.cpp \
src/gui/C4GuiListBox.cpp \
src/gui/C4GuiMenu.cpp \
src/gui/C4GuiTabular.cpp \
src/gui/C4KeyboardInput.cpp \
src/gui/C4KeyboardInput.h \
src/gui/C4LoaderScreen.cpp \
src/gui/C4LoaderScreen.h \
src/gui/C4MainMenu.cpp \
src/gui/C4MainMenu.h \
src/gui/C4Menu.cpp \
src/gui/C4Menu.h \
src/gui/C4MessageBoard.cpp \
src/gui/C4MessageBoard.h \
src/gui/C4MessageInput.cpp \
src/gui/C4MessageInput.h \
src/gui/C4MouseControl.cpp \
src/gui/C4MouseControl.h \
src/gui/C4PlayerInfoListBox.cpp \
src/gui/C4PlayerInfoListBox.h \
src/gui/C4Scoreboard.cpp \
src/gui/C4Scoreboard.h \
src/gui/C4StartupAboutDlg.cpp \
src/gui/C4StartupAboutDlg.h \
src/gui/C4Startup.cpp \
src/gui/C4Startup.h \
src/gui/C4StartupMainDlg.cpp \
src/gui/C4StartupMainDlg.h \
src/gui/C4StartupNetDlg.cpp \
src/gui/C4StartupNetDlg.h \
src/gui/C4StartupOptionsDlg.cpp \
src/gui/C4StartupOptionsDlg.h \
src/gui/C4StartupPlrSelDlg.cpp \
src/gui/C4StartupPlrSelDlg.h \
src/gui/C4StartupScenSelDlg.cpp \
src/gui/C4StartupScenSelDlg.h \
src/gui/C4UpperBoard.cpp \
src/gui/C4UpperBoard.h \
src/landscape/C4Landscape.cpp \
src/landscape/C4Landscape.h \
src/landscape/C4LandscapeRenderClassic.cpp \
src/landscape/C4LandscapeRender.cpp \
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 \
src/landscape/C4Material.cpp \
src/landscape/C4Material.h \
src/landscape/C4MaterialList.cpp \
src/landscape/C4MaterialList.h \
src/landscape/C4Particles.cpp \
src/landscape/C4Particles.h \
src/landscape/C4PathFinder.cpp \
src/landscape/C4PathFinder.h \
src/landscape/C4PXS.cpp \
src/landscape/C4PXS.h \
src/landscape/C4Scenario.cpp \
src/landscape/C4Scenario.h \
src/landscape/C4ScenarioSection.cpp \
src/landscape/C4Sky.cpp \
src/landscape/C4Sky.h \
src/landscape/C4SolidMask.cpp \
src/landscape/C4SolidMask.h \
src/landscape/C4Texture.cpp \
src/landscape/C4Texture.h \
src/landscape/C4Weather.cpp \
src/landscape/C4Weather.h \
src/lib/C4LogBuf.cpp \
src/lib/C4LogBuf.h \
src/lib/C4Log.cpp \
src/lib/C4Log.h \
src/lib/C4NameList.cpp \
src/lib/C4NameList.h \
src/lib/C4Rect.cpp \
src/lib/C4Rect.h \
src/lib/C4RTF.cpp \
src/lib/C4RTF.h \
src/lib/C4Stat.cpp \
src/lib/C4Stat.h \
src/lib/PathFinder.cpp \
src/lib/PathFinder.h \
src/lib/StdAdaptors.h \
src/lib/StdBase64.cpp \
src/lib/StdBase64.h \
src/lib/StdColors.h \
src/lib/StdMesh.cpp \
src/lib/StdMesh.h \
src/lib/StdMeshLoaderBinaryChunks.cpp \
src/lib/StdMeshLoaderBinaryChunks.h \
src/lib/StdMeshLoaderBinary.cpp \
src/lib/StdMeshLoaderDataStream.h \
src/lib/StdMeshLoader.h \
src/lib/StdMeshLoaderXml.cpp \
src/lib/StdMeshMaterial.cpp \
src/lib/StdMeshMaterial.h \
src/lib/StdMeshMath.cpp \
src/lib/StdMeshMath.h \
src/lib/StdMeshUpdate.cpp \
src/lib/StdMeshUpdate.h \
src/lib/StdResStr.h \
src/network/C4Client.cpp \
src/network/C4Client.h \
src/network/C4GameControlNetwork.cpp \
src/network/C4GameControlNetwork.h \
src/network/C4InteractiveThread.cpp \
src/network/C4InteractiveThread.h \
src/network/C4League.cpp \
src/network/C4League.h \
src/network/C4NetIO.h \
src/network/C4Network2Client.cpp \
src/network/C4Network2Client.h \
src/network/C4Network2.cpp \
src/network/C4Network2Dialogs.cpp \
src/network/C4Network2Dialogs.h \
src/network/C4Network2Discover.cpp \
src/network/C4Network2Discover.h \
src/network/C4Network2.h \
src/network/C4Network2IO.cpp \
src/network/C4Network2IO.h \
src/network/C4Network2IRC.cpp \
src/network/C4Network2IRC.h \
src/network/C4Network2Players.cpp \
src/network/C4Network2Players.h \
src/network/C4Network2Reference.cpp \
src/network/C4Network2Reference.h \
src/network/C4Network2Res.cpp \
src/network/C4Network2ResDlg.cpp \
src/network/C4Network2Res.h \
src/network/C4Network2Stats.cpp \
src/network/C4Network2Stats.h \
src/network/C4Network2UPnP.h \
src/network/C4Packet2.cpp \
src/network/C4PacketBase.h \
src/object/C4Action.cpp \
src/object/C4Command.cpp \
src/object/C4Command.h \
src/object/C4Def.cpp \
src/object/C4DefGraphics.cpp \
src/object/C4DefGraphics.h \
src/object/C4Def.h \
src/object/C4DefList.cpp \
src/object/C4DefList.h \
src/object/C4GameObjects.cpp \
src/object/C4GameObjects.h \
src/object/C4IDList.cpp \
src/object/C4IDList.h \
src/object/C4InfoCore.cpp \
src/object/C4InfoCore.h \
src/object/C4MeshAnimation.cpp \
src/object/C4MeshAnimation.h \
src/object/C4Movement.cpp \
src/object/C4ObjectCom.cpp \
src/object/C4ObjectCom.h \
src/object/C4Object.cpp \
src/object/C4Object.h \
src/object/C4ObjectInfo.cpp \
src/object/C4ObjectInfo.h \
src/object/C4ObjectInfoList.cpp \
src/object/C4ObjectInfoList.h \
src/object/C4ObjectList.cpp \
src/object/C4ObjectList.h \
src/object/C4ObjectMenu.cpp \
src/object/C4ObjectMenu.h \
src/object/C4ObjectPtr.cpp \
src/object/C4ObjectPtr.h \
src/object/C4ObjectScript.cpp \
src/object/C4Sector.cpp \
src/object/C4Sector.h \
src/object/C4Shape.cpp \
src/object/C4Shape.h \
src/platform/C4App.cpp \
src/platform/C4App.h \
src/platform/C4AppWin32Impl.h \
src/platform/C4FileMonitor.cpp \
src/platform/C4FileMonitor.h \
src/platform/C4GamePadCon.cpp \
src/platform/C4GamePadCon.h \
src/platform/C4MusicFile.cpp \
src/platform/C4MusicFile.h \
src/platform/C4MusicSystem.cpp \
src/platform/C4MusicSystem.h \
src/platform/C4SoundLoaders.cpp \
src/platform/C4SoundLoaders.h \
src/platform/C4SoundSystem.cpp \
src/platform/C4SoundSystem.h \
src/platform/C4StdInProc.cpp \
src/platform/C4StdInProc.h \
src/platform/C4Video.cpp \
src/platform/C4Video.h \
src/platform/C4Window.h \
src/platform/C4windowswrapper.h \
src/platform/PlatformAbstraction.cpp \
src/platform/PlatformAbstraction.h \
src/platform/StdSync.h \
src/platform/StdVideo.cpp \
src/platform/StdVideo.h \
src/player/C4Player.cpp \
src/player/C4Player.h \
src/player/C4PlayerList.cpp \
src/player/C4PlayerList.h \
src/player/C4RankSystem.cpp \
src/player/C4RankSystem.h \
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 \
src/script/C4AulDebug.cpp \
src/script/C4AulDebug.h \
thirdparty/timsort/sort.h \
thirdparty/tinyxml/tinystr.cpp \
thirdparty/tinyxml/tinystr.h \
thirdparty/tinyxml/tinyxml.cpp \
thirdparty/tinyxml/tinyxmlerror.cpp \
thirdparty/tinyxml/tinyxml.h \
thirdparty/tinyxml/tinyxmlparser.cpp
if WIN32
openclonk_SOURCES += \
src/platform/C4CrashHandlerWin32.cpp \
src/res/engine.rc \
src/res/resource.h
endif
if MACOSX
openclonk_SOURCES += \
src/platform/C4AppDelegate.h \
src/platform/C4AppDelegate.mm \
src/platform/C4FileMonitorMac.mm
else
openclonk_SOURCES += \
src/game/ClonkMain.cpp
endif
if SDL_MAIN_LOOP
openclonk_SOURCES += \
src/platform/C4AppSDL.cpp \
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 \
src/platform/C4AppGTK.cpp \
src/platform/C4AppGTKImpl.h \
src/platform/C4WindowGTK.cpp
else
if CONSOLE
openclonk_SOURCES += \
src/platform/C4AppT.cpp
else
if WIN32
openclonk_SOURCES += \
src/editor/C4ConsoleWin32.cpp \
src/platform/C4WindowWin32.cpp \
src/platform/StdJoystick.cpp \
src/platform/StdJoystick.h
endif
if MACOSX
openclonk_SOURCES += \
src/editor/C4ConsoleCocoa.mm \
src/editor/C4EditorWindowController.h \
src/editor/C4EditorWindowController.mm \
src/graphics/C4DrawGLMac.h \
src/graphics/C4DrawGLMac.mm \
src/platform/C4AppDelegate+MainMenuActions.h \
src/platform/C4AppDelegate+MainMenuActions.mm \
src/platform/C4AppMac.mm \
src/platform/C4WindowController.h \
src/platform/C4WindowController.mm \
src/platform/C4WindowMac.mm \
src/platform/CocoaKeycodeMap.h \
src/platform/ObjectiveCAssociated.h
endif
endif
endif
endif
if AUTOUPDATE
openclonk_SOURCES += \
src/gui/C4UpdateDlg.cpp \
src/gui/C4UpdateDlg.h
endif
if LIBUPNP
openclonk_SOURCES += src/network/C4Network2UPnPLinux.cpp
else
if NATUPNP
openclonk_SOURCES += src/network/C4Network2UPnPWin32.cpp
else
openclonk_SOURCES += src/network/C4Network2UPnPDummy.cpp
endif
endif
openclonk_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(GLEW_CFLAGS) \
$(GTK_CFLAGS) \
$(OPENAL_CFLAGS) \
$(FREETYPE_CFLAGS) \
$(SDL_CFLAGS) \
$(LIBUPNP_CFLAGS)
openclonk_LDADD = \
libc4script.a \
libmisc.a \
$(LDADD) \
$(LIBICONV) \
$(GTK_LIBS) \
$(OPENAL_LIBS) \
$(FREETYPE_LIBS) \
$(SDL_LIBS) \
$(PTHREAD_LIBS) \
$(Z_LIBS) \
$(CLONK_LIBS) \
$(LIBUPNP_LIBS)
# build the resources
.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
if WIN32
c4group_SOURCES += src/c4group/Resource.rc
endif
c4group_LDADD = \
libmisc.a \
$(LDADD) \
$(LIBICONV) \
$(Z_LIBS) \
$(PTHREAD_LIBS)
## gunzip4c4group
gunzip4c4group_SOURCES = \
src/lib/C4SimpleLog.cpp \
src/c4group/gunzip4c4group.cpp
gunzip4c4group_LDADD = \
libmisc.a \
$(LDADD) \
$(Z_LIBS) \
$(PTHREAD_LIBS)
## puncher
puncher_SOURCES = \
src/lib/C4SimpleLog.cpp \
src/netpuncher/main.cpp
puncher_LDADD = \
libmisc.a \
$(LDADD) \
$(PTHREAD_LIBS)
if WIN32
puncher_LDADD += -lws2_32
endif
## tstc4netio
tstc4netio_SOURCES = \
src/lib/C4SimpleLog.cpp \
src/netio/TstC4NetIO.cpp
tstc4netio_LDADD = \
libmisc.a \
$(LDADD) \
$(Z_LIBS) \
$(PTHREAD_LIBS)
if WIN32
tstc4netio_LDADD += -lws2_32
endif
## c4script shell
c4script_SOURCES = \
src/lib/C4SimpleLog.cpp \
include/c4script/c4script.h \
src/script/C4ScriptMain.cpp \
src/script/C4ScriptStandalone.cpp
c4script_LDADD = \
libc4script.a \
libmisc.a \
$(LDADD) \
$(Z_LIBS)
## mape
if MAPE
mape_SOURCES = \
mape-icons.h \
src/landscape/C4MapCreatorS2.cpp \
src/landscape/C4Material.cpp \
src/landscape/C4Scenario.cpp \
src/landscape/C4Texture.cpp \
src/lib/C4NameList.cpp \
src/lib/C4Rect.cpp \
src/mape/configfile.c \
src/mape/configfile.h \
src/mape/cpp-handles/group-handle.cpp \
src/mape/cpp-handles/group-handle.h \
src/mape/cpp-handles/log-handle.cpp \
src/mape/cpp-handles/log-handle.h \
src/mape/cpp-handles/mapgen-handle.cpp \
src/mape/cpp-handles/mapgen-handle.h \
src/mape/cpp-handles/material-handle.cpp \
src/mape/cpp-handles/material-handle.h \
src/mape/cpp-handles/random-handle.cpp \
src/mape/cpp-handles/random-handle.h \
src/mape/cpp-handles/stub-handle.cpp \
src/mape/cpp-handles/texture-handle.cpp \
src/mape/cpp-handles/texture-handle.h \
src/mape/cpp-handles/version-handle.cpp \
src/mape/cpp-handles/version-handle.h \
src/mape/diskview.c \
src/mape/diskview.h \
src/mape/editview.c \
src/mape/editview.h \
src/mape/fileicon.c \
src/mape/fileicon.h \
src/mape/forward.h \
src/mape/group.c \
src/mape/group.h \
src/mape/header.c \
src/mape/header.h \
src/mape/iconview.c \
src/mape/iconview.h \
src/mape/mape.c \
src/mape/mapgen.c \
src/mape/mapgen.h \
src/mape/material.c \
src/mape/material.h \
src/mape/mattexview.c \
src/mape/mattexview.h \
src/mape/preferences.c \
src/mape/preferences.h \
src/mape/preferencesdialog.c \
src/mape/preferencesdialog.h \
src/mape/preview.c \
src/mape/preview.h \
src/mape/random.c \
src/mape/random.h \
src/mape/statusbar.c \
src/mape/statusbar.h \
src/mape/texture.c \
src/mape/texture.h \
src/mape/window.c \
src/mape/window.h \
src/script/C4Script.cpp
mape_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(MAPE_CFLAGS)
mape_LDADD = \
libc4script.a \
libmisc.a \
$(LDADD) \
$(MAPE_LIBS) \
$(Z_LIBS)
mape_icons = \
$(srcdir)/src/res/ocd.ico \
$(srcdir)/src/res/ocf.ico \
$(srcdir)/src/res/ocg.ico \
$(srcdir)/src/res/ocm.ico \
$(srcdir)/src/res/ocs.ico
mape-icons.h: $(mape_icons)
gdk-pixbuf-csource --raw --static --build-list \
mape_icon_ocd "$(srcdir)/src/res/ocd.ico" \
mape_icon_ocf "$(srcdir)/src/res/ocf.ico" \
mape_icon_ocg "$(srcdir)/src/res/ocg.ico" \
mape_icon_ocm "$(srcdir)/src/res/ocm.ico" \
mape_icon_ocs "$(srcdir)/src/res/ocs.ico" \
> $@
BUILT_SOURCES += mape-icons.h
CLEANFILES += mape-icons.h
endif
## documentation
dist_doc_DATA = planet/AUTHORS planet/COPYING licenses/LGPL.txt Credits.txt
## game data
c4groups = \
Graphics.ocg \
Material.ocg \
Music.ocg \
Sound.ocg \
System.ocg \
Objects.ocd \
Arena.ocf \
Parkour.ocf \
Settlement.ocf \
Tutorial.ocf
CLEANFILES += $(c4groups)
pkgdata_DATA = $(c4groups)
AM_CXXFLAGS += -DOC_SYSTEM_DATA_DIR=\"${pkgdatadir}\"
%.ocg: $(srcdir)/planet/%.ocg c4group$(EXEEXT)
./c4group$(EXEEXT) $< -t $@ || c4group $< -t $@
%.ocd: $(srcdir)/planet/%.ocd c4group$(EXEEXT)
./c4group$(EXEEXT) $< -t $@ || c4group $< -t $@
%.ocf: $(srcdir)/planet/%.ocf c4group$(EXEEXT)
./c4group$(EXEEXT) $< -t $@ || c4group $< -t $@
## windows setup.exe
if WIN32
tools/install/firewall.dll: $(srcdir)/tools/install/firewall.cpp
mkdir -p tools/install
$(CXX) -shared -o tools/install/firewall.dll $(srcdir)/tools/install/firewall.cpp -lole32 -loleaut32
setup_openclonk.exe: $(srcdir)/tools/install/oc.nsi c4group$(EXEEXT) openclonk$(EXEEXT) $(c4groups)
makensis -NOCD -DSRCDIR=$(srcdir) '-DPROGRAMFILES=$$PROGRAMFILES' \
-DPRODUCT_NAME="$$(sed -n 's/SET(C4ENGINENAME\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)$$(sed -n 's/SET(C4VERSIONBUILDNAME\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)" \
-DPRODUCT_COMPANY="$$(sed -n 's/SET(C4PROJECT\s\+"\(.\+\)")/\1/ p' $(srcdir)/Version.txt)" \
$< "-XOutFile $@"
endif
## other stuff
EXTRA_DIST = \
planet \
Version.txt \
CMakeLists.txt \
Makefile.am \
config.h.cmake \
planet/System.ocg/LanguageUS.txt \
planet/System.ocg/LanguageDE.txt \
clonk.anjuta \
licenses \
src/netio/NetIO.dsp \
src/netpuncher/Puncher.dsp \
src/c4group/Resource.rc \
src/res/brush1.bmp \
src/res/Brush2.bmp \
src/res/Brush.bmp \
src/res/Brush.h \
src/res/Brush_Trans.png \
src/res/C4K.icns \
src/res/C4P.icns \
src/res/c4x.xpm \
src/res/Clonk.icns \
src/res/ClonkWindow.xib \
src/res/ConsoleGUIWindow.xib \
src/res/ConsoleWindow.xib \
src/res/Cursor2.bmp \
src/res/Cursor.bmp \
src/res/Cursor.h \
src/res/Cursor_Trans.png \
src/res/dynamic1.bmp \
src/res/Dynamic.h \
src/res/Dynamic_Trans.png \
src/res/Exact.h \
src/res/Exact_Trans.png \
src/res/fill1.bmp \
src/res/Fill.bmp \
src/res/Fill.h \
src/res/Fill_Trans.png \
src/res/FullscreenWindow.xib \
src/res/Game.pal \
src/res/Grab.bmp \
src/res/Halt2.bmp \
src/res/Halt.bmp \
src/res/Halt.h \
src/res/Halt_Trans.png \
src/res/ift1.bmp \
src/res/IFT.bmp \
src/res/Ift.h \
src/res/Ift_Trans.png \
src/res/Info.plist \
src/res/line1.bmp \
src/res/Line.bmp \
src/res/Line.h \
src/res/Line_Trans.png \
src/res/MainMenu.xib \
src/res/mouse1.bmp \
src/res/mouse.bmp \
src/res/Mouse.h \
src/res/Mouse_Trans.png \
src/res/NoIFT.bmp \
src/res/NoIft.h \
src/res/NoIft_Trans.png \
src/res/ocb.ico \
src/res/ocd.icns \
src/res/ocd.ico \
src/res/ocf.icns \
src/res/ocf.ico \
src/res/ocg.icns \
src/res/ocg.ico \
src/res/oc.ico \
src/res/oci.ico \
src/res/ocl.ico \
src/res/ocm.ico \
src/res/ocp.ico \
src/res/ocs.icns \
src/res/ocs.ico \
src/res/ocu.icns \
src/res/ocu.ico \
src/res/ocv.ico \
src/res/picker1.bmp \
src/res/Picker.h \
src/res/Picker_Trans.png \
src/res/Play2.bmp \
src/res/Play.bmp \
src/res/Play.h \
src/res/Play_Trans.png \
src/res/rect1.bmp \
src/res/Rectangle.bmp \
src/res/Rect.h \
src/res/Rect_Trans.png \
src/res/static1.bmp \
src/res/Static.h \
src/res/Static_Trans.png \
src/res/English.lproj/InfoPlist.strings \
src/res/English.lproj/Localizable.strings \
src/res/German.lproj/Localizable.strings \
src/res/SDLMain.nib/objects.nib

47
README
View File

@ -1,47 +0,0 @@
Requirements
============
You should be able to build OpenClonk with any C++ compiler that supports
ISO C++14. That said, on Windows, we recommend using Microsoft Visual C++
2015 or higher; the Express edition will be sufficient. On Linux, you will
be fine with GNU g++ 4.9 or later. Apple users should use a clang-based
XCode version.
To generate project files for your chosen build system, you will also have to
install CMake from http://www.cmake.org/.
Additionally, OpenClonk depends on a number of third-party libraries:
- zlib (http://zlib.net/)
- libpng (http://www.libpng.org/pub/png/libpng.html)
- libjpeg-turbo (http://sourceforge.net/projects/libjpeg-turbo/files/)
- FreeType (http://www.freetype.org/)
- The OpenGL Extension Wrangler Library (http://glew.sourceforge.net/)
- FreeALUT (https://github.com/vancegroup/freealut)
- libogg and libvorbis (https://www.xiph.org/downloads/)
- Qt >= 5.7 (https://www.qt.io/download-open-source/)
OS X Specific
=============
OpenClonk supports OS X versions 10.8 "Mountain Lion" and later.
If you are using brew (https://github.com/mxcl/homebrew) or MacPorts
(http://www.macports.org/), the packages you'll have to install are:
libjpeg, libpng, freetype, glew, libogg, libvorbis
Linux Specific
==============
For building OpenClonk on Linux, you need the following libraries in addition
to the ones listed above:
- SDL 2.0 (https://www.libsdl.org/download-2.0.php)
- libGL (http://www.mesa3d.org/)
- OpenAL Soft >= 1.13 (https://github.com/kcat/openal-soft)
- miniupnpc (http://miniupnp.free.fr/)
- libxrandr
Most distributions should provide these dependencies via their packaging
system. At least gcc-4.9 is required.
Windows Specific
================
In addition to the libraries above, you will need one more if you want to
target Windows:
- OpenAL Soft (http://kcat.strangesoft.net/openal.html)
To create an installer, you will also need the Nullsoft Install System
(http://nsis.sourceforge.net/). To create the installer, build the "setup" target.

74
README.linux.txt 100644
View File

@ -0,0 +1,74 @@
Requirements
============
To build on DEB-based Linux distributions (Debian, Ubuntu etc.) you need the
following packages:
make gcc g++
cmake OR automake autoconf
libc6-dev libx11-dev libxxf86vm-dev libxrandr-dev libxpm-dev libglew1.5-dev
libgl1-mesa-dev libpng12-dev libsdl1.2-dev libsdl-mixer1.2-dev libgtk2.0-dev
libjpeg62-dev zlib1g-dev libboost-dev
(Most of those packages can be substituted with a newer version if required,
for example libglew1.6-dev instead of libglew1.5-dev.)
To build on RPM-based Linux distributions (Red Hat, Fedora, Mandriva,
SuSE etc.) you need the following packages:
make gcc gcc-c++
cmake OR automake autoconf
libX11-devel libXxf86vm-devel libXrandr-devel libXpm-devel glew-devel
mesa-libGL-devel libpng-devel SDL-devel SDL_mixer1.2-dev gtk2-devel
libjpeg-devel zlib-devel boost-devel
Build using cmake
=================
To build OpenClonk, execute the following command inside of the source tree:
cmake . && make
By default, the binary will be built without debugging support. If you want
to generate a debug build, pass the parameter -DCMAKE_BUILD_TYPE=Debug to
your cmake invocation.
Please note that you do not need to build a Debug binary if you only want to
debug C4Script code.
You can see other build variables with:
cmake . -N -L
Build using autotools
=====================
If you build from version control, you need to run this:
autoreconf -i && ./configure && make
To build from tarball, run this:
./configure && make
If you want a debug build, pass --enable-debug to configure. Other options are
listed by ./configure --help.
On subsequent build runs, you only have to execute make.
Running
=======
You can run the game from the build directory:
./openclonk
See docs/sdk/cmdline.xml for the supported command line options.
Or install it with this:
make install

47
README.mac.txt 100644
View File

@ -0,0 +1,47 @@
Requirements
============
OSX 10.6 or higher (might also work with 10.5)
an Intel mac
brew (https://github.com/mxcl/homebrew) or macports (http://www.macports.org/)
Xcode
Apple X11
CMake (http://www.cmake.org/)
Build
=====
-Install dependencies using brew or port (libjpeg, libpng, freetype, glew, libogg, libvorbis, libvorbisfile)
-Launch the CMake GUI application
-Click Browse Source… button, navigate to your openclonk repository folder
-Also Specify location where you want to build
-Click Configure and use default native compilers
-Wait
-<Potentially include additional steps to make CMake find the right libraries>
-If you want 64-bit builds set the CMAKE_OSX_ARCHITECTURES setting to "x86_64"
-For universal builds set it to "x86_64 i386", but then you'll also need universal versions of the dependencies
-Click Configure button again for good measure
-Click Generate
-Launch xcode and load the project. Select the desired configuration and build.
It should be pretty straight forward, hopefully.
Additional CMake hints
=====================
FREETYPE_LIBRARY should be set to /usr/X11/lib/libfreetype.6.dylib
ZLIB_LIBRARY to /usr/lib/libz.dylib
ZLIB_INCLUDE_DIR to /usr/include
Situation with Xcode 4.3+
========================
[This applies only to CMake versions prior to 2.8-8, later versions should deal with Xcode 4.3+ just fine]
Xcode is now a self-contained application bundle which confuses CMake.
The CMake git repo contains necessary fixes but those haven't been incorporated into a new CMake release yet so to use those you have to build the cmake command line tool yourself by
* cloning git://cmake.org/cmake.git
* running git checkout next
* running ./configure, make and sudo make install
The project generation command I (Mortimer) used was `cmake -G Xcode -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++`, obviously specifying clang as the compiler. There is a related CMake option called USE_APPLE_CLANG which should be ON by default.
After that I had a proper Xcode 4.3 project.
To use the CMake GUI for setting some library paths I put the self-built cmake command from /usr/local/bin into CMake 2.8-7.app/Contents/bin/ but one could have probably done that by editing CMakeCache.txt or setting via however the cli syntax for setting variables is.

61
README.windows.txt 100644
View File

@ -0,0 +1,61 @@
Requirements
============
You can build on Windows using either:
* vc10 (Microsoft Visual C++ 2010)
- you need CMake (http://www.cmake.org/cmake/resources/software.html) to
create the "solution"
- you might have to set the correct DXSDK include and library directories
* MinGW and MSYS
- plus DXSDK 9 (if you want DirectX support)
* Some other compilers and IDEs which are supported by CMake might also work
OpenClonk requires some additional libraries. Prebuilt versions of them can be
found on http://openclonk.org.
Building the installer
======================
The installer is created with NSIS. makensis needs to be in the PATH, and
the dlls used by openclonk in the build directory. To create the installer,
build the "setup" target if using CMake, or if using autotools, run:
make setup_openclonk.exe
Get NSIS from http://nsis.sourceforge.net/.
Notes for MinGW
===============
You need gcc, g++, mingw-runtime, w32api, msys, msyscore, autoconf, automake,
and any packages needed by these.
Get the library package from openclonk.org and unpack it into the mingw
directory.
If you want DirectX support, get a DirectX 9 SDK from Microsoft. Copy the
contents of its include dir to the include dir of your MinGW installation,
and pass --with-directx to configure below.
Start msys (your MinGW directory, e.g. C:\MinGW -> msys.bat),
cd to this directory, and execute:
autoreconf -i && ./configure && make
To compile a debugbuild, pass --enable-debug to configure. Other options are
listed by ./configure --help.
On subsequent build runs, you only have to execute make.
If you want to separate the source directory and the output files, you can call
configure from another directory. You can call configure by it's relative path,
but using the full path helps gdb find the source files. Example:
mkdir build
cd build
/path/to/clonksource/configure --with-directx CXXFLAGS='-Os'
make

View File

@ -1,16 +0,0 @@
'Clonk' is a registered trademark of Matthes Bender. It may be used within
software products which are using source code or game content as made public
on the Clonk website (or derived from such) with the following limitations:
If the word 'Clonk' is used as the name of anything in your software product
then you must include the following notice in a suitable place (e.g. credits
screen): 'Clonk' is a registered trademark of Matthes Bender.
If the title of your software product contains the word 'Clonk' then you must
PREFIX the word with an added name of your choosing, e.g. 'MyClonk' or
'PortableClonk' and you must include the trademark notice above in a suitable
place (e.g. credits screen or splash screen).
If you are making your source code or game content available to other parties
in a way which allows adaptation you must include a copy of this license along
with any other applicable licenses.

View File

@ -1,15 +1,3 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2009-2018, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
############################################################################
# Project version information
@ -21,10 +9,69 @@ SET(C4PROJECT_TLD "org")
SET(C4PROJECT_URL "http://${C4PROJECT_DOMAIN}.${C4PROJECT_TLD}")
SET(C4ENGINENAME "OpenClonk")
SET(C4ENGINENICK "openclonk")
SET(C4ENGINEID "${C4PROJECT_TLD}.${C4PROJECT_DOMAIN}.${C4ENGINENICK}")
SET(C4XVER1 9)
SET(C4XVER2 0)
SET(C4XVER1 5)
SET(C4XVER2 3)
SET(C4XVER3 90)
# Set this variable to any string for pre-release versions, like "alpha" or
# "rc1". Don't supply a value (FALSE) for release versions.
SET(C4VERSIONEXTRA "alpha")
# C4VERSIONBUILDNAME should be witty and somewhat frequently changing
# for alpha and beta releases, and meaningful and stable for stable releases.
# Both variables need to start with a space if they aren't empty.
SET(C4VERSIONBUILDNAME " Beyond the Rocks")
SET(C4VERSIONEXTRA " Delta")
############################################################################
# Get revision from Git
############################################################################
include(GitGetChangesetID)
git_get_changeset_id(C4REVISION)
############################################################################
# Get year
############################################################################
IF(CMAKE_HOST_UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE DATE)
ELSEIF(CMAKE_HOST_WIN32)
EXECUTE_PROCESS(COMMAND "cscript.exe" "//nologo" "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_current_year.vbs" OUTPUT_VARIABLE DATE)
ENDIF()
STRING(REGEX REPLACE "(.+)\n" "\\1" YEARFIXED "${DATE}")
SET(C4COPYRIGHT_YEAR ${YEARFIXED})
############################################################################
# Build version strings
############################################################################
SET(C4ENGINECAPTION "${C4ENGINENAME}{$C4VERSIONBUILDNAME}")
set(C4ENGINEINFO "${C4ENGINENAME}")
set(C4VERSION "${C4XVER1}.${C4XVER2}.${C4XVER3}")
if(C4XVER4 LESS 10)
set(C4VERSION "${C4VERSION} [00${C4XVER4}]")
elseif(C4XVERBUILD LESS 100)
set(C4VERSION "${C4VERSION} [0${C4XVER4}]")
else()
set(C4VERSION "${C4VERSION} [${C4XVER4}]")
endif()
if(NOT ${C4VERSIONEXTRA} STREQUAL "")
set(C4ENGINEINFO "${C4ENGINENAME} ${C4VERSIONEXTRA}")
set(C4VERSION "${C4VERSION} ${C4VERSIONEXTRA}")
endif()
if(WIN32)
set(C4VERSION "${C4VERSION} win")
elseif(APPLE)
set(C4VERSION "${C4VERSION} mac")
elseif(UNIX)
set(C4VERSION "${C4VERSION} unix")
else()
set(C4VERSION "${C4VERSION} strange")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/C4Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/C4Version.h ESCAPE_QUOTES)
if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/res/WindowsGamesExplorer.xml.in ${CMAKE_CURRENT_BINARY_DIR}/WindowsGamesExplorer.xml ESCAPE_QUOTES)
endif()

View File

@ -1,32 +0,0 @@
version: "{build}"
pull_requests:
do_not_increment_build_number: true
shallow_clone: true
cache: ..\openclonk-cache
image: Visual Studio 2017
configuration: RelWithDebInfo
platform:
- x64
install:
- ps: "& $env:APPVEYOR_BUILD_FOLDER\\tools\\ci\\appv-Install.ps1"
before_build:
- ps: "& $env:APPVEYOR_BUILD_FOLDER\\tools\\ci\\appv-BeforeBuild.ps1"
build:
project: ../openclonk-build/openclonk.sln
parallel: true
verbosity: minimal
# The after_build and test_script scripts need to be called in a real
# powershell instance because they call into the MSBuild API, which has issues
# finding its data files when called from AppVeyor's powershell host, because
# it attempts to read the application config instead of the registry to find
# them (starting with MSBuild 15, which ships with Visual Studio 2017).
after_build:
- cmd: powershell -NoLogo -NoProfile -ExecutionPolicy Unrestricted -Command "& $env:APPVEYOR_BUILD_FOLDER\\tools\\ci\\appv-AfterBuild.ps1"
test_script:
- cmd: powershell -NoLogo -NoProfile -ExecutionPolicy Unrestricted -Command "& $env:APPVEYOR_BUILD_FOLDER\\tools\\ci\\appv-Test.ps1"
deploy: off

View File

@ -0,0 +1,258 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# DESCRIPTION
#
# Test for the Boost C++ libraries of a particular version (or newer)
#
# If no path to the installed boost library is given the macro searchs
# under /usr, /usr/local, /opt and /opt/local and evaluates the
# $BOOST_ROOT environment variable. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
#
# And sets:
#
# HAVE_BOOST
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Peter Adolphs
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 20
AC_DEFUN([AX_BOOST_BASE],
[
AC_ARG_WITH([boost],
[AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
[use Boost library from a standard location (ARG=yes),
from the specified location (ARG=<path>),
or disable it (ARG=no)
@<:@ARG=yes@:>@ ])],
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
],
[want_boost="yes"])
AC_ARG_WITH([boost-libdir],
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
[
if test -d "$withval"
then
ac_boost_lib_path="$withval"
else
AC_MSG_ERROR(--with-boost-libdir expected directory name)
fi
],
[ac_boost_lib_path=""]
)
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
succeeded=no
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
libsubdirs="lib"
ax_arch=`uname -m`
if test $ax_arch = x86_64 -o $ax_arch = ppc64 -o $ax_arch = s390x -o $ax_arch = sparc64; then
libsubdirs="lib64 lib lib64"
fi
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_CPPFLAGS="-I$ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
break
fi
done
elif test "$cross_compiling" != yes; then
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
for libsubdir in $libsubdirs ; do
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
break;
fi
done
fi
dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter
if test "$ac_boost_lib_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_lib_path"
fi
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then
_version=0
if test "$ac_boost_path" != ""; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
done
fi
else
if test "$cross_compiling" != yes; then
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
fi
done
fi
done
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$best_path/$libsubdir"
fi
fi
if test "x$BOOST_ROOT" != "x"; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
fi
fi
fi
fi
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
fi
if test "$succeeded" != "yes" ; then
if test "$_version" = "0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi
# execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3])
else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2])
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

View File

@ -0,0 +1,72 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS

View File

@ -0,0 +1,75 @@
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Modified for Clonk to not do all that weird stuff
AC_DEFUN([_AX_ICONV_LINK],
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
dnl Search for libiconv and define LIBICONV and INCICONV
dnl accordingly.
AC_CACHE_CHECK(for iconv, ax_cv_func_iconv, [
ax_cv_func_iconv="no, consider installing GNU libiconv"
ax_cv_lib_iconv=no
LIBICONV=""
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
ax_cv_func_iconv=yes)
if test "$ax_cv_func_iconv" != yes; then
ax_save_LIBS="$LIBS"
LIBS="$LIBS -liconv"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
ax_cv_lib_iconv=yes
ax_cv_func_iconv=yes
LIBICONV=-liconv)
LIBS="$ax_save_LIBS"
fi
])
if test "$ax_cv_func_iconv" = yes; then
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
fi
if test "$ax_cv_lib_iconv" = yes; then
AC_MSG_CHECKING([how to link with libiconv])
AC_MSG_RESULT([-liconv])
fi
AC_SUBST(LIBICONV)
])
AC_DEFUN([AX_ICONV],
[
_AX_ICONV_LINK
if test "$ax_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL(ax_cv_proto_iconv, [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], ax_cv_proto_iconv_arg1="", ax_cv_proto_iconv_arg1="const")])
AC_MSG_RESULT([extern size_t iconv (iconv_t cd, $ax_cv_proto_iconv_arg1 char * * inbuf, size_t * inbytesleft, char * * outbuf, size_t * outbytesleft);])
AC_DEFINE_UNQUOTED(ICONV_CONST, $ax_cv_proto_iconv_arg1,
[Define as const if the declaration of iconv() needs const.])
fi
])

View File

@ -0,0 +1,309 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 17
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
AC_MSG_RESULT($ax_pthread_ok)
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
*-darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($ax_pthread_ok)
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*-osf* | *-hpux*) flag="-D_REENTRANT";;
*solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

157
autotools/pkg.m4 100644
View File

@ -0,0 +1,157 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])# PKG_CHECK_MODULES

View File

@ -0,0 +1,23 @@
dnl Copyright (C) 2009 Günther Brammer
AC_DEFUN([AX_PROG_CXX_REFTOTEMP],
[
AC_LANG_ASSERT([C++])
AC_CACHE_CHECK([wether the C++ compiler is friendly], [ax_cv_reftotemp], [
AC_COMPILE_IFELSE([
struct Foo {
operator Foo & () { return *this; }
};
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
void frobnicate(Foo &&) { }
#else
void frobnicate(Foo &) { }
#endif
int main () {
frobnicate (Foo());
}
], [ax_cv_reftotemp=yes], [ax_cv_reftotemp=no])])
if test $ax_cv_reftotemp = no; then
AC_MSG_ERROR([The C++ compiler won't be able to compile Clonk. Try CXX='g++ -std=gnu++0x' or CXX='g++-4.1'.])
fi[]dnl
])# AX_PROG_CXX_REFTOTEMP

185
autotools/sdl.m4 100644
View File

@ -0,0 +1,185 @@
# Configure paths for SDL
# Sam Lantinga 9/21/99
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
# serial 1
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl
AC_DEFUN([AM_PATH_SDL],
[dnl
dnl Get the cflags and libraries from the sdl-config script
dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="")
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
sdl_exec_prefix="$withval", sdl_exec_prefix="")
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
, enable_sdltest=yes)
if test x$sdl_exec_prefix != x ; then
sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
fi
fi
if test x$sdl_prefix != x ; then
sdl_config_args="$sdl_config_args --prefix=$sdl_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_prefix/bin/sdl-config
fi
fi
as_save_PATH="$PATH"
if test "x$prefix" != xNONE; then
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
fi
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
PATH="$as_save_PATH"
min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
if test "$SDL_CONFIG" = "no" ; then
no_sdl=yes
else
SDL_CFLAGS=`$SDL_CONFIG $sdl_config_args --cflags`
SDL_LIBS=`$SDL_CONFIG $sdl_config_args --libs`
sdl_major_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_minor_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
dnl
rm -f conf.sdltest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version");
exit(1);
}
if (($sdl_major_version > major) ||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the SDL_CONFIG environment variable to the"
echo "*** full path to sdl-config."
else
if test -f conf.sdltest ; then
:
else
echo "*** Could not run SDL test program, checking why..."
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include "SDL.h"
int main(int argc, char *argv[])
{ return 0; }
#undef main
#define main K_and_R_C_main
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding SDL or finding the wrong"
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
SDL_CFLAGS=""
SDL_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
rm -f conf.sdltest
])

View File

@ -0,0 +1,93 @@
dnl @synopsis VL_LIB_READLINE
dnl
dnl Searches for a readline compatible library. If found, defines
dnl `HAVE_LIBREADLINE'. If the found library has the `add_history'
dnl function, sets also `HAVE_READLINE_HISTORY'. Also checks for the
dnl locations of the necessary include files and sets `HAVE_READLINE_H'
dnl or `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
dnl 'HAVE_HISTORY_H' if the corresponding include files exists.
dnl
dnl The libraries that may be readline compatible are `libedit',
dnl `libeditline' and `libreadline'. Sometimes we need to link a
dnl termcap library for readline to work, this macro tests these cases
dnl too by trying to link with `libtermcap', `libcurses' or
dnl `libncurses' before giving up.
dnl
dnl Here is an example of how to use the information provided by this
dnl macro to perform the necessary includes or declarations in a C
dnl file:
dnl
dnl #ifdef HAVE_LIBREADLINE
dnl # if defined(HAVE_READLINE_READLINE_H)
dnl # include <readline/readline.h>
dnl # elif defined(HAVE_READLINE_H)
dnl # include <readline.h>
dnl # else /* !defined(HAVE_READLINE_H) */
dnl extern char *readline ();
dnl # endif /* !defined(HAVE_READLINE_H) */
dnl char *cmdline = NULL;
dnl #else /* !defined(HAVE_READLINE_READLINE_H) */
dnl /* no readline */
dnl #endif /* HAVE_LIBREADLINE */
dnl
dnl #ifdef HAVE_READLINE_HISTORY
dnl # if defined(HAVE_READLINE_HISTORY_H)
dnl # include <readline/history.h>
dnl # elif defined(HAVE_HISTORY_H)
dnl # include <history.h>
dnl # else /* !defined(HAVE_HISTORY_H) */
dnl extern void add_history ();
dnl extern int write_history ();
dnl extern int read_history ();
dnl # endif /* defined(HAVE_READLINE_HISTORY_H) */
dnl /* no history */
dnl #endif /* HAVE_READLINE_HISTORY */
dnl
dnl @category InstalledPackages
dnl @author Ville Laurikari <vl@iki.fi>
dnl @version 2002-04-04
dnl @license AllPermissive
AC_DEFUN([VL_LIB_READLINE], [
AC_CACHE_CHECK([for a readline compatible library],
vl_cv_lib_readline, [
ORIG_LIBS="$LIBS"
for readline_lib in readline edit editline; do
for termcap_lib in "" termcap curses ncurses; do
if test -z "$termcap_lib"; then
TRY_LIB="-l$readline_lib"
else
TRY_LIB="-l$readline_lib -l$termcap_lib"
fi
LIBS="$ORIG_LIBS $TRY_LIB"
AC_TRY_LINK_FUNC(readline, vl_cv_lib_readline="$TRY_LIB")
if test -n "$vl_cv_lib_readline"; then
break
fi
done
if test -n "$vl_cv_lib_readline"; then
break
fi
done
if test -z "$vl_cv_lib_readline"; then
vl_cv_lib_readline="no"
LIBS="$ORIG_LIBS"
fi
])
if test "$vl_cv_lib_readline" != "no"; then
AC_DEFINE(HAVE_LIBREADLINE, 1,
[Define if you have a readline compatible library])
AC_CHECK_HEADERS(readline.h readline/readline.h)
AC_CACHE_CHECK([whether readline supports history],
vl_cv_lib_readline_history, [
vl_cv_lib_readline_history="no"
AC_TRY_LINK_FUNC(add_history, vl_cv_lib_readline_history="yes")
])
if test "$vl_cv_lib_readline_history" = "yes"; then
AC_DEFINE(HAVE_READLINE_HISTORY, 1,
[Define if your readline library has \`add_history'])
AC_CHECK_HEADERS(history.h readline/history.h)
fi
fi
])dnl

View File

@ -1,101 +0,0 @@
# - Check if the files can be included
#
# CHECK_INCLUDE_FILES_CXX(INCLUDE VARIABLE)
#
# INCLUDE - list of files to include
# VARIABLE - variable to return result
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
#
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories
#=============================================================================
# Copyright 2003-2012 Kitware, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
macro(CHECK_INCLUDE_FILES_CXX INCLUDE VARIABLE)
if(NOT DEFINED "${VARIABLE}")
set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
if(CMAKE_REQUIRED_INCLUDES)
set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
else()
set(CHECK_INCLUDE_FILES_INCLUDE_DIRS)
endif()
set(CHECK_INCLUDE_FILES_CONTENT "/* */\n")
set(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS})
foreach(FILE ${INCLUDE})
set(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
endforeach()
set(CMAKE_CONFIGURABLE_FILE_CONTENT
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.cxx" @ONLY IMMEDIATE)
set(_INCLUDE ${INCLUDE}) # remove empty elements
if("${_INCLUDE}" MATCHES "^([^;]+);.+;([^;]+)$")
list(LENGTH _INCLUDE _INCLUDE_LEN)
set(_description "${_INCLUDE_LEN} C++ include files ${CMAKE_MATCH_1}, ..., ${CMAKE_MATCH_2}")
elseif("${_INCLUDE}" MATCHES "^([^;]+);([^;]+)$")
set(_description "C++ include files ${CMAKE_MATCH_1}, ${CMAKE_MATCH_2}")
else()
set(_description "C++ include file ${_INCLUDE}")
endif()
message(STATUS "Looking for ${_description}")
try_compile(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILES_FLAGS}
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE})
message(STATUS "Looking for ${_description} - found")
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if C++ files ${INCLUDE} "
"exist passed with the following output:\n"
"${OUTPUT}\n\n")
else()
message(STATUS "Looking for ${_description} - not found")
set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if C++ files ${INCLUDE} "
"exist failed with the following output:\n"
"${OUTPUT}\nSource:\n${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
endif()
endif()
endmacro()

View File

@ -1,89 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Nathan Osman
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
find_package(Qt5Core REQUIRED)
# Retrieve the absolute path to qmake and then use that path to find
# the windeployqt and macdeployqt binaries
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${_qt_bin_dir}")
if(WIN32 AND NOT WINDEPLOYQT_EXECUTABLE)
message(FATAL_ERROR "windeployqt not found")
endif()
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")
if(APPLE AND NOT MACDEPLOYQT_EXECUTABLE)
message(FATAL_ERROR "macdeployqt not found")
endif()
# Add commands that copy the required Qt files to the same directory as the
# target after being built as well as including them in final installation
function(windeployqt target)
# Run windeployqt immediately after build
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E
env PATH="${_qt_bin_dir}" "${WINDEPLOYQT_EXECUTABLE}"
--verbose 0
--no-compiler-runtime
--no-angle
--release-with-debug-info
--no-translations
\"$<TARGET_FILE:${target}>\"
COMMENT "Deploying Qt..."
)
# windeployqt doesn't work correctly with the system runtime libraries,
# so we fall back to one of CMake's own modules for copying them over
# Doing this with MSVC 2015 requires CMake 3.6+
if((MSVC_VERSION VERSION_EQUAL 1900 OR MSVC_VERSION VERSION_GREATER 1900)
AND CMAKE_VERSION VERSION_LESS "3.6")
message(WARNING "Deploying with MSVC 2015+ requires CMake 3.6+")
endif()
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
include(InstallRequiredSystemLibraries)
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
get_filename_component(filename "${lib}" NAME)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E
copy_if_different "${lib}" \"$<TARGET_FILE_DIR:${target}>\"
COMMENT "Copying ${filename}..."
)
endforeach()
endfunction()
# Add commands that copy the required Qt files to the application bundle
# represented by the target.
function(macdeployqt target)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
\"$<TARGET_FILE_DIR:${target}>/../..\"
-always-overwrite
COMMENT "Deploying Qt..."
)
endfunction()
mark_as_advanced(WINDEPLOYQT_EXECUTABLE MACDEPLOYQT_EXECUTABLE)

View File

@ -1,147 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2009-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# This module chooses an audio provider for use in OpenClonk.
macro(__FINDAUDIO_FINDOPENAL)
set(HAVE_ALEXT FALSE)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND AND NOT(APPLE))
pkg_check_modules(OpenAL "openal>=1.13")
# OpenAL pkg-config data before 1.15 doesn't have .../AL in the include
# path. But we don't want to have to specify <AL/al.h> because some
# systems use <OpenAL/al.h>. So let's see if we find al.h in the list
# of directories that pkg_check_modules returned, and if not, add it to
# the include path.
if (OpenAL_FOUND)
# OpenAL pkg-config data always includes alext.h
set(HAVE_ALEXT TRUE)
find_path(__findaudio_al_h NAMES al.h PATHS ${OpenAL_INCLUDE_DIRS})
if (NOT __findaudio_al_h)
find_path(__findaudio_al_h NAMES al.h PATHS ${OpenAL_INCLUDE_DIRS} PATH_SUFFIXES OpenAL AL)
if (__findaudio_al_h)
list(APPEND __findaudio_al_h ${OpenAL_INCLUDE_DIRS})
set(OpenAL_INCLUDE_DIRS "${__findaudio_al_h}" CACHE INTERNAL "")
endif()
endif()
endif()
pkg_check_modules(Alut "freealut>=1.1.0")
pkg_check_modules(OggVorbis "vorbisfile>=1.3.2" "vorbis>=1.3.2" "ogg>=1.2.2")
else()
if(MSVC OR APPLE)
# We need OpenAL preferably with alext.h.
find_path(OpenALExt_INCLUDE_DIRS alext.h PATH_SUFFIXES include/AL include/OpenAL include OpenAL)
if(OpenALExt_INCLUDE_DIRS)
set(HAVE_ALEXT TRUE)
set(OpenAL_INCLUDE_DIRS ${OpenALExt_INCLUDE_DIRS})
else()
set(HAVE_ALEXT FALSE)
# Maybe only al.h can be found without alext.h?
find_path(OpenAL_INCLUDE_DIRS al.h PATH_SUFFIXES include/AL include/OpenAL include OpenAL)
endif()
find_path(Vorbis_INCLUDE_DIRS vorbis/codec.h vorbis/vorbisfile.h PATH_SUFFIXES include)
find_library(Ogg_LIBRARY NAMES libogg_static libogg ogg)
find_library(Vorbis_LIBRARY NAMES libvorbis_static libvorbis vorbis)
find_library(Vorbisfile_LIBRARY NAMES libvorbisfile_static libvorbisfile vorbisfile)
if(OpenAL_INCLUDE_DIRS)
set(OpenAL_FOUND TRUE)
endif()
if(Vorbis_INCLUDE_DIRS AND Ogg_LIBRARY AND Vorbis_LIBRARY AND Vorbisfile_LIBRARY)
set(OggVorbis_FOUND TRUE)
set(OggVorbis_LIBRARIES ${Vorbisfile_LIBRARY} ${Vorbis_LIBRARY} ${Ogg_LIBRARY})
set(OggVorbis_INCLUDE_DIRS(${Vorbis_INCLUDE_DIRS}))
endif()
find_path(Alut_INCLUDE_DIRS alut.h PATH_SUFFIXES include/AL include/OpenAL include)
find_library(Alut_LIBRARY NAMES alut_static alut)
if (MSVC)
if(${FIND_LIBRARY_USE_LIB64_PATHS})
find_library(OpenAL_LIBRARIES NAMES OpenAL64)
else()
find_library(OpenAL_LIBRARIES NAMES OpenAL32)
endif()
if(NOT OpenAL_LIBRARIES)
set(OpenAL_FOUND FALSE)
endif()
endif()
if(Alut_INCLUDE_DIRS AND Alut_LIBRARY)
set(Alut_FOUND TRUE)
set(Alut_LIBRARIES ${Alut_LIBRARY})
endif()
endif()
endif()
endmacro()
if(Audio_TK)
# Already chosen, don't do anything
else()
# Test for OpenAL
__FINDAUDIO_FINDOPENAL()
find_package(SDL2Mixer)
if(OpenAL_FOUND AND Alut_FOUND AND OggVorbis_FOUND)
# Prefer OpenAL
set(Audio_TK "OpenAL")
if (NOT HAVE_ALEXT)
message(STATUS "Warning: Found OpenAL but no extensions (alext.h). Sound modifiers will be disabled.")
endif()
elseif(SDL2Mixer_FOUND)
set(Audio_TK "SDL_Mixer")
endif()
endif()
# Search for the libraries again. If the provider was selected automatically, this will be
# answered from cache; otherwise (because the user manually selected a provider) it will
# make sure the provider is available.
if(Audio_TK STREQUAL "OpenAL")
__FINDAUDIO_FINDOPENAL()
if(OpenAL_FOUND AND (APPLE OR Alut_FOUND) AND OggVorbis_FOUND)
set(Audio_FOUND TRUE)
set(Audio_LIBRARIES ${OpenAL_LIBRARIES} ${OggVorbis_LIBRARIES})
set(Audio_INCLUDE_DIRS ${OpenAL_INCLUDE_DIRS} ${OggVorbis_INCLUDE_DIRS})
set(Audio_LIBRARIES ${Audio_LIBRARIES} ${Alut_LIBRARIES})
set(Audio_INCLUDE_DIRS ${Audio_INCLUDE_DIRS} ${Alut_INCLUDE_DIRS})
endif()
elseif(Audio_TK STREQUAL "SDL_Mixer")
find_package(SDL2Mixer)
if(SDL2Mixer_FOUND)
set(Audio_FOUND TRUE)
set(Audio_LIBRARIES ${SDL2Mixer_LIBRARIES})
set(Audio_INCLUDE_DIRS ${SDL2Mixer_INCLUDE_DIRS})
endif()
elseif(Audio_TK STREQUAL "none")
set(Audio_FOUND TRUE)
set(Audio_LIBRARIES "")
set(Audio_INCLUDE_DIRS "")
endif()
if(Audio_FOUND)
string(TOUPPER "${Audio_TK}" Audio_TK_UPPER)
if(NOT Audio_FIND_QUIETLY)
message(STATUS "Using Audio toolkit: ${Audio_TK}")
endif()
elseif(Audio_TK)
message(FATAL_ERROR "User-requested audio provider not available.")
else()
set(Audio_FOUND FALSE)
set(Audio_TK "none")
string(TOUPPER "${Audio_TK}" Audio_TK_UPPER)
set(Audio_LIBRARIES "")
set(Audio_INCLUDE_DIRS "")
if(Audio_FIND_REQUIRED)
message(FATAL_ERROR "No audio provider was found")
else()
message(STATUS "Not enabling audio output.")
endif()
endif()

View File

@ -1,16 +1,3 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2011-2017, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# - Find DbgHelp
# Find the DbgHelp library
# This module defines
@ -18,23 +5,26 @@
# DBGHELP_LIBRARIES, the libraries needed to use DbgHelp.
# DBGHELP_FOUND, If false, do not try to use DbgHelp.
# MSVC knows how to find the Windows SDK on its own, and replicating that
# in CMake is very tricky, especially with the SDK's layout changing
# occasionally. So instead we'll just leave it to MSVC to do correctly.
if(MSVC AND NOT DEFINED DBGHELP_INCLUDE_DIR AND NOT DEFINED DBGHELP_LIBRARY)
set(DBGHELP_INCLUDE_DIR "")
set(DBGHELP_LIBRARY "dbghelp")
set(DBGHELP_FOUND TRUE)
endif()
#=============================================================================
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2011 Nicolas Hake
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# See isc_license.txt for full license and disclaimer.
#
# "Clonk" is a registered trademark of Matthes Bender.
# See clonk_trademark_license.txt for full license.
#=============================================================================
if(NOT DBGHELP_FOUND)
find_path(DBGHELP_INCLUDE_DIR NAMES dbghelp.h PATH_SUFFIXES include)
set(DBGHELP_NAMES ${DBGHELP_NAMES} dbghelp)
find_library(DBGHELP_LIBRARY NAMES ${DBGHELP_NAMES})
find_path(DBGHELP_INCLUDE_DIR NAMES dbghelp.h)
set(DBGHELP_NAMES ${DBGHELP_NAMES} dbghelp)
find_library(DBGHELP_LIBRARY NAMES ${DBGHELP_NAMES})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBGHELP DEFAULT_MSG DBGHELP_LIBRARY DBGHELP_INCLUDE_DIR)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBGHELP DEFAULT_MSG DBGHELP_LIBRARY DBGHELP_INCLUDE_DIR)
if(DBGHELP_FOUND)
set(DBGHELP_LIBRARIES ${DBGHELP_LIBRARY})

View File

@ -0,0 +1,46 @@
# - Find FMod
# Find the FMod library
# This module defines
# FMOD_INCLUDE_DIR, where to find fmod.h, etc.
# FMOD_LIBRARIES, the libraries needed to use FMod.
# FMOD_FOUND, If false, do not try to use FMod.
#=============================================================================
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2011 Nicolas Hake
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# See isc_license.txt for full license and disclaimer.
#
# "Clonk" is a registered trademark of Matthes Bender.
# See clonk_trademark_license.txt for full license.
#=============================================================================
find_path(FMOD_INCLUDE_DIR fmod.h)
if(CMAKE_CL_64)
if(MSVC)
set(FMOD_NAMES ${FMOD_NAMES} fmod64vc)
else()
set(FMOD_NAMES ${FMOD_NAMES} fmod64)
endif()
else()
if(MSVC)
set(FMOD_NAMES ${FMOD_NAMES} fmodvc)
else()
set(FMOD_NAMES ${FMOD_NAMES} fmod)
endif()
endif()
find_library(FMOD_LIBRARY NAMES ${FMOD_NAMES})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FMOD DEFAULT_MSG FMOD_LIBRARY FMOD_INCLUDE_DIR)
if(FMOD_FOUND)
set(FMOD_LIBRARIES ${FMOD_LIBRARY})
endif()
mark_as_advanced(FMOD_LIBRARY FMOD_INCLUDE_DIR)

View File

@ -1,43 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2014-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# This module defines
# FREETYPE_LIBRARIES, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
# FREETYPE_VERSION_STRING, the version of freetype found
# Use pkg-config if possible instead of doing guesswork like the default CMake module does
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
set(_ft_pkgconfig_args "")
if(FREETYPE_FIND_QUIET)
set(_ft_pkgconfig_args "${_ft_pkgconfig_args}QUIET ")
endif()
set(_ft_pkgconfig_args "${_ft_pkgconfig_args}freetype2")
if(FREETYPE_FIND_VERSION)
if(NOT FREETYPE_FIND_VERSION_EXACT)
set(_ft_pkgconfig_args "${_ft_pkgconfig_args}>")
endif()
set(_ft_pkgconfig_args "${_ft_pkgconfig_args}=${FREETYPE_FIND_VERSION} ")
endif()
pkg_check_modules(FREETYPE ${_ft_pkgconfig_args})
endif()
if(NOT FREETYPE_FOUND)
# Fallback to system FindFreetype
set(_ft_module_path "${CMAKE_MODULE_PATH}")
unset(CMAKE_MODULE_PATH)
include(FindFreetype)
set(CMAKE_MODULE_PATH "${_ft_module_path}")
endif()

View File

@ -1,63 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2015-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# Locate GLEW.
# This module defines
# GLEW_INCLUDE_DIRS - a list of directories that need to be added to the include path
# GLEW_LIBRARIES - a list of libraries to link against to use GLEW
# GLEW_DEFINITIONS - a list of compile-time macros that need to be defined to use GLEW
# GLEW_FOUND - if false, GLEW cannot be used
find_path(GLEW_INCLUDE_DIR GL/glew.h PATH_SUFFIXES)
mark_as_advanced(GLEW_INCLUDE_DIR)
# Read GLEW version from header
if (GLEW_INCLUDE_DIR AND EXISTS "${GLEW_INCLUDE_DIR}/GL/glew.h")
file(STRINGS "${GLEW_INCLUDE_DIR}/GL/glew.h" glew_version_str REGEX "^VERSION .+")
string(REGEX REPLACE "^VERSION (.+)" "\\1" GLEW_VERSION_STRING "${glew_version_str}")
unset(glew_version_str)
endif()
# On OS other than Windows, it doesn't matter whether we confuse the shared
# library and the static one. On Windows, we need to #define GLEW_STATIC if
# (and only if) we're linking against the static library. "glew32" may match
# the static library on MinGW, so we have to test for that explicitly.
find_library(GLEW_STATIC_LIBRARY glew32s)
mark_as_advanced(GLEW_STATIC_LIBRARY)
find_library(GLEW_SHARED_LIBRARY NAMES GLEW glew32)
mark_as_advanced(GLEW_SHARED_LIBRARY)
if (GLEW_SHARED_LIBRARY)
set(GLEW_LIBRARY "${GLEW_SHARED_LIBRARY}")
if (WIN32 AND MINGW AND GLEW_SHARED_LIBRARY MATCHES "\\.a$")
# not actually a shared library
set(GLEW_DEFINITIONS "-DGLEW_STATIC")
else()
set(GLEW_DEFINITIONS)
endif()
elseif (GLEW_STATIC_LIBRARY)
set(GLEW_LIBRARY "${GLEW_STATIC_LIBRARY}")
set(GLEW_DEFINITIONS "-DGLEW_STATIC")
endif()
include(FindPackageHandleStandardArgs)
if (NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.3")
find_package_handle_standard_args(GLEW VERSION_VAR GLEW_VERSION_STRING REQUIRED_VARS GLEW_LIBRARY GLEW_INCLUDE_DIR)
else()
find_package_handle_standard_args(GLEW GLEW_LIBRARY GLEW_INCLUDE_DIR)
endif()
if (GLEW_FOUND)
set(GLEW_LIBRARIES "${GLEW_LIBRARY}")
set(GLEW_INCLUDE_DIRS "${GLEW_INCLUDE_DIR}")
endif()

View File

@ -1,222 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2015-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# Locate GTK3.
# This module defines
# GTK3_INCLUDE_DIRS - a list of directories that need to be added to the include path
# GTK3_LIBRARIES - a list of libraries to link against to use GTK3
# GTK3_LIBRARY_DIRS - a list of library directories where the libraries above can be found
# GTK3_COMPILE_DEFINITIONS - a list of compiler flags that need to be set to use GTK3
# GTK3_FOUND - if false, GTK3 cannot be used
#
# FindGTK3 may optionally take a list of components that should also be located
# and added to the library list. The following components are valid:
# gtksourceview - GtkSourceView 3.0
# gobject - Glib GObject 2.0
# gio - Glib GIO 2.0
# gthread
# glib - Glib 2.0
#
# If any of these components are requested, the following variables will be
# defined with the same meaning as above:
# GTK3_<component>_INCLUDE_DIRS
# GTK3_<component>_LIBRARIES
# GTK3_<component>_FOUND
if(GTK3_FIND_QUIETLY)
set(__GTK3_QUIET "QUIET")
else()
set(__GTK3_QUIET)
endif()
include(FindPackageHandleStandardArgs)
if(NOT GTK3_FIND_COMPONENTS)
set(GTK3_FIND_COMPONENTS)
endif()
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
# If pkg-config is available, defer to it
set(__GTK3_VERSION_CHECK)
if(GTK3_FIND_VERSION_EXACT)
set(__GTK3_VERSION_CHECK "=${GTK3_FIND_VERSION}")
elseif(GTK3_FIND_VERSION)
set(__GTK3_VERSION_CHECK ">=${GTK3_FIND_VERSION}")
endif()
pkg_check_modules(GTK3 ${__GTK3_QUIET} "gtk+-3.0${__GTK3_VERSION_CHECK}")
macro(__GTK3_HANDLE_COMPONENT __cname __cfullname)
if(__component STREQUAL "${__cname}")
pkg_check_modules(GTK3_${__cname} ${__GTK3_QUIET} "${__cfullname}")
if(GTK3_${__cname}_FOUND)
if(GTK3_LIBRARY_DIRS)
list(REMOVE_ITEM GTK3_${__cname}_LIBRARY_DIRS ${GTK3_LIBRARY_DIRS})
endif()
if(GTK3_INCLUDE_DIRS)
list(REMOVE_ITEM GTK3_${__cname}_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS})
endif()
if(GTK3_FIND_REQUIRED_${__cname})
list(APPEND GTK3_LIBRARIES ${GTK3_${__cname}_LIBRARIES})
list(APPEND GTK3_INCLUDE_DIRS ${GTK3_${__cname}_INCLUDE_DIRS})
endif()
endif()
endif()
endmacro(__GTK3_HANDLE_COMPONENT)
foreach(__component ${GTK3_FIND_COMPONENTS})
__GTK3_HANDLE_COMPONENT(gtksourceview "gtksourceview-3.0")
__GTK3_HANDLE_COMPONENT(gobject "gobject-2.0")
__GTK3_HANDLE_COMPONENT(gio "gio-2.0")
__GTK3_HANDLE_COMPONENT(gthread "gthread-2.0")
__GTK3_HANDLE_COMPONENT(glib "glib-2.0")
endforeach()
set(GTK3_COMPILE_DEFINITIONS ${GTK3_CFLAGS_OTHER})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
GTK3
FOUND_VAR GTK3_FOUND
VERSION_VAR GTK3_VERSION
HANDLE_COMPONENTS
REQUIRED_VARS
GTK3_INCLUDE_DIRS GTK3_LIBRARIES
)
else()
# Find all headers and libraries
find_path(GTK3_INCLUDE_DIR NAMES gtk/gtk.h PATH_SUFFIXES gtk-3.0)
find_library(GTK3_LIBRARY NAMES gtk-3.0)
mark_as_advanced(GTK3_INCLUDE_DIR GTK3_LIBRARY)
find_path(GTK3_GDK_INCLUDE_DIR NAMES gdk/gdk.h PATH_SUFFIXES gtk-3.0)
find_library(GTK3_GDK_LIBRARY NAMES gdk-3.0)
mark_as_advanced(GTK3_GDK_INCLUDE_DIR GTK3_GDK_LIBRARY)
find_path(GTK3_Glib_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0)
find_library(GTK3_Glib_LIBRARY NAMES glib-2.0)
get_filename_component(__GTK3_Glib_LIBRARY_DIR "${GTK3_Glib_LIBRARY}" PATH)
find_path(GTK3_Glibconfig_INCLUDE_DIR
NAMES glibconfig.h
HINTS ${__GTK3_Glib_LIBRARY_DIR}
PATH_SUFFIXES glib-2.0/include
)
mark_as_advanced(GTK3_Glib_INCLUDE_DIR GTK3_Glibconfig_INCLUDE_DIR GTK3_Glib_LIBRARY)
find_path(GTK3_Atk_INCLUDE_DIR NAMES atk/atk.h PATH_SUFFIXES atk-1.0)
find_library(GTK3_Atk_LIBRARY NAMES atk-1.0)
mark_as_advanced(GTK3_Atk_INCLUDE_DIR GTK3_Atk_LIBRARY)
find_path(GTK3_Cairo_INCLUDE_DIR NAMES cairo.h)
find_library(GTK3_Cairo_LIBRARY NAMES cairo)
mark_as_advanced(GTK3_Cairo_INCLUDE_DIR GTK3_Cairo_LIBRARY)
find_path(GTK3_Pango_INCLUDE_DIR NAMES pango/pango.h PATH_SUFFIXES pango-1.0)
find_library(GTK3_Pango_LIBRARY NAMES pango-1.0)
find_library(GTK3_PangoCairo_LIBRARY NAMES pangocairo-1.0)
mark_as_advanced(GTK3_Pango_INCLUDE_DIR GTK3_Pango_LIBRARY GTK3_PangoCairo_LIBRARY)
find_path(GTK3_GDKPixbuf_INCLUDE_DIR NAMES gdk-pixbuf/gdk-pixbuf.h PATH_SUFFIXES gdk-pixbuf-2.0)
find_library(GTK3_GDKPixbuf_LIBRARY NAMES gdk_pixbuf-2.0)
mark_as_advanced(GTK3_GDKPixbuf_INCLUDE_DIR GTK3_GDKPixbuf_LIBRARY)
set(__GTK3_REQUIRED_INCLUDE_DIRS
GTK3_INCLUDE_DIR
GTK3_GDK_INCLUDE_DIR
GTK3_Glib_INCLUDE_DIR GTK3_Glibconfig_INCLUDE_DIR
GTK3_Atk_INCLUDE_DIR
GTK3_Cairo_INCLUDE_DIR
GTK3_Pango_INCLUDE_DIR
GTK3_GDKPixbuf_INCLUDE_DIR
)
set(__GTK3_REQUIRED_LIBRARIES
GTK3_LIBRARY
GTK3_GDK_LIBRARY
GTK3_Glib_LIBRARY
GTK3_Atk_LIBRARY
GTK3_Cairo_LIBRARY
GTK3_Pango_LIBRARY GTK3_PangoCairo_LIBRARY
GTK3_GDKPixbuf_LIBRARY
)
set(__GTK3_COMPONENT_INCLUDE_DIRS)
set(__GTK3_COMPONENT_LIBRARIES)
macro(__GTK3_HANDLE_COMPONENT __cname __cheader __csuffixes __clibrary)
if(__component STREQUAL "${__cname}")
find_path(GTK3_${__cname}_INCLUDE_DIR NAMES ${__cheader} PATH_SUFFIXES ${__csuffixes})
find_library(GTK3_${__cname}_LIBRARY NAMES ${__clibrary})
mark_as_advanced(GTK3_${__cname}_INCLUDE_DIR GTK3_${__cname}_LIBRARY)
if(GTK3_${__cname}_INCLUDE_DIR AND GTK3_${__cname}_LIBRARY)
set(GTK3_${__cname}_FOUND TRUE)
set(GTK3_${__cname}_INCLUDE_DIRS ${GTK3_${__cname}_INCLUDE_DIR})
set(GTK3_${__cname}_LIBRARIES ${GTK3_${__cname}_LIBRARY})
if(GTK3_FIND_REQUIRED_${__cname})
list(APPEND __GTK3_REQUIRED_LIBRARIES GTK3_${__cname}_LIBRARY)
list(APPEND __GTK3_REQUIRED_INCLUDE_DIRS GTK3_${__cname}_INCLUDE_DIR)
endif()
endif()
endif()
endmacro(__GTK3_HANDLE_COMPONENT)
foreach(__component ${GTK3_FIND_COMPONENTS})
__GTK3_HANDLE_COMPONENT(gtksourceview gtksourceview/gtksourceview.h gtksourceview-3.0 gtksourceview-3.0)
__GTK3_HANDLE_COMPONENT(gobject gobject/gobject.h glib-2.0 gobject-2.0)
__GTK3_HANDLE_COMPONENT(gio gio/gio.h glib-2.0 gio-2.0)
__GTK3_HANDLE_COMPONENT(gthread glib/gthread.h glib-2.0 gthread-2.0)
__GTK3_HANDLE_COMPONENT(glib glib.h glib-2.0 glib-2.0)
endforeach()
# Parse version from GTK3 header
if(GTK3_INCLUDE_DIR)
file(READ "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" _gtk_header)
string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION \\(([0-9]+)\\).*" "\\1" __GTK3_MAJOR_VER "${_gtk_header}")
string(REGEX REPLACE ".*#define GTK_MINOR_VERSION \\(([0-9]+)\\).*" "\\1" __GTK3_MINOR_VER "${_gtk_header}")
string(REGEX REPLACE ".*#define GTK_MICRO_VERSION \\(([0-9]+)\\).*" "\\1" __GTK3_MICRO_VER "${_gtk_header}")
set(GTK3_VERSION "${__GTK3_MAJOR_VER}.${__GTK3_MINOR_VER}.${__GTK3_MICRO_VER}")
unset(__GTK3_MICRO_VER)
unset(__GTK3_MINOR_VER)
unset(__GTK3_MAJOR_VER)
unset(_gtk_header)
endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
GTK3
FOUND_VAR GTK3_FOUND
VERSION_VAR GTK3_VERSION
HANDLE_COMPONENTS
REQUIRED_VARS
${__GTK3_REQUIRED_INCLUDE_DIRS} ${__GTK3_REQUIRED_LIBRARIES}
)
if(GTK3_FOUND)
set(GTK3_INCLUDE_DIRS)
foreach(__dir ${__GTK3_REQUIRED_INCLUDE_DIRS})
list(APPEND GTK3_INCLUDE_DIRS "${${__dir}}")
endforeach()
set(GTK3_LIBRARIES)
foreach(__lib ${__GTK3_REQUIRED_LIBRARIES})
list(APPEND GTK3_LIBRARIES "${${__lib}}")
endforeach()
list(REMOVE_DUPLICATES GTK3_LIBRARIES)
list(REMOVE_DUPLICATES GTK3_INCLUDE_DIRS)
set(GTK3_COMPILE_DEFINITIONS)
set(GTK3_LIBRARY_DIRS)
endif()
unset(__GTK3_REQUIRED_INCLUDE_DIRS)
unset(__GTK3_REQUIRED_LIBRARIES)
endif()
if(NOT GTK3_FOUND)
unset(GTK3_INCLUDE_DIRS)
unset(GTK3_LIBRARIES)
endif()

View File

@ -1,105 +0,0 @@
# - Find the native PNG includes and library
#
# This module searches libpng, the library for working with PNG images.
#
# It defines the following variables
# PNG_INCLUDE_DIRS, where to find png.h, etc.
# PNG_LIBRARIES, the libraries to link against to use PNG.
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
# PNG_FOUND, If false, do not try to use PNG.
# PNG_VERSION_STRING - the version of the PNG library found (since CMake 2.8.8)
# Also defined, but not for general use are
# PNG_LIBRARY, where to find the PNG library.
# For backward compatiblity the variable PNG_INCLUDE_DIR is also set. It has the same value as PNG_INCLUDE_DIRS.
#
# Since PNG depends on the ZLib compression library, none of the above will be
# defined unless ZLib can be found.
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Modified by Nicolas Hake for the OpenClonk Project to make FindPNG also
# look for versioned libraries.
if(PNG_FIND_QUIETLY)
set(_FIND_ZLIB_ARG QUIET)
endif()
find_package(ZLIB ${_FIND_ZLIB_ARG})
if(ZLIB_FOUND)
find_path(PNG_PNG_INCLUDE_DIR png.h
/usr/local/include/libpng # OpenBSD
)
if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"")
string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}")
unset(png_version_str)
endif ()
if (PNG_VERSION_STRING)
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "png\\1\\2" PNG_VERSIONED_LIBRARY "${PNG_VERSION_STRING}")
set(PNG_VERSIONED_LIBRARY ${PNG_VERSIONED_LIBRARY} lib${PNG_VERSIONED_LIBRARY} lib${PNG_VERSIONED_LIBRARY}_static ${PNG_VERSIONED_LIBRARY}d lib${PNG_VERSIONED_LIBRARY}d lib${PNG_VERSIONED_LIBRARY}d_static)
endif ()
set(PNG_NAMES ${PNG_NAMES} png libpng ${PNG_VERSIONED_LIBRARY} png15 libpng15 png15d libpng15d png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
unset(PNG_VERSIONED_LIBRARY)
find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
set(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatiblity
set(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
if (CYGWIN)
if(BUILD_SHARED_LIBS)
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
else()
set (PNG_DEFINITIONS -DPNG_STATIC)
endif()
endif ()
endif ()
endif()
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
VERSION_VAR PNG_VERSION_STRING)
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )

View File

@ -1,16 +1,3 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2011-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# - Find READLINE
# Find the native READLINE includes and library
#
@ -24,14 +11,7 @@ IF (READLINE_INCLUDE_DIR)
SET(READLINE_FIND_QUIETLY TRUE)
ENDIF (READLINE_INCLUDE_DIR)
FIND_PATH(READLINE_INCLUDE_DIR readline.h PATH_SUFFIXES readline)
# Unmodified readline depends on symbols from termcap without explicitly
# linking to it. Several distributions patch this to make it link against
# terminfo from ncurses or another termcap library, but some don't. To avoid
# having to run link tests, we'll just look for and use any termcap providing
# library.
FIND_LIBRARY(TERMCAP_LIBRARY NAMES tinfo termcap ncursesw ncurses cursesw curses)
FIND_PATH(READLINE_INCLUDE_DIR readline.h)
SET(READLINE_NAMES readline libreadline)
FIND_LIBRARY(READLINE_LIBRARY NAMES ${READLINE_NAMES} )
@ -42,13 +22,10 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(READLINE DEFAULT_MSG READLINE_LIBRARY READLINE_INCLUDE_DIR)
IF(READLINE_FOUND)
if(TERMCAP_LIBRARY)
set(READLINE_LIBRARIES ${READLINE_LIBRARY} ${TERMCAP_LIBRARY})
else()
set(READLINE_LIBRARIES ${READLINE_LIBRARY})
endif()
SET( READLINE_LIBRARIES ${READLINE_LIBRARY} )
ELSE(READLINE_FOUND)
SET( READLINE_LIBRARIES )
ENDIF(READLINE_FOUND)
MARK_AS_ADVANCED( READLINE_LIBRARY TERMINFO_LIBRARY READLINE_INCLUDE_DIR )
MARK_AS_ADVANCED( READLINE_LIBRARY READLINE_INCLUDE_DIR )

View File

@ -1,41 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# Locate SDL2.
# This module defines
# SDL2_INCLUDE_DIRS - a list of directories that need to be added to the include path
# SDL2_LIBRARIES - a list of libraries to link against to use SDL2
# SDL2_FOUND - if false, SDL2 cannot be used
find_path(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES SDL2 include
)
mark_as_advanced(SDL2_INCLUDE_DIR)
find_library(SDL2_LIBRARY
SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib
)
mark_as_advanced(SDL2_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
if (SDL2_FOUND)
set(SDL2_LIBRARIES "${SDL2_LIBRARY}")
set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}")
endif()

View File

@ -1,37 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# Locate SDL_Mixer 2.
# This module defines
# SDL2Mixer_INCLUDE_DIRS - a list of directories that need to be added to the include path
# SDL2Mixer_LIBRARIES - a list of libraries to link against to use SDL2
# SDL2Mixer_FOUND - if false, SDL2 cannot be used
if(SDL2Mixer_FIND_QUIETLY)
set(_FIND_SDL2_ARG QUIET)
endif()
find_package(SDL2 ${_FIND_SDL2_ARG})
find_path(SDL2Mixer_INCLUDE_DIR SDL_mixer.h PATH_SUFFIXES SDL2 HINTS ENV SDL2DIR)
mark_as_advanced(SDL2Mixer_INCLUDE_DIR)
find_library(SDL2Mixer_LIBRARY SDL2_mixer HINTS ENV SDL2DIR)
mark_as_advanced(SDL2Mixer_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SDL2Mixer REQUIRED_VARS SDL2Mixer_LIBRARY SDL2Mixer_INCLUDE_DIR
SDL2_LIBRARIES SDL2_INCLUDE_DIRS)
if (SDL2Mixer_FOUND)
set(SDL2Mixer_LIBRARIES ${SDL2Mixer_LIBRARY} ${SDL2_LIBRARIES})
set(SDL2Mixer_INCLUDE_DIRS ${SDL2Mixer_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
endif()

View File

@ -1,104 +0,0 @@
##################################################################################################
#
# Copyright (c) 2013, Open Source Robotics Foundation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# Neither the name of the {organization} nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
##################################################################################################
# CMake script for finding TinyXML.
#
# Input variables:
#
# - TinyXML_ROOT_DIR (optional): When specified, header files and libraries will be searched for in
# ${TinyXML_ROOT_DIR}/include
# ${TinyXML_ROOT_DIR}/libs
# respectively, and the default CMake search order will be ignored. When unspecified, the default
# CMake search order is used.
# This variable can be specified either as a CMake or environment variable. If both are set,
# preference is given to the CMake variable.
# Use this variable for finding packages installed in a nonstandard location, or for enforcing
# that one of multiple package installations is picked up.
#
#
# Cache variables (not intended to be used in CMakeLists.txt files)
#
# - TinyXML_INCLUDE_DIR: Absolute path to package headers.
# - TinyXML_LIBRARY: Absolute path to library.
#
#
# Output variables:
#
# - TinyXML_FOUND: Boolean that indicates if the package was found
# - TinyXML_INCLUDE_DIRS: Paths to the necessary header files
# - TinyXML_LIBRARIES: Package libraries
#
#
# Example usage:
#
# find_package(TinyXML)
# if(NOT TinyXML_FOUND)
# # Error handling
# endif()
# ...
# include_directories(${TinyXML_INCLUDE_DIRS} ...)
# ...
# target_link_libraries(my_target ${TinyXML_LIBRARIES})
#
##################################################################################################
# Get package location hint from environment variable (if any)
if(NOT TinyXML_ROOT_DIR AND DEFINED ENV{TinyXML_ROOT_DIR})
set(TinyXML_ROOT_DIR "$ENV{TinyXML_ROOT_DIR}" CACHE PATH
"TinyXML base directory location (optional, used for nonstandard installation paths)")
endif()
# Search path for nonstandard package locations
if(TinyXML_ROOT_DIR)
set(TinyXML_INCLUDE_PATH PATHS "${TinyXML_ROOT_DIR}/include" NO_DEFAULT_PATH)
set(TinyXML_LIBRARY_PATH PATHS "${TinyXML_ROOT_DIR}/lib" NO_DEFAULT_PATH)
endif()
# Find headers and libraries
find_path(TinyXML_INCLUDE_DIR NAMES tinyxml.h PATH_SUFFIXES "tinyxml" ${TinyXML_INCLUDE_PATH})
find_library(TinyXML_LIBRARY NAMES tinyxml PATH_SUFFIXES "tinyxml" ${TinyXML_LIBRARY_PATH})
mark_as_advanced(TinyXML_INCLUDE_DIR
TinyXML_LIBRARY)
# Output variables generation
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(TinyXML DEFAULT_MSG TinyXML_LIBRARY
TinyXML_INCLUDE_DIR)
set(TinyXML_FOUND ${TINYXML_FOUND}) # Enforce case-correctness: Set appropriately cased variable...
unset(TINYXML_FOUND) # ...and unset uppercase variable generated by find_package_handle_standard_args
if(TinyXML_FOUND)
set(TinyXML_INCLUDE_DIRS ${TinyXML_INCLUDE_DIR})
set(TinyXML_LIBRARIES ${TinyXML_LIBRARY})
endif()

View File

@ -1,16 +1,3 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2012-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# - Find libupnp
# Find the libupnp library
# This module defines
@ -18,29 +5,37 @@
# UPNP_LIBRARIES, the libraries needed to use libupnp.
# UPNP_FOUND, If false, do not try to use libupnp.
#=============================================================================
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2012 Armin Burgmeier
# Copyright (c) 2012 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.
#=============================================================================
# TODO: Use pkg-config if available
if(WIN32)
CHECK_INCLUDE_FILE_CXX(natupnp.h HAVE_NATIVE_NATUPNP)
if(NOT HAVE_NATIVE_NATUPNP)
SET(UPNP_INCLUDE_DIR "thirdparty/natupnp")
else()
SET(UPNP_INCLUDE_DIR)
endif()
SET(UPNP_LIBRARIES)
SET(UPNP_FOUND TRUE)
SET(UPNP_STYLE "Win32")
else()
find_path(UPNP_INCLUDE_DIR NAMES miniupnpc.h PATH_SUFFIXES miniupnpc)
set(UPNP_NAMES ${UPNP_NAMES} miniupnpc)
find_library(UPNP_LIBRARY NAMES ${UPNP_NAMES})
find_path(UPNP_INCLUDE_DIR NAMES upnp.h PATH_SUFFIXES upnp)
set(UPNP_NAMES ${UPNP_NAMES} upnp)
set(THREADUTIL_NAMES ${THREADUTIL_NAMES} threadutil)
set(IXML_NAMES ${IXML_NAMES} ixml)
find_library(UPNP_LIBRARY NAMES ${UPNP_NAMES})
find_library(THREADUTIL_LIBRARY NAMES ${THREADUTIL_NAMES})
find_library(IXML_LIBRARY NAMES ${IXML_NAMES})
if(UPNP_LIBRARY)
SET(UPNP_FOUND TRUE)
set(UPNP_LIBRARIES ${UPNP_LIBRARY})
set(UPNP_INCLUDE_DIR ${UPNP_INCLUDE_DIR})
set(UPNP_STYLE "miniupnpc")
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(UPNP DEFAULT_MSG UPNP_LIBRARY THREADUTIL_LIBRARY IXML_LIBRARY UPNP_INCLUDE_DIR)
if(UPNP_FOUND)
set(UPNP_LIBRARIES ${UPNP_LIBRARY} ${THREADUTIL_LIBRARY} ${IXML_LIBRARY})
set(UPNP_INCLUDE_DIR ${UPNP_INCLUDE_DIR})
endif()
mark_as_advanced(UPNP_LIBRARY UPNP_INCLUDE_DIR)
mark_as_advanced(UPNP_LIBRARY IXML_LIBRARY UPNP_INCLUDE_DIR)

View File

@ -1,113 +0,0 @@
# - Find zlib
# Find the native ZLIB includes and library.
# Once done this will define
#
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
#
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
# ZLIB_VERSION_MAJOR - The major version of zlib
# ZLIB_VERSION_MINOR - The minor version of zlib
# ZLIB_VERSION_PATCH - The patch version of zlib
# ZLIB_VERSION_TWEAK - The tweak version of zlib
#
# The following variable are provided for backward compatibility
#
# ZLIB_MAJOR_VERSION - The major version of zlib
# ZLIB_MINOR_VERSION - The minor version of zlib
# ZLIB_PATCH_VERSION - The patch version of zlib
#
# An includer may set ZLIB_ROOT to a zlib installation root to tell
# this module where to look.
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
set(_ZLIB_SEARCHES)
# Search ZLIB_ROOT first if it is set.
if(ZLIB_ROOT)
set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
endif()
# Normal search.
set(_ZLIB_SEARCH_NORMAL
PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
"$ENV{PROGRAMFILES}/zlib"
)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
set(ZLIB_NAMES z zlib zlibstatic zdll zlib1 zlibd zlibd1)
# Try each search configuration.
foreach(search ${_ZLIB_SEARCHES})
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
endforeach()
mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}")
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}")
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}")
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}")
# only append a TWEAK version if it exists:
set(ZLIB_VERSION_TWEAK "")
if( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}")
endif()
set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
endif()
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
VERSION_VAR ZLIB_VERSION_STRING)
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
endif()

View File

@ -0,0 +1,76 @@
#Copied from http://www.mail-archive.com/cmake@cmake.org/msg04394.html which copied it from the rosengarden project
#see also: http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Precompiled-Headers.html
MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
# Prepare environment
GET_FILENAME_COMPONENT(_name ${_input} NAME)
SET(_pchdir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_targetName}_pch.dir")
MAKE_DIRECTORY(${_pchdir})
SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
SET(_includeput "${_pchdir}/${_name}")
SET(_output "${_includeput}.gch")
# Assemble the compiler command with which future stuff will be built
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) # Don't worry: CMake won't use any of the R/D/RWDI/MSR vars if the build type is not defined
if(CMAKE_CXX_COMPILER_ARG1) # please, know what you're doing if you rely on this...
STRING(STRIP ${CMAKE_CXX_COMPILER_ARG1} _ccache_tweak)
SET(_ccache_tweak "\"${_ccache_tweak}\"")
endif()
SET(_compiler_FLAGS ${_ccache_tweak} ${CMAKE_CXX_FLAGS} ${${_flags_var_name}})
if(CMAKE_BUILD_TYPE)
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
LIST(APPEND _compiler_FLAGS "-D_DEBUG")
endif()
endif()
GET_TARGET_PROPERTY(_compile_defines ${_targetName} COMPILE_DEFINITIONS)
if(_compile_defines)
FOREACH(item ${_compile_defines})
STRING(REPLACE "\"" "\\\"" item ${item})
LIST(APPEND _compiler_FLAGS "-D${item}")
ENDFOREACH(item)
endif()
GET_TARGET_PROPERTY(_compile_defines ${_targetName} COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE})
if(_compile_defines)
FOREACH(item ${_compile_defines})
STRING(REPLACE "\"" "\\\"" item ${item})
LIST(APPEND _compiler_FLAGS "-D${item}")
ENDFOREACH(item)
endif()
GET_DIRECTORY_PROPERTY(_compile_defines COMPILE_DEFINITIONS)
if(_compile_defines)
FOREACH(item ${_compile_defines})
STRING(REPLACE "\"" "\\\"" item ${item})
LIST(APPEND _compiler_FLAGS "-D${item}")
ENDFOREACH(item)
endif()
GET_DIRECTORY_PROPERTY(_compile_defines COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE})
if(_compile_defines)
FOREACH(item ${_compile_defines})
STRING(REPLACE "\"" "\\\"" item ${item})
LIST(APPEND _compiler_FLAGS "-D${item}")
ENDFOREACH(item)
endif()
GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
FOREACH(item ${_directory_flags})
LIST(APPEND _compiler_FLAGS "-I\"${item}\"")
ENDFOREACH(item)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
STRING(REPLACE "\"" "\\\"" _directory_flags ${_directory_flags}) # Welcome to escape hell. Replace " with \"
LIST(APPEND _compiler_FLAGS ${_directory_flags})
SEPARATE_ARGUMENTS(_compiler_FLAGS)
list(REMOVE_DUPLICATES _compiler_FLAGS)
# Add a target with the pch
ADD_CUSTOM_COMMAND(
OUTPUT ${_output}
COMMAND "${CMAKE_CXX_COMPILER}"
${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}
IMPLICIT_DEPENDS CXX ${_source}
)
FILE(WRITE "${_pchdir}/${_name}" "#ifdef __cplusplus\n#warning Precompiled header not used. Turn off or fix!\n#endif") # This file is added so the cc-units don't stumble over not being able to include the file
ADD_CUSTOM_TARGET(${_targetName}_pch DEPENDS ${_output})
ADD_DEPENDENCIES(${_targetName} ${_targetName}_pch)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "-include ${_includeput}")
ENDMACRO(ADD_PRECOMPILED_HEADER)

View File

@ -1,16 +1,3 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2012-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
function(git_get_changeset_id VAR)
find_package(Git QUIET)
if (GIT_FOUND)
@ -28,33 +15,6 @@ function(git_get_changeset_id VAR)
OUTPUT_VARIABLE GIT_STATUS
)
string(REGEX MATCH "^[MADRC ][MD ]" WORKDIR_DIRTY "${GIT_STATUS}")
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND "${GIT_EXECUTABLE}" "rev-parse" "--git-path" "index"
OUTPUT_VARIABLE GIT_INDEX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${GIT_INDEX}"
)
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND "${GIT_EXECUTABLE}" "show" "--format=%ci" "-s" "HEAD"
OUTPUT_VARIABLE GIT_TIMESTAMP
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(DEFINED ENV{C4REVISION_BRANCH})
set(GIT_BRANCH "$ENV{C4REVISION_BRANCH}")
else()
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND "${GIT_EXECUTABLE}" "symbolic-ref" "--short" "HEAD"
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_RESULT EQUAL 0)
set(GIT_BRANCH "unknown")
endif()
endif()
endif()
endif()
if (NOT C4REVISION)
@ -71,19 +31,9 @@ function(git_get_changeset_id VAR)
string(SUBSTRING "${C4REVISION}" 6 12 C4REVISION)
endif()
unset(revlength)
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/.git_archival" C4REVISION_TS
LIMIT_COUNT 1
REGEX "date: .+"
)
string(SUBSTRING "${C4REVISION_TS}" 6 -1 GIT_TIMESTAMP)
set(GIT_BRANCH "unknown")
endif()
if(WORKDIR_DIRTY)
set(WORKDIR_DIRTY 1)
set(C4REVISION "${C4REVISION}+")
endif()
set(${VAR} "${C4REVISION}" PARENT_SCOPE)
set(${VAR}_DIRTY ${WORKDIR_DIRTY} PARENT_SCOPE)
set(${VAR}_TS "${GIT_TIMESTAMP}" PARENT_SCOPE)
set(${VAR}_BRANCH "${GIT_BRANCH}" PARENT_SCOPE)
endfunction()

View File

@ -1,37 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2018, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# GCC6 doesn't work well with CMake while cross-compiling. See bugs:
# https://gitlab.kitware.com/cmake/cmake/issues/16291
# https://gitlab.kitware.com/cmake/cmake/issues/16919
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
function(HANDLE_GCC_CROSS_INCLUDE_PATHS _lang _gcc_lang_flag)
set(_compiler "${CMAKE_${_lang}_COMPILER}")
set(_compile_flags "${CMAKE_${_lang}_FLAGS}")
separate_arguments(_compile_flags UNIX_COMMAND "${_compile_flags}")
execute_process(
COMMAND ${_compiler} ${_compile_flags} -v -E -x ${_gcc_lang_flag} /dev/null
OUTPUT_QUIET
ERROR_VARIABLE _compiler_output
)
if ("${_compiler_output}" MATCHES "#include <\\.\\.\\.> search starts here:\n *(.*)\nEnd of search list\\.")
string(REGEX REPLACE "[\n ]+" " " _search_list "${CMAKE_MATCH_1}")
separate_arguments(_search_list)
foreach(_directory ${_search_list})
get_filename_component(_fixed_component "${_directory}" REALPATH)
set(_resolved_list ${_resolved_list} "${_fixed_component}")
endforeach()
set(CMAKE_${_lang}_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_${_lang}_IMPLICIT_INCLUDE_DIRECTORIES} ${_resolved_list} PARENT_SCOPE)
endif()
endfunction()

View File

@ -1,21 +1,20 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2013-2016, The OpenClonk Team and contributors
# Copyright (c) 2013 Nicolas Hake
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
# 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, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
# "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.${ARGN} Aborting.")
MESSAGE(FATAL_ERROR "${_var} is required for this project to build properly. Aborting.")
endif()
endmacro()

View File

@ -1,53 +0,0 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2009-2016, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
#
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
# See accompanying file "TRADEMARK" for details.
#
# To redistribute this file separately, substitute the full license texts
# for the above references.
include(Version.txt)
############################################################################
# Get revision from Git
############################################################################
include(GitGetChangesetID)
git_get_changeset_id(C4REVISION)
############################################################################
# Get year
############################################################################
STRING(TIMESTAMP C4COPYRIGHT_YEAR "%Y")
############################################################################
# Build version strings
############################################################################
SET(C4ENGINEID "${C4PROJECT_TLD}.${C4PROJECT_DOMAIN}.${C4ENGINENICK}")
set(C4ENGINECAPTION "${C4ENGINENAME}")
set(C4VERSION "${C4XVER1}.${C4XVER2}")
if(C4VERSIONEXTRA)
set(C4VERSION "${C4VERSION}-${C4VERSIONEXTRA}")
endif()
if(WIN32)
set(C4VERSION "${C4VERSION} win")
elseif(APPLE)
set(C4VERSION "${C4VERSION} mac")
elseif(UNIX)
set(C4VERSION "${C4VERSION} unix")
else()
set(C4VERSION "${C4VERSION} strange")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/C4Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/C4Version.h ESCAPE_QUOTES)
if(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/res/WindowsGamesExplorer.xml.in ${CMAKE_CURRENT_BINARY_DIR}/WindowsGamesExplorer.xml ESCAPE_QUOTES)
endif()

View File

@ -1,31 +1,72 @@
/* Activate DebugRecs */
#cmakedefine DEBUGREC 1
/* Generate minidumps on crash */
#cmakedefine HAVE_DBGHELP 1
/* Use backward-cpp to print stack traces on crash */
#cmakedefine HAVE_BACKWARD 1
/* Define to 1 if you have the <direct.h> header file. */
#cmakedefine HAVE_DIRECT_H 1
/* The backtrace function is declared in execinfo.h and works */
#cmakedefine HAVE_EXECINFO_H 1
/* Whether FMOD shall be used */
#cmakedefine HAVE_FMOD 1
/* Define to 1 if you have FreeType2. */
#cmakedefine HAVE_FREETYPE 1
/* Define to 1 if you have the <history.h> header file. */
#cmakedefine HAVE_HISTORY_H 1
/* Define if you have the iconv() function. */
#cmakedefine HAVE_ICONV 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the <io.h> header file. */
#cmakedefine HAVE_IO_H 1
/* Define to 1 if you have the <langinfo.h> header file. */
#cmakedefine HAVE_LANGINFO_H 1
/* Define if you have a readline compatible library */
#cmakedefine HAVE_LIBREADLINE 1
/* Define to 1 if you have SDL_mixer. */
#cmakedefine HAVE_LIBSDL_MIXER 1
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1
/* Define to 1 if you have support for nullptr. */
#cmakedefine HAVE_NULLPTR 1
/* Define to 1 if you have the <poll.h> header file. */
#cmakedefine HAVE_POLL_H 1
/* Define if you have POSIX threads libraries and header files. */
#cmakedefine HAVE_PTHREAD 1
/* Define to 1 if you have the <readline.h> header file. */
#cmakedefine HAVE_READLINE_H 1
/* Define if your readline library has \`add_history' */
#cmakedefine HAVE_READLINE_HISTORY 1
/* Define to 1 if you have the <readline/history.h> header file. */
#cmakedefine HAVE_READLINE_HISTORY_H 1
/* Define to 1 if you have the <readline/readline.h> header file. */
#cmakedefine HAVE_READLINE_READLINE_H 1
/* C++ Compiler has rvalue references, a C++0x feature. */
#cmakedefine HAVE_RVALUE_REF 1
/* Define to 1 if you have SDL. */
#cmakedefine HAVE_SDL 1
@ -35,6 +76,21 @@
/* Define to 1 if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H 1
/* Define to 1 if your compiler supports static_assert */
#cmakedefine HAVE_STATIC_ASSERT 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define to 1 if you have the <sys/eventfd.h> header file. */
#cmakedefine HAVE_SYS_EVENTFD_H 1
@ -62,55 +118,83 @@
/* Define to 1 if you have the `vasprintf' function. */
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VFW32
/* Define to 1 if you have the <X11/extensions/Xrandr.h> header file. */
#cmakedefine HAVE_X11_EXTENSIONS_XRANDR_H 1
/* Define to 1 if you have the <X11/keysym.h> header file. */
#cmakedefine HAVE_X11_KEYSYM_H 1
/* Define as const if the declaration of iconv() needs const. */
#cmakedefine ICONV_CONST
/* compile without debug options */
#cmakedefine NDEBUG 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#cmakedefine NO_MINUS_C_MINUS_O 1
/* Define to the address where bug reports for this package should be sent. */
#cmakedefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#cmakedefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#cmakedefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#cmakedefine PACKAGE_TARNAME
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#cmakedefine PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS 1
/* dedicated server mode */
#cmakedefine USE_CONSOLE 1
/* DirectX graphics */
#cmakedefine USE_DIRECTX 1
/* OpenGL graphics */
#cmakedefine USE_GL 1
/* MP3 music */
#cmakedefine USE_MP3 1
/* Define to 1 if the userParam parameter to GLDEBUGPROCARB is const, as the
spec requires. */
#cmakedefine GLDEBUGPROCARB_USERPARAM_IS_CONST 1
/* OpenAL sound */
#cmakedefine USE_OPEN_AL 1
/* Define to 1 if SDL is used for the main loop */
#cmakedefine USE_SDL_MAINLOOP 1
/* Define to 1 if the X Window System is used */
#cmakedefine USE_X11 1
/* Enable automatic update system */
#cmakedefine WITH_AUTOMATIC_UPDATE 1
/* Developer mode */
#cmakedefine WITH_DEVELOPER_MODE 1
/* Glib */
#cmakedefine WITH_GLIB 1
/* Define to 1 if the X Window System is missing or not being used. */
#cmakedefine X_DISPLAY_MISSING 1
/* compile with debug options */
#cmakedefine _DEBUG 1
#ifndef USE_CONSOLE
/* The widgets for the windows and the editor GUI */
#cmakedefine USE_SDL_MAINLOOP 1
#cmakedefine USE_WIN32_WINDOWS 1
/* Define to 1 if you have support for precompiled headers */
#cmakedefine HAVE_PRECOMPILED_HEADERS 1
/* Use Apple Cocoa for the UI */
#cmakedefine USE_COCOA 1
#cmakedefine USE_GTK 1
/* Enable automatic update system */
#cmakedefine WITH_AUTOMATIC_UPDATE 1
#cmakedefine WITH_APPDIR_INSTALLATION 1
/* Select an audio provider */
#define AUDIO_TK AUDIO_TK_${Audio_TK_UPPER}
#else
#define AUDIO_TK AUDIO_TK_NONE
#endif // USE_CONSOLE
#define AUDIO_TK_NONE 0
#define AUDIO_TK_OPENAL 1
#define AUDIO_TK_SDL_MIXER 3
/* Include OpenAL extensions (alext.h) for sound modifiers */
#cmakedefine HAVE_ALEXT 1
/* Path to data directory */
#ifdef WITH_APPDIR_INSTALLATION
#define OC_SYSTEM_DATA_DIR "../share/games/openclonk"
#else
#define OC_SYSTEM_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/games/openclonk"
#endif
/* Path to /proc/self/exe (Linux) or equivalent */
#cmakedefine PROC_SELF_EXE "${PROC_SELF_EXE}"

209
config.h.in 100644
View File

@ -0,0 +1,209 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Activate DebugRecs */
#undef DEBUGREC
/* define if the Boost library is available */
#undef HAVE_BOOST
/* Generate minidumps on crash */
#undef HAVE_DBGHELP
/* Define to 1 if you have the <dbghelp.h> header file. */
#undef HAVE_DBGHELP_H
/* Define to 1 if you have the <direct.h> header file. */
#undef HAVE_DIRECT_H
/* The backtrace function is declared in execinfo.h and works */
#undef HAVE_EXECINFO_H
/* Define to 1 if you have FreeType2. */
#undef HAVE_FREETYPE
/* Define to 1 if you have the <history.h> header file. */
#undef HAVE_HISTORY_H
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define if you have a readline compatible library */
#undef HAVE_LIBREADLINE
/* Define to 1 if you have SDL_mixer. */
#undef HAVE_LIBSDL_MIXER
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <natupnp.h> header file. */
#undef HAVE_NATUPNP_H
/* Define to 1 if you have support for nullptr. */
#undef HAVE_NULLPTR
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Have PTHREAD_PRIO_INHERIT. */
#undef HAVE_PTHREAD_PRIO_INHERIT
/* Define to 1 if you have the <readline.h> header file. */
#undef HAVE_READLINE_H
/* Define if your readline library has \`add_history' */
#undef HAVE_READLINE_HISTORY
/* Define to 1 if you have the <readline/history.h> header file. */
#undef HAVE_READLINE_HISTORY_H
/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
/* C++ Compiler has rvalue references, a C++0x feature. */
#undef HAVE_RVALUE_REF
/* Define to 1 if you have SDL. */
#undef HAVE_SDL
/* Define to 1 if you have the <share.h> header file. */
#undef HAVE_SHARE_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if your compiler supports static_assert */
#undef HAVE_STATIC_ASSERT
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/eventfd.h> header file. */
#undef HAVE_SYS_EVENTFD_H
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/inotify.h> header file. */
#undef HAVE_SYS_INOTIFY_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/timerfd.h> header file. */
#undef HAVE_SYS_TIMERFD_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* */
#undef HAVE_VFW32
/* Define to 1 if you have the <X11/extensions/Xrandr.h> header file. */
#undef HAVE_X11_EXTENSIONS_XRANDR_H
/* Define to 1 if you have the <X11/keysym.h> header file. */
#undef HAVE_X11_KEYSYM_H
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* compile without debug options */
#undef NDEBUG
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* dedicated server mode */
#undef USE_CONSOLE
/* DirectX graphics */
#undef USE_DIRECTX
/* OpenGL graphics */
#undef USE_GL
/* MP3 music */
#undef USE_MP3
/* OpenAL sound */
#undef USE_OPEN_AL
/* Define to 1 if SDL is used for the main loop */
#undef USE_SDL_MAINLOOP
/* Define to 1 if the X Window System is used */
#undef USE_X11
/* Enable automatic update system */
#undef WITH_AUTOMATIC_UPDATE
/* Developer mode */
#undef WITH_DEVELOPER_MODE
/* Glib */
#undef WITH_GLIB
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* compile with debug options */
#undef _DEBUG

428
configure.ac 100644
View File

@ -0,0 +1,428 @@
dnl Process this file with autoconf to produce a configure script.
# Copyright (c) 2005-2011 Günther Brammer
# Copyright (c) 2005, 2008 Peter Wortmann
# Copyright (c) 2006 Julian Raschke
# Copyright (c) 2010 Armin Burgmeier
# Copyright (c) 2010 Martin Plicht
# Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de
# 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.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_PREREQ([2.67])
AC_INIT([openclonk], [m4_esyscmd([sed -n 's/SET(C4XVER1\s\+\(.\+\))/\1/ p' Version.txt | tr -d '\n' | tr -d '\r'
]).m4_esyscmd([sed -n 's/SET(C4XVER2\s\+\(.\+\))/\1/ p' Version.txt | tr -d '\n' | tr -d '\r'
]).m4_esyscmd([sed -n 's/SET(C4XVER3\s\+\(.\+\))/\1/ p' Version.txt | tr -d '\n' | tr -d '\r'])])
AC_COPYRIGHT([©2005-2011 Günther Brammer])
AC_CONFIG_SRCDIR([/src/C4Include.h])
AC_CONFIG_AUX_DIR([autotools])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_CANONICAL_HOST
dnl foreign to tell automake to shut up,
dnl and subdir-objects because it makes the Makefile smaller.
dnl no-define because PACKAGE and VERSION are not used
AM_INIT_AUTOMAKE([foreign tar-ustar nostdinc no-define 1.10])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PROG_CXX
AC_LANG([C++])
AX_CHECK_COMPILE_FLAG([-std=gnu++0x], [CXX="${CXX} -std=gnu++0x"], [])
AC_MSG_CHECKING([for rvalue references])
AC_COMPILE_IFELSE([void f(struct D&&); int main() { return 0; }], [
AC_DEFINE([HAVE_RVALUE_REF], [], [C++ Compiler has rvalue references, a C++0x feature.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AX_PROG_CXX_REFTOTEMP
])
AC_MSG_CHECKING([for nullptr])
AC_COMPILE_IFELSE([int main() { void *d = nullptr; }], [
AC_DEFINE([HAVE_NULLPTR], [], [Define to 1 if you have support for nullptr.])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for static_assert])
AC_COMPILE_IFELSE([int main() { static_assert(true, \"\"); }], [
AC_DEFINE([HAVE_STATIC_ASSERT], [], [Define to 1 if your compiler supports static_assert])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_RANLIB
# Automake 1.12 breaks if this isn't run unconditionally
AC_PROG_OBJCXX
case $host in
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
win32=true; osx=false;;
*-*-darwin*)
win32=false; osx=true;;
*)
win32=false; osx=false;;
esac
# Detect Wine. Unfortunately, at the moment winegcc does not meet the demands
AC_CHECK_HEADER([windows.h], [win32=true], [], [[ ]])
AM_CONDITIONAL(WIN32, [test $win32 = true])
AM_CONDITIONAL(MACOSX, [test $osx = true])
# various used headers
dnl the whitespace is there to prevent AC_INCLUDES_DEFAULT
AC_CHECK_HEADERS([stdint.h unistd.h poll.h sys/file.h sys/stat.h sys/types.h locale.h sys/socket.h signal.h langinfo.h sys/eventfd.h sys/timerfd.h sys/inotify.h], , , [[ ]])
AC_CHECK_HEADERS([io.h direct.h share.h natupnp.h dbghelp.h], [], [], [[#include <windows.h>]])
# iconv
AX_ICONV
# vasprintf is a GNU extension
AC_CHECK_FUNCS(vasprintf)
# so is execinfo.h - and some systems have the header despite the functions not being in the c library
AC_CHECK_HEADER(execinfo.h)
if test "x$ac_cv_header_execinfo_h" = xyes; then
AC_CHECK_FUNC(backtrace, [], [
AC_CHECK_LIB(execinfo, backtrace, [
CLONK_LIBS="-lexecinfo $CLONK_LIBS"
], [
ac_cv_header_execinfo_h=no
])
])
fi
if test "x$ac_cv_header_execinfo_h" = xyes; then
AC_DEFINE(HAVE_EXECINFO_H, 1, [The backtrace function is declared in execinfo.h and works])
fi
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[debugging options [default=no]])],
, [enable_debug=no])
if test $enable_debug = yes; then
AC_DEFINE([_DEBUG], 1, [compile with debug options])
else
AC_DEFINE([NDEBUG], 1, [compile without debug options])
fi
AC_ARG_ENABLE([debugrec],
[AS_HELP_STRING([--enable-debugrec],[write additional debug control to records [default=no]])],
, [enable_debugrec=no])
if test $enable_debugrec = yes; then
AC_DEFINE([DEBUGREC], 1, [Activate DebugRecs])
fi
AC_ARG_ENABLE([console],
[AS_HELP_STRING([--enable-console],[compile as pure console application [default=no]])],
, [enable_console=no])
AC_ARG_ENABLE([sound],
[AS_HELP_STRING([--enable-sound],[compile with sound support [default=yes]])],
, [if test $enable_console = yes; then enable_sound=no; else enable_sound=yes; fi])
# GTK+
GTK2_REQUIRED="glib-2.0 >= 2.24 gtk+-2.0 >= 2.20"
GTK3_REQUIRED="glib-2.0 >= 2.32 gtk+-3.0 >= 3.4"
PKG_PROG_PKG_CONFIG
AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk],
[AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against [default: auto]])],
[case "$with_gtk" in
2.0|3.0) ;;
no) ;;
*) AC_MSG_ERROR([invalid gtk version specified]) ;;
esac],
[AS_IF([test $enable_console = no],
[PKG_CHECK_EXISTS([$GTK3_REQUIRED],
[with_gtk=3.0],
[PKG_CHECK_EXISTS([$GTK2_REQUIRED],
[with_gtk=2.0],
[with_gtk=no])])],
[with_gtk=no])])
AC_MSG_RESULT([$with_gtk])
AS_IF([test $with_gtk != no],[
case "$with_gtk" in
2.0) GTK_REQUIRED="$GTK2_REQUIRED"
MAPE_REQUIRED="$GTK2_REQUIRED gthread-2.0 gtksourceview-2.0"
;;
3.0) GTK_REQUIRED="$GTK3_REQUIRED"
MAPE_REQUIRED="$GTK3_REQUIRED gthread-2.0 gtksourceview-3.0"
;;
esac
PKG_CHECK_MODULES(GTK, [$GTK_REQUIRED])
AC_ARG_ENABLE([mape],
[AS_HELP_STRING([--enable-mape],[build mape landscape.txt editor [default: auto]])], [],
[PKG_CHECK_EXISTS([$MAPE_REQUIRED], [enable_mape=yes], [enable_mape=no])])
AS_IF([test $enable_mape != no],
[PKG_CHECK_MODULES(MAPE, [$MAPE_REQUIRED])])
AC_DEFINE([WITH_GLIB], 1, [Glib])
AC_DEFINE([WITH_DEVELOPER_MODE], 1, [Developer mode])
])
AM_CONDITIONAL(GTK, [test $with_gtk != no])
AM_CONDITIONAL(MAPE, [test $enable_mape != no])
# OpenAL
AC_ARG_WITH([openal],
[AS_HELP_STRING([--with-openal],[compile with openal support [default=no]])],
, [with_openal=no])
if test $with_openal = yes; then
PKG_CHECK_MODULES(OPENAL, [vorbis vorbisfile openal freealut])
AC_DEFINE([USE_OPEN_AL], 1, [OpenAL sound])
if test $enable_sound = no; then
AC_MSG_ERROR([--with-openal cannot be used with --disable-sound.])
fi
fi
# SDL
with_sdl_mixer=no
AC_ARG_WITH([sdl],
AS_HELP_STRING([--with-sdl], [Use SDL @<:@default=yes (no for win32)@:>@]),
, [if test $win32 = true; then with_sdl=no; else if test $enable_console = yes; then with_sdl=no; else with_sdl=yes; fi fi])
if test $with_sdl = yes; then
# Check for SDL
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,
[AC_DEFINE(HAVE_SDL, 1, [Define to 1 if you have SDL.])],
[AC_MSG_ERROR([libSDL not found.])])
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
if test $enable_sound = yes && test $with_openal = no; then
# Check for SDL_mixer library
AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,
[AC_DEFINE(HAVE_LIBSDL_MIXER,1,[Define to 1 if you have SDL_mixer.])
SDL_LIBS="-lSDL_mixer $SDL_LIBS"
with_sdl_mixer=yes],
[AC_MSG_ERROR([SDL_mixer not found.])],
[$SDL_LIBS])
fi
AC_ARG_ENABLE(sdlmainloop,
[AS_HELP_STRING([--enable-sdlmainloop],[use SDL instead of X11 or Win32 [default=no]])],
, [if test $osx = true; then enable_sdlmainloop=yes; else enable_sdlmainloop=no; fi ])
else
enable_sdlmainloop=no
fi
if test $enable_sdlmainloop = yes; then
with_x=no
AC_DEFINE(USE_SDL_MAINLOOP, 1, [Define to 1 if SDL is used for the main loop])
fi
AM_CONDITIONAL(SDL_MAIN_LOOP, [test $enable_sdlmainloop = yes])
if test $enable_sound = yes; then
AC_ARG_ENABLE([mp3],
[AS_HELP_STRING([--enable-mp3],[enable mp3 support [default=no]])],
, [enable_mp3=no])
if test $enable_mp3 = yes; then
AC_DEFINE([USE_MP3], 1, [MP3 music])
fi
fi
if test $enable_console = no; then
if test $win32 = true; then
AC_SUBST(WINDOWS_CFLAGS, "-mwindows")
fi
else
# console mode
AC_DEFINE([USE_CONSOLE], 1, [dedicated server mode])
with_x=no
enable_sdlmainloop=no
VL_LIB_READLINE
fi
AM_CONDITIONAL([CONSOLE], [test $enable_console = yes])
# Check for boost
AX_BOOST_BASE([1.40.0], [], [
AC_MSG_ERROR([Boost not found.])
])
# Check for libjpeg
AC_CHECK_LIB(jpeg, jpeg_read_header, [
CLONK_LIBS="-ljpeg $CLONK_LIBS"
], [
AC_MSG_ERROR([libjpeg not found.])
])
# Check for libpng
AC_CHECK_LIB(png, png_read_image, [
CLONK_LIBS="-lpng $CLONK_LIBS"
], [
AC_MSG_ERROR([libpng not found.])
], [-lz])
# Check for libz
AC_CHECK_LIB(z, deflate, [
Z_LIBS="-lz $Z_LIBS"
], [
AC_MSG_ERROR([libz not found.])
])
# Check for librt
AC_CHECK_LIB(rt, clock_gettime, [
LDADD="-lrt $LDADD"
], [])
# Check for libfreetype
if test $enable_console = no; then
PKG_CHECK_MODULES(FREETYPE, freetype2, ,[
if test "$cross_compiling" = no; then
AC_CHECK_PROG(FREETYPE_CONFIG, freetype-config, freetype-config)
fi
if test $FREETYPE_CONFIG; then
AC_SUBST(FREETYPE_CFLAGS, [`$FREETYPE_CONFIG --cflags`])
AC_SUBST(FREETYPE_LIBS, [`$FREETYPE_CONFIG --libs`])
else
AC_MSG_ERROR([Freetype not found.])
fi
])
AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have FreeType2.])
fi
# X11, Xrandr
AC_PATH_XTRA
if test $have_x = yes; then
AC_DEFINE(USE_X11, 1, [Define to 1 if the X Window System is used])
CLONK_LIBS="$X_LIBS $CLONK_LIBS"
AC_CHECK_HEADERS([X11/keysym.h X11/extensions/Xrandr.h], ,
[AC_MSG_ERROR([A required X11 header was not found.])], [[#include <X11/Xlib.h>]])
AC_CHECK_LIB(X11, XOpenDisplay, [CLONK_LIBS="-lX11 $CLONK_LIBS"],
[AC_MSG_ERROR([libX11 not found.])], [$X_LIBS])
AC_CHECK_LIB(Xrandr, XRRQueryExtension, [CLONK_LIBS="-lXrandr $CLONK_LIBS"],
[AC_MSG_ERROR([libXrandr not found.])], [$X_LIBS])
fi
# OpenGL
AC_ARG_WITH([gl],
[AS_HELP_STRING([--with-gl],[compile with opengl support [default=yes]])],
, [if test $enable_console = yes; then with_gl=no; else with_gl=yes; fi])
if test $with_gl = yes; then
if test $osx = true; then
CLONK_LIBS="-framework OpenGL $CLONK_LIBS"
PKG_CHECK_MODULES(GLEW, [glew], [CLONK_LIBS="$GLEW_LIBS $CLONK_LIBS"], [AC_MSG_ERROR([glew not found.])])
elif test $win32 = true; then
AC_CHECK_LIB(opengl32, main, [CLONK_LIBS="-lopengl32 $CLONK_LIBS"],
[AC_MSG_ERROR([opengl32 not found.])])
AC_CHECK_LIB(glu32, main, [CLONK_LIBS="-lglu32 $CLONK_LIBS"],
[AC_MSG_ERROR([glu32 not found.])])
AC_CHECK_LIB(glew32, main, [CLONK_LIBS="-lglew32 $CLONK_LIBS"],
[AC_MSG_ERROR([glew not found.])])
AC_SUBST([GLEW_CFLAGS],["-DGLEW_STATIC"])
else
AC_CHECK_LIB(GL, glBegin, [CLONK_LIBS="-lGL $CLONK_LIBS"],
[AC_MSG_ERROR([libGL not found.])])
AC_CHECK_LIB(GLU, gluOrtho2D, [CLONK_LIBS="-lGLU $CLONK_LIBS"],
[AC_MSG_ERROR([libGLU not found.])])
AC_CHECK_LIB(GLEW, glewInit, [CLONK_LIBS="-lGLEW $CLONK_LIBS"],
[AC_MSG_ERROR([glew not found.])])
fi
AC_DEFINE([USE_GL], 1, [OpenGL graphics])
fi
# DirectX
AC_ARG_WITH([directx],
[AS_HELP_STRING([--with-directx],[compile with directx support [default=no]])],
, [with_directx="no"])
if test "$with_directx" = yes; then
AC_CHECK_LIB(d3d9, main, [CLONK_LIBS="-ld3d9 $CLONK_LIBS"],
[AC_MSG_ERROR([d3d9 not found.])])
AC_DEFINE([USE_DIRECTX], 1, [DirectX graphics])
fi
# UPnP
AC_ARG_WITH([upnp],
[AS_HELP_STRING([--with-upnp],[compile with upnp support [default=no]])],
, [with_upnp=no])
AS_IF([test $with_upnp = yes], [
AM_CONDITIONAL(NATUPNP, [test "$ac_cv_header_natupnp_h" = yes])
PKG_CHECK_MODULES(LIBUPNP, [libupnp], [have_libupnp=yes], [have_libupnp=no])
], [
AM_CONDITIONAL(NATUPNP, [false])
have_libupnp=no
])
AM_CONDITIONAL(LIBUPNP, [test "$have_libupnp" = yes])
# Automatic Update
AC_ARG_ENABLE([autoupdate],
[AS_HELP_STRING([--disable-autoupdate],[support for automatic engine updates [default=yes]])],
, [enable_autoupdate="yes"])
AS_IF([test "$enable_autoupdate" = yes], [
AC_DEFINE([WITH_AUTOMATIC_UPDATE], 1, [Enable automatic update system])
])
AM_CONDITIONAL(AUTOUPDATE, [test "$enable_autoupdate" = yes])
if test $win32 = false; then
# pthread
AX_PTHREAD( , [AC_MSG_ERROR([No pthread support.])])
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
else
# Windows
for WIN32LIB in gdi32 comdlg32 ws2_32
do
AC_CHECK_LIB([$WIN32LIB], main, [CLONK_LIBS="-l$WIN32LIB $CLONK_LIBS"], [AC_MSG_ERROR([$WIN32LIB not found.])])
done
AC_CHECK_LIB([winmm], main, [LDADD="-lwinmm $LDADD"], [AC_MSG_ERROR([winmm not found.])])
AC_CHECK_LIB([vfw32], main, [
CLONK_LIBS="-lvfw32 $CLONK_LIBS"
AC_DEFINE([HAVE_VFW32], 1, [ ])
], [])
AC_CHECK_LIB([dbghelp], main, [AS_IF([test "x$ac_cv_header_dbghelp_h" = xyes], [
CLONK_LIBS="-ldbghelp $CLONK_LIBS"
AC_DEFINE([HAVE_DBGHELP], 1, [Generate minidumps on crash])
])], [])
# windres
AC_CHECK_TOOL(WINDRES, windres, no)
if test $WINDRES = no; then
AC_MSG_ERROR([windres not found.])
fi
# ASLR/DEP
LDADD="-Wl,--nxcompat -Wl,--dynamicbase $LDADD"
fi
AC_SUBST(LDADD)
AC_SUBST(CLONK_LIBS)
AC_SUBST(Z_LIBS)
# precompiled headers and -Wextra
AC_MSG_CHECKING([whether we are using a GNU C++ compiler version 4.1 or newer])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#if defined(__GNUC__) && (((__GNUC__ >= 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4))
// all ok
#else
choke me
#endif
]])], RECENT_GCC="yes", RECENT_GCC="no")
AC_MSG_RESULT([$RECENT_GCC])
AM_CONDITIONAL(RECENT_GCC, [test $RECENT_GCC = yes])
AC_OUTPUT
echo "Configuration:
CFLAGS: $CFLAGS
CXXFLAGS: $CXXFLAGS
Debug: $enable_debug
Debugrec: $enable_debugrec
Pure console: $enable_console
Autoupdate: $enable_autoupdate
DirectX: $with_directx
OpenGL: $with_gl
Nat/LibUPnP: $ac_cv_header_natupnp_h/$have_libupnp
Sound: $enable_sound
SDL_Mixer: $with_sdl_mixer
OpenAL: $with_openal
GTK+: $with_gtk
X11: $have_x"
if test "$enable_sdlmainloop" = yes; then echo " SDL: mainloop";
else echo " SDL: $with_sdl"; fi

View File

@ -19,7 +19,6 @@ HHC = hhc.exe
MKDIR_P = mkdir -p
CP = cp
CP_R = cp -r
NODE = node
stylesheet = clonk.xsl
@ -30,10 +29,9 @@ sdk-dirs := $(shell find sdk -name '.*' -prune -o -type d -print)
# find all *.xml files recursively in sdk/
xmlfiles := $(sort $(shell find sdk -name '.*' -prune -o -name 'content.xml' -prune -o -name \*.xml -print))
xmlfiles-de := $(subst sdk, sdk-de, $(xmlfiles))
# misc
extra-files := $(sort $(wildcard *.css *.js images/*.*) lunr.js)
extra-files := $(sort $(wildcard *.css *.php *.js images/*.*))
extra-files-chm := $(sort $(wildcard *.css *.js images/*.*))
# Targets:
@ -48,16 +46,15 @@ sdk-de-dirs := $(subst sdk, sdk-de, $(sdk-dirs))
online-dirs := $(foreach lang, en de, $(addprefix online/$(lang)/, $(sdk-dirs) images))
online-sdk-files := $(foreach lang, en de, $(addprefix online/$(lang)/, $(htmlfiles) sdk/content.html))
online-extra-files := $(foreach lang, en de, $(addprefix online/$(lang)/, $(extra-files)))
online-index-files := $(foreach lang, en de, $(addprefix online/$(lang)/, index.json))
# For Entwickler.chm
chm-dirs := $(foreach lang, en de, $(addprefix chm/$(lang)/, . $(sdk-dirs) images))
.PHONY: all online-en chm install check clean
all: $(sdk-de-dirs) $(online-dirs) $(online-sdk-files) $(online-extra-files) $(online-index-files)
all: $(sdk-de-dirs) $(online-dirs) $(online-sdk-files) $(online-extra-files)
online-en: $(addprefix online/en/, $(sdk-dirs) images $(htmlfiles) sdk/content.html $(extra-files) index.json)
online-en: $(addprefix online/en/, $(sdk-dirs) images $(htmlfiles) sdk/content.html $(extra-files))
chm: $(sdk-de-dirs) $(chm-dirs) chm/en/Developer.chm chm/de/Entwickler.chm
@ -72,36 +69,23 @@ clean:
rm -f *.mo Entwickler.chm Developer.chm doku.pot sdk/content.xml
rm -rf online sdk-de chm
sdk/content.xml: sdk/content.xml.in $(xmlfiles) tools/build_contents.py tools/experimental.py
sdk/content.xml: sdk/content.xml.in $(xmlfiles) build_contents.py experimental.py
@echo generate $@
@python2 tools/build_contents.py $(xmlfiles)
@python build_contents.py $(xmlfiles)
# Node dependencies for index.
node_modules/.make: package.json
npm install
@touch $@
lunr.js: node_modules/.make
$(CP) node_modules/lunr/lunr.js $@
online/en/index.json: node_modules/.make $(xmlfiles) tools/build_index.js
@$(NODE) tools/build_index.js $@ $(xmlfiles)
online/de/index.json: node_modules/.make $(xmlfiles-de) tools/build_index.js
@$(NODE) tools/build_index.js $@ $(xmlfiles-de)
chm/en/Output.hhp: $(xmlfiles) chm/en/. tools/build_hhp.py Template.hhp
chm/en/Output.hhp: $(xmlfiles) chm/en/. build_hhp.py Template.hhp
@echo generate $@
@python2 tools/build_hhp.py $@ Template.hhp $(xmlfiles)
chm/de/Output.hhp: $(xmlfiles) chm/de/. tools/build_hhp.py Template.de.hhp
@python build_hhp.py $@ Template.hhp $(xmlfiles)
chm/de/Output.hhp: $(xmlfiles) chm/de/. build_hhp.py Template.de.hhp
@echo generate $@
@python2 tools/build_hhp.py $@ Template.de.hhp $(xmlfiles)
@python build_hhp.py $@ Template.de.hhp $(xmlfiles)
$(sdk-de-dirs) $(online-dirs) $(chm-dirs):
mkdir -p $@
doku.pot: $(xmlfiles) extra-strings.xml sdk/content.xml.in tools/xml2po.py tools/clonk.py
doku.pot: $(xmlfiles) extra-strings.xml sdk/content.xml.in xml2po.py clonk.py
@echo extract strings to $@
@python2 tools/xml2po.py -e -m clonk -o $@ $(xmlfiles) extra-strings.xml sdk/content.xml.in
@python xml2po.py -e -m clonk -o $@ $(xmlfiles) extra-strings.xml sdk/content.xml.in
%.po: doku.pot
@echo update $@
@ -112,9 +96,9 @@ doku.pot: $(xmlfiles) extra-strings.xml sdk/content.xml.in tools/xml2po.py tools
@echo compile $@
@msgfmt --statistics -o $@ $<
sdk-de/%.xml: sdk/%.xml de.mo tools/xml2po.py tools/clonk.py
sdk-de/%.xml: sdk/%.xml de.mo xml2po.py clonk.py
@echo generate $@
@python2 tools/xml2po.py -e -m clonk -t de.mo -o $@ $<
@python xml2po.py -e -m clonk -t de.mo -o $@ $<
define run-xslt
@echo generate $@

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import xml.sax

View File

@ -35,12 +35,7 @@
</title>
</xsl:template>
<xsl:template match="script">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:copy />
</xsl:for-each>
<xsl:apply-templates />
</xsl:copy>
<xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy>
</xsl:template>
<xsl:template match="func|const" mode="head">
<xsl:apply-templates mode="head" />
@ -341,7 +336,7 @@
</xsl:if>
<xsl:if test="position() mod 2=0"><xsl:attribute name="class">dark</xsl:attribute></xsl:if>
<xsl:for-each select="col|literal_col">
<td><xsl:apply-templates select="@colspan|@id|node()"/></td>
<td><xsl:apply-templates select="@colspan|node()"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
@ -354,6 +349,16 @@
<caption><xsl:apply-templates select="@id|node()" /></caption>
</xsl:template>
<xsl:template match="search">
<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">
<xsl:value-of select="." />:
<input id="input" onKeyUp="Calc();" name="input" type="text">
@ -511,7 +516,7 @@
<xsl:template name="color2">
<xsl:param name="s" select="." />
<!-- the list of keywords -->
<xsl:param name="t" select="'#include|#appendto|#warning|public|private|protected|global|static|var|local|const|any|int|bool|def|effect|object|proplist|string|array|func|return|if|else|break|continue|while|for|new|true|false|nil|'" />
<xsl:param name="t" select="'#include|#appendto|public|private|protected|global|static|var|local|const|any|int|bool|def|effect|object|proplist|string|array|func|return|if|else|break|continue|while|for|true|false|nil|'" />
<xsl:param name="w" select="substring-before($t, '|')" />
<!-- text before the keyword -->
<xsl:variable name="l" select="substring-before($s, $w)" />

11390
docs/de.po

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,3 @@
@font-face{
font-family: Endeavour;
/*src: url('/Endeavour.eot');
src: local('Endeavour'),url('/Endeavour.ttf') format("truetype");*/
}
body {
margin: 0;
font-size: small;
@ -15,7 +9,7 @@ body {
}
#iframe {
position: absolute; top: 143px; left: 0; width: 300px; border: 0; bottom: 0; overflow: auto;
position: absolute; top: 145px; width: 300px; border: 0; bottom: 0; overflow: auto;
height: auto;
display: block;
}
@ -42,8 +36,7 @@ body {
#content {
padding: 0 1em;
margin: 0 auto;
position: absolute; top: 143px; left: 300px; right: 0; bottom: 0; overflow: auto;
background: white;
position: absolute; top: 145px; left: 300px; right: 0; bottom: 0; overflow: auto;
}
.text, pre.code, ul, ol, dl {
@ -243,10 +236,12 @@ ul.nav a {
text-decoration: none;
}
ul.nav a:hover, ul.nav a:hover {
background: #333 url(images/stripe-wide.gif) left repeat-x;
}
ul.nav li.switchlang img {
margin: 0;
}
a {
color: rgb(0, 102, 153);
}

View File

@ -3,50 +3,66 @@ Unfortunately, xml documents can only have one root, so there needs to be a dumm
header is an appropiate html element, so it's arbitrarily chosen.
clonk.xsl also uses it to match the processing for it. -->
<header>
<style type="text/css">@import url("https://www.openclonk.org/header/header.css");</style>
<style type="text/css">@import url("http://www.openclonk.org/header/header.css");</style>
<div id="nav_header">
<div id="nav_doclangswitch">
<a href="https://docs.openclonk.org/en/sdk/" target="_top"><img src="https://forum.openclonk.org/flags/gb.png"/></a>
<a href="https://docs.openclonk.org/de/sdk/" target="_top"><img src="https://forum.openclonk.org/flags/de.png"/></a>
<div id="nav_logo">
<a href="http://www.openclonk.org/" target="_top"><img src="http://www.openclonk.org/header/logo.png" alt="OpenClonk"/></a>
</div>
</div>
<div id="nav_navigation">
<div id="nav_search">
<form action="https://www.openclonk.org/header/search.php" id="nav_searchform" method="get" target="_top"><div>
<input id="nav_searchInput" name="s" type="text" value="search" onfocus="if(this.value == 'search') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'search'; }"/> in the
<select value="docs" name="p">
<form action="http://www.openclonk.org/header/search.php" id="searchform" method="get" target="_top"><div>
search <input id="searchInput" name="s" type="text" value="" /> in the
<select name="p">
<option value="blog">blog</option>
<option value="wiki">website</option>
<option value="forum">forum</option>
<option value="docs">documentation</option>
<option value="git">repository</option>
<option value="crucible">crucible</option>
<option selected="selected" value="docs">c4script documentation</option>
<option value="bugtrack">bugtracker</option>
<option value="forum">forum</option>
<option value="git">repository</option>
<option value="git-resources">resources repository</option>
<option value="wiki">website</option>
</select>
<input type='submit' id="nav_searchButton" value="Go" title="Search" />
<input type='submit' class="nav_searchButton" id="searchButton" value="Go" title="Search" />
</div></form>
</div>
<div id="nav_logo">
<a href="https://www.openclonk.org/" target="_top"><img src="https://www.openclonk.org/header/logo.png" width="450" height="94" alt="OpenClonk"/></a>
</div>
<div id="nav_navigation">
<div id="nav_links">
<ul>
<li><a href="https://www.openclonk.org/" target="_top">Home</a></li>
<li><a href="https://www.openclonk.org/download/" target="_top">Download</a></li>
<li><a href="https://blog.openclonk.org/" target="_top">Blog</a></li>
<li><a href="https://forum.openclonk.org/" target="_top">Forum</a></li>
<li><a href="https://league.openclonk.org/" target="_top">League</a></li>
<li><a href="https://wiki.openclonk.org/w/C4Script_Documentation" target="_top">Docs</a></li>
<li><a href="https://wiki.openclonk.org/w/Development" target="_top">Developers</a></li>
<li><a href="https://git.openclonk.org/openclonk.git" target="_top">Repository</a></li>
<li><a href="https://bugs.openclonk.org" target="_top">Bugs</a></li>
</ul>
</div>
</div>
<div style="float:right">
<ul>
<li>
<a href="http://docs.openclonk.org/en/sdk/" target="_top"><img src="http://forum.openclonk.org/flags/gb.png"/></a>
</li>
<li>
<a href="http://docs.openclonk.org/de/sdk/" target="_top"><img src="http://forum.openclonk.org/flags/de.png"/></a>
</li>
</ul>
</div>
<ul>
<li><a class="current" href="http://www.openclonk.org/" target="_top">Home</a> <ul>
<li><a href="http://wiki.openclonk.org/w/FAQ" target="_top">FAQ</a></li>
<li><a href="http://wiki.openclonk.org/w/About" target="_top">About</a></li>
</ul>
</li>
<li><!--[if lt IE 9]><span><![endif]--><a href="http://www.openclonk.org/download/" target="_top">Download</a><!--[if lt IE 9]></span><![endif]--> <ul>
<li><a href="http://www.openclonk.org/download/" target="_top">Latest Release</a></li>
<li><a href="http://www.openclonk.org/nightly-builds" target="_top">Development Snapshot</a></li>
<li><a href="http://www.openclonk.org/builds/release/" target="_top">Archive</a></li>
</ul>
</li>
<li><!--[if lt IE 9]><span><![endif]--><a href="http://forum.openclonk.org/" target="_top">Forum</a><!--[if lt IE 9]></span><![endif]--></li>
<li><!--[if lt IE 9]><span><![endif]--><a href="http://wiki.openclonk.org/w/Development" target="_top">Development</a><!--[if lt IE 9]></span><![endif]--> <ul>
<li><a href="http://bugs.openclonk.org" target="_top">Bugtracker</a></li>
<li><a href="http://git.openclonk.org/openclonk.git" target="_top">Repository</a></li>
<li><a href="http://git.openclonk.org/openclonk-resources.git" target="_top">Resource Repository</a></li>
</ul>
</li>
<li><!--[if lt IE 9]><span><![endif]--><a class="current" href="http://wiki.openclonk.org/w/C4Script_Documentation" target="_top">Documentation</a><!--[if lt IE 9]></span><![endif]--> <ul>
<li><a href="http://docs.openclonk.org/en/sdk/" target="_top">C4Script Reference</a></li>
</ul>
</li>
<li><!--[if lt IE 9]><span><![endif]--><a href="http://blog.openclonk.org/" target="_top">Blog</a><!--[if lt IE 9]></span><![endif]--></li>
</ul>
</div>
</header>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

32
docs/package-lock.json generated
View File

@ -1,32 +0,0 @@
{
"name": "openclonk-docs",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"lunr": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.1.6.tgz",
"integrity": "sha512-ydJpB8CX8cZ/VE+KMaYaFcZ6+o2LruM6NG76VXdflYTgluvVemz1lW4anE+pyBbLvxJHZdvD1Jy/fOqdzAEJog=="
},
"sax": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": "1.2.4",
"xmlbuilder": "9.0.7"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
}
}
}

View File

@ -1,22 +0,0 @@
{
"name": "openclonk-docs",
"version": "1.0.0",
"description": "Developer documentation for OpenClonk",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/openclonk/openclonk.git"
},
"author": "The OpenClonk Team",
"license": "ISC",
"bugs": {
"url": "https://github.com/openclonk/openclonk/issues"
},
"homepage": "https://github.com/openclonk/openclonk#readme",
"dependencies": {
"lunr": "^2.1.6",
"xml2js": "^0.4.19"
}
}

View File

@ -16,7 +16,7 @@
</dd>
<dt id="fullscreen">--fullscreen</dt>
<dd>
<text>Starts in fullscreen mode (also called player mode). If no scenario and no direct join address is given, the startup menu is shown.</text>
<text>Starts in fullscreen mode (also called player mode). If no scenario and no direct join adress is given, the startup menu is shown.</text>
</dd>
<dt id="config">--config=Filename</dt>
<dd>
@ -56,7 +56,7 @@
<dd>
<text>Searches for a network game on the specified address and joins it. No local scenario (*.ocs) should be specified. Implies --network.</text>
</dd>
<dt id="clonkp">[open]clonk://&lt;<em>Address</em>&gt;/</dt>
<dt id="clonkp">clonk://&lt;<em>Address</em>&gt;/</dt>
<dd>
<text>Same as --join if an address is specified. If "update" is specified as an address, this will cause the engine to perform an update check instead.</text>
</dd>
@ -88,10 +88,6 @@
<dd>
<text>Only for fullscreen startup menu: Instead of the main menu, one of the submenus is shown directly. Possible values for &lt;<em>Name</em>&gt; are <em>main</em> (Main menu), <em>scen</em> (Scenario selection), <em>netscen</em> (Scenario selection for a new network game), <em>net</em> (Network/Internet game list), <em>options</em> (Options menu) und <em>plrsel</em> (Player selection).</text>
</dd>
<dt id="scenpar">--scenpar=&lt;<em>Parameter=Value</em>&gt;</dt>
<dd>
<text>Sets the <emlink href="scenario/ParameterDefs.xml">custom scenario parameter</emlink>. E.g. --scenpar=Difficulty=1.</text>
</dd>
<dt id="ocs">*.ocs</dt>
<dd>
<text>If a scenario is specified (File extension .ocs), it will be started directly.</text>

View File

@ -87,7 +87,6 @@
<li><emlink href="scenario/scenario.html">Scenario</emlink></li>
<li><emlink href="scenario/Teams.html">Multiplayer</emlink></li>
<li><emlink href="scenario/MapCreatorS2.html">Map Generator</emlink></li>
<li><emlink href="script/MapScript.html">Map Scripts</emlink></li>
<li><emlink href="scenario/script.html">Scripts</emlink></li>
</ul>
</li>
@ -111,16 +110,8 @@
<li><emlink href="script/BreakContinue.html">Loop Control</emlink></li>
<li><emlink href="script/AppendTo.html">#appendto</emlink></li>
<li><emlink href="script/Effects.html">Effects</emlink></li>
<li><emlink href="script/GUI.html">Script GUIs</emlink></li>
<li><emlink href="script/GetXXVal.html">Querying Game Data</emlink></li>
<li><emlink href="script/ScriptPlayers.html">Script Players</emlink></li>
<li><emlink href="script/SoundModifiers.html">Sound Modifiers</emlink></li>
<li>Libraries
<ul>
<li><emlink href="script/Shape.html">Shape</emlink></li>
<li><emlink href="script/FuzzyLogic.html">Fuzzy Logic</emlink></li>
</ul>
</li>
<!-- Insert Functions here -->
</ul>
</li>
@ -131,21 +122,14 @@
<![CDATA[
(function() {
function navigate(url) {
var urlsplit = url.split("#");
var xhr = new XMLHttpRequest();
xhr.open('GET', urlsplit[0]);
xhr.open('GET', url.split("#")[0]);
xhr.onreadystatechange = function (e) {
if (xhr.readyState === 4) {
var d = parent.document;
var r = xhr.responseText;
d.getElementById("content").innerHTML = r.split('<div id="content">')[1];
d.title = r.slice(r.indexOf("<title>")+7, r.indexOf("</title>"));
if (urlsplit.length > 1) {
var scrolltarget = d.getElementById(urlsplit[1]);
if (scrolltarget) {
scrolltarget.scrollIntoView();
}
}
}
};
xhr.send();
@ -211,10 +195,6 @@
window.scrollTo(0, y0);
}
})();
// Collapse the index.
document.querySelector('.index > img').onclick();
]]>
</script>
<script src="../lunr.js"></script>
<script src="../search.js"></script>
</toc>

View File

@ -15,11 +15,6 @@
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Prototype</literal_col>
<col>proplist</col>
<col>Must be Action. See below in the example.</col>
</row>
<row>
<literal_col>Name</literal_col>
<col>String</col>
@ -48,7 +43,7 @@
<row>
<literal_col>Directions</literal_col>
<col>Integer</col>
<col>Number of animation directions. Animation directions are arranged vertically in Graphics.png. Default 1.</col>
<col>Number of animation directions. Animation directions are arranged vertically in Graphics.png.</col>
</row>
<row>
<literal_col>FlipDir</literal_col>
@ -58,7 +53,7 @@
<row>
<literal_col>Length</literal_col>
<col>Integer</col>
<col>Number of animation phases for this activity (arranged horizontally in Graphics.png). Default 1.</col>
<col>Number of animation phases for this activity (arranged horizontally in Graphics.png)</col>
</row>
<row>
<literal_col>Reverse</literal_col>
@ -70,15 +65,10 @@
<col>Integer</col>
<col>Time difference in frames (ticks) between two animation phases.</col>
</row>
<row>
<literal_col>Step</literal_col>
<col>Integer</col>
<col>How many animation phases the animation should advance after Delay frames. Default 1.</col>
</row>
<row>
<literal_col>Attach</literal_col>
<col>Integer</col>
<col>A bitmask for the attachment to surfaces. See <emlink href="definition/cnat.html">CNAT Values</emlink> for a documentation of possible values. Only evaluated if the procedure is NONE.</col>
<col>Attachment to surfaces: <emlink href="definition/cnat.html">CNAT Value</emlink>, e.g. value 8 if the object should attach to the floor like a walking clonk does; or 4 for attachment to the ceiling like a hangling clonk. Only evaluated if the procedure is NONE.</col>
</row>
<row>
<literal_col>X</literal_col>
@ -100,16 +90,6 @@
<col>Integer</col>
<col>Height of the animation graphic from Graphics.png.</col>
</row>
<row>
<literal_col>OffX</literal_col>
<col>Integer</col>
<col>X-Offset at which to display the animation graphics.</col>
</row>
<row>
<literal_col>OffY</literal_col>
<col>Integer</col>
<col>Y-Offset at which to display the animation graphics.</col>
</row>
<row>
<literal_col>FacetBase</literal_col>
<col>Integer</col>
@ -122,13 +102,13 @@
</row>
<row>
<literal_col>FacetTargetStretch</literal_col>
<col>Integer</col>
<col>Boolean</col>
<col>0 or 1. If 1, the graphics will be stretched down towards the upper border of the ActionTarget. Used e.g. for the elevator line.</col>
</row>
<row>
<literal_col>NextAction</literal_col>
<col>String</col>
<col>Next action being set after the current one has reached its end. If it is not specified, the action will be kept and the animation phase resets to 0 and the animation begins anew. If it is "Hold", the action will also be kept but stops at the last animation frame. If it is "Idle", the object will have no action after this one.</col>
<col>Next action being set after the current one has reached its end.</col>
</row>
<row>
<literal_col>NoOtherAction</literal_col>
@ -137,22 +117,22 @@
</row>
<row>
<literal_col>StartCall</literal_col>
<col>String</col>
<col>String (max. 30 chars)</col>
<col>Object script function which is called when the activity is started.</col>
</row>
<row>
<literal_col>EndCall</literal_col>
<col>String</col>
<col>String (max. 30 chars)</col>
<col>Called when an activity reaches the end of its animation.</col>
</row>
<row>
<literal_col>PhaseCall</literal_col>
<col>String</col>
<col>String (max. 30 chars)</col>
<col>Called whenever the animation phase changes.</col>
</row>
<row>
<literal_col>AbortCall</literal_col>
<col>String</col>
<col>String (max. 30 chars)</col>
<col>Called if an activity is being replaced by another before its regular end; i.e. not by a transition through NextAction. Parameters are the previous animation phase, previous ActionTarget and previous ActionTarget2.</col>
</row>
<row>
@ -162,8 +142,8 @@
</row>
<row>
<literal_col>Sound</literal_col>
<col>String</col>
<col>Permanent sound being played during this action. The same can be achieved with <funclink>Sound</funclink> which is the more flexible solution.</col>
<col>String (max. 30 chars)</col>
<col>Permanent sound being played during this action.</col>
</row>
<row>
<literal_col>ObjectDisabled</literal_col>
@ -178,7 +158,7 @@
<row>
<literal_col>Animation</literal_col>
<col>String</col>
<col>Specifies the animation to be played in the mesh of the object. Works only if the object uses a mesh for its graphics. If given all of Facet, FacetBase, FacetTopFace and FacetTargetStretch are ignored. The Length times Delay possible animation phases are mapped linearly on the animation length. If Delay equals 0 only Length will be used and the animation does not play automatically. See <emlink href="definition/animations.html">Animations</emlink> for further documentation on animations.</col>
<col>Specifies the animation to be played in the mesh of the object. Works only if the object uses a mesh for its graphics. If given all of Facet, FacetBase, FacetTopFace and FacetTargetStretch are ignored. The Length times Delay possible animation phases are mapped linearly on the animation length. If Delay equals 0 only Length will be used and the animation does not play automatically. See <emlink href="definition/animations.html">Animationen</emlink> for further documentation on animations.</col>
</row>
</table>
</text>

View File

@ -52,10 +52,6 @@
<col><funclink>Anim_AbsY</funclink></col>
<col>Linear with Y position. However, the animation is always played in the same direction, not taking into account whether the object moves upwards or downwards.</col>
</row>
<row>
<col><funclink>Anim_Dist</funclink></col>
<col>Linear in distance travelled. This is basically a combination of <funclink>Anim_AbsX</funclink> and <funclink>Anim_AbsY</funclink> where both coordinates are taken into account.</col>
</row>
<row>
<col><funclink>Anim_XDir</funclink></col>
<col>Proportional to the horizontal speed of the object.</col>

View File

@ -7,88 +7,67 @@
<h>Object Categories</h>
<part>
<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>A category also specifies the default plane an object is drawn in if it doesn't specify this property itself. The higher the plane number, the further in the front an object is drawn. See <emlink href="definition/properties.html">Properties</emlink>.</text>
<text>
<table>
<rowh>
<col>Category</col>
<col>Description</col>
<col>Default plane</col>
</rowh>
<row>
<col>C4D_None</col>
<col>No category.</col>
<col></col>
</row>
<row>
<col>C4D_StaticBack</col>
<col>Immovable object.</col>
<col>100</col>
</row>
<row>
<col>C4D_Structure</col>
<col>Structures.</col>
<col>200</col>
<col>Unused.</col>
</row>
<row>
<col>C4D_Vehicle</col>
<col>Vehicles.</col>
<col>300</col>
<col>Unused.</col>
</row>
<row>
<col>C4D_Living</col>
<col>A living being.</col>
<col>400</col>
</row>
<row>
<col>C4D_Object</col>
<col>An item that can hit alive objects.</col>
<col>500</col>
</row>
<row>
<col>C4D_Goal</col>
<col>Game goal.</col>
<col></col>
</row>
<row>
<col>C4D_Environment</col>
<col>Environmental control object.</col>
<col></col>
</row>
<row>
<col>C4D_Rule</col>
<col>Rule control object.</col>
<col></col>
</row>
<row>
<col>C4D_Background</col>
<col>Object is behind the landscape. Can be combined with any of the first 5 categories.</col>
<col>-600 (combined with C4D_StaticBack) to -100 (C4D_Object)</col>
<col>Object is behind the landscape.</col>
</row>
<row>
<col>C4D_Parallax</col>
<col>Object moves parallax according to the Parallaxity property. For more information see <funclink>C4D_Parallax</funclink>.</col>
<col></col>
</row>
<row>
<col>C4D_MouseSelect</col>
<col>Object can be clicked with the mouse, causing a MouseSelection(int player) callback in the object.</col>
<col></col>
</row>
<row>
<col>C4D_Foreground</col>
<col>Object is always in the foreground, even before global particles.</col>
<col>+1100 (combined with C4D_StaticBack) to +1500 (C4D_Object)</col>
</row>
<row>
<col>C4D_MouseIgnore</col>
<col>Object cannot be selected with the mouse.</col>
<col></col>
</row>
<row>
<col>C4D_IgnoreFoW</col>
<col>Object is drawn above fog of war. Useful for creating status displays or gui elements using objects.</col>
<col></col>
</row>
</table>
</text>
@ -101,6 +80,6 @@
</examples>
</part>
<author>Sven2</author><date>2006-05</date>
<author>Newton</author><date>2005-01</date>
<author>Günther</author><date>2005, 2011</date>
<date>2013-11</date>
</doc>

View File

@ -5,49 +5,61 @@
<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 <code id="CNAT">CNAT</code> bit <em>left</em>. If that object has <emlink href="definition/properties.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>
<col>Bit</col>
<col>Value</col>
<col>CNAT</col>
<col>Description</col>
</rowh>
<row>
<col>0</col>
<col>1</col>
<col>CNAT_Left</col>
<col>Direction: Left</col>
</row>
<row>
<col>1</col>
<col>2</col>
<col>CNAT_Right</col>
<col>Direction: Right</col>
</row>
<row>
<col>2</col>
<col>4</col>
<col>CNAT_Top</col>
<col>Direction: Up</col>
</row>
<row>
<col>3</col>
<col>8</col>
<col>CNAT_Bottom</col>
<col>Direction: Down</col>
</row>
<row>
<col>4</col>
<col>16</col>
<col>CNAT_Center</col>
<col>Direction: Center (not for attachment)</col>
</row>
<row>
<col>5</col>
<col>32</col>
<col>CNAT_MultiAttach</col>
<col>Special flag: new attachment behaviour for objects with the same direction value at several vertices.</col>
</row>
<row>
<col>6</col>
<col>64</col>
<col>CNAT_NoCollision</col>
<col>Extra flag: non-colliding vertex</col>
</row>
<row>
<col>CNAT_PhaseHalfVehicle</col>
<col>Extra flag: Entirely suppress collisions with HalfVehicle</col>
</row>
<bitmask>CNAT</bitmask>
</table>
</text>
<text>A vertex can have multiple CNAT values, they can be combined them with the | operator. Example:</text>
<code>Attach = CNAT_Bottom | CNAT_Left</code>
<author>Newton</author><date>2013-11</date>
<author>Sven2</author><date>2002-04</date>
<author>Newton &amp; Günther</author><date>2005-01</date>
<author>Matthes</author><date>2005-08</date>
</doc>

View File

@ -25,16 +25,26 @@
<col>3 Integers</col>
<col>Minimal engine version required by the object. Should be always the current engine version at the time of the last change.</col>
</row>
<row>
<literal_col>RequireDef</literal_col>
<col>Definition IDs</col>
<col>List of definition IDs this object depends upon.</col>
</row>
<row>
<literal_col>Name</literal_col>
<col>String (max. 30 chars)</col>
<col>Name of the object. Will be overwritten by the applicable one in the Names.txt.</col>
</row>
<row>
<literal_col>Category</literal_col>
<col>Integer</col>
<col>Category of the object. Also see <emlink href="definition/category.html">object categories</emlink>.</col>
</row>
<row>
<literal_col>MaxUserSelect</literal_col>
<col>Integer</col>
<col>Maximal allowed count when placed in the menu system.</col>
</row>
<row>
<literal_col>ContactCalls</literal_col>
<col>Integer</col>
<col>0 or 1. If 1, Contactcalls are called in the object script.</col>
</row>
<row>
<literal_col>Width</literal_col>
<col>Integer</col>
@ -60,10 +70,15 @@
<col>Integer</col>
<col>Weight of the object. Rock 10, clonk 50, hut 1000, castle 10000.</col>
</row>
<row>
<literal_col>Components</literal_col>
<col>ID list</col>
<col>Elements from which the object is composed. Uncompleted or half grown objects will only have the respective fraction of the components.</col>
</row>
<row>
<literal_col>SolidMask</literal_col>
<col>6 integers</col>
<col>Solid areas of the object. Target rectangle from the <emlink href="definition/index.html#SolidMask">SolidMask.png</emlink> graphics onto the object.</col>
<col>Solid areas of the object. Target rectangle from the source graphics onto the object.</col>
</row>
<row>
<literal_col>TopFace</literal_col>
@ -110,10 +125,20 @@
<col>4 integers</col>
<col>Position of the intake region relative to the object centre.</col>
</row>
<row>
<literal_col>FireTop</literal_col>
<col>Integer</col>
<col>Flame distance to the object's bottom line.</col>
</row>
<row>
<literal_col>Exclusive</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether the object blocks objects behind it. Exclusive objects also block the placement of a construction site at an overlapping location.</col>
<col>0 or 1. Determines whether the object blocks objects behind it.</col>
</row>
<row>
<literal_col>Base</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether the building can be a home base.</col>
</row>
<row>
<literal_col>Line</literal_col>
@ -125,36 +150,81 @@
<col>Integer</col>
<col>0 or 1. If 1, the object is added to the player's crew upon purchase. Objects created using CreateObject have to be added to a player's crew manually using <emlink href="script/fn/MakeCrewMember">MakeCrewMember</emlink>.</col>
</row>
<row>
<literal_col>Growth</literal_col>
<col>Integer</col>
<col>Growth of the object. Trees 1-4, living beings 15.</col>
</row>
<row>
<literal_col>Rebuy</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether the object can be bought back after selling it.</col>
</row>
<row>
<literal_col>Construction</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether the object can be built.</col>
</row>
<row>
<literal_col>ConstructTo</literal_col>
<col>C4ID</col>
<col>Definition change upon building.</col>
</row>
<row>
<literal_col>Grab</literal_col>
<col>Integer</col>
<col>0 no grabbing, 1 grab and push, 2 grab only.</col>
</row>
<row>
<literal_col>GrabPutGet</literal_col>
<col>Integer</col>
<col>Bit mask: bit 0 (value 1) putting possible, bit 1 (value 2) getting possible.</col>
</row>
<row>
<literal_col>Collectible</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether the object can be collected.</col>
</row>
<row>
<literal_col>Rotate</literal_col>
<col>Integer</col>
<col>0 no rotation, 1 full rotation, 2-360 limited rotation.</col>
</row>
<row>
<literal_col>Chop</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether the object can be chopped.</col>
</row>
<row>
<literal_col>Float</literal_col>
<col>Integer</col>
<col>Floatation in liquids: 0 no floatation, otherwise floatation height above the object center.</col>
</row>
<row>
<literal_col>ContainBlast</literal_col>
<col>Integer</col>
<col>0 or 1. Determines whether explosions in the object's contents affect other objects outside.</col>
</row>
<row>
<literal_col>ColorByOwner</literal_col>
<col>Integer</col>
<col>0 or 1. If 1, the specified sections of the object's graphcis are colored by the player color.</col>
</row>
<row>
<literal_col>ColorByMaterial</literal_col>
<col>String (max. 15)</col>
<col>The object is colored by the color of the specified material.</col>
</row>
<row>
<literal_col>HorizontalFix</literal_col>
<col>Integer</col>
<col>0 or 1. If 1, the object can only move vertically.</col>
</row>
<row>
<literal_col>BorderBound</literal_col>
<col>Integer</col>
<col>Bit mask: bit 0 (value 1) stop at the sides, bit 1 (value 2) stop at the top, bit 2 (value 4) stop at the bottom.</col>
</row>
<row>
<literal_col>UprightAttach</literal_col>
<col>Integer</col>
@ -165,6 +235,11 @@
<col>Integer</col>
<col>0 or 1. If 1, the uncomplete object (see <emlink href="script/fn/GetCon.html">GetCon</emlink>) is scaled, not sliced from the bottom like a construction site.</col>
</row>
<row>
<literal_col>Basement</literal_col>
<col>Integer</col>
<col>0 no basement, 1 normal basement, other values reserved.</col>
</row>
<row>
<literal_col>IncompleteActivity</literal_col>
<col>Integer</col>
@ -175,6 +250,11 @@
<col>Integer</col>
<col>0 or 1. The object can be scaled over 100% using DoCon.</col>
</row>
<row>
<literal_col>AttractLightning</literal_col>
<col>Integer</col>
<col>0 or 1. The object attracts lightning.</col>
</row>
<row>
<literal_col>Fragile</literal_col>
<col>Integer</col>
@ -196,7 +276,7 @@
<col>1 - 10. Determines search depth of the pathfinder algorithm (default 1). Warning: higher values may slow down the game. By setting this value you can also enable non-CrewMember objects to use pathfinding when executing commands.</col>
</row>
<row>
<literal_col>NoMassFromContents</literal_col>
<literal_col>NoComponentMass</literal_col>
<col>Integer</col>
<col>0 or 1. If 1, the object's contents is not added to the object's total mass. This can be used to prevent small container objects from turning into killer throwing items.</col>
</row>
@ -223,7 +303,7 @@
<row>
<literal_col>BlitMode</literal_col>
<col>Integer</col>
<col>0 or 1. Value 1 for addtive drawing. Use <funclink>SetObjectBlitMode</funclink> for more flexibility.</col>
<col>0 or 1. Value 1 for addtive drawing.</col>
</row>
<row>
<literal_col>NoBreath</literal_col>
@ -235,6 +315,11 @@
<col>Integer</col>
<col>Values grater than 0 are deducted from the top of necessary construction space.</col>
</row>
<row>
<literal_col>NoSell</literal_col>
<col>Integer</col>
<col>0 or 1. If 1 the object can not be sold.</col>
</row>
<row>
<literal_col>NoGet</literal_col>
<col>Integer</col>
@ -261,12 +346,114 @@
<col>0 or 1. If 1 the object's pathfinding will ignore any transfer zones.</col>
</row>
<row>
<literal_col>HideInCreator</literal_col>
<col>Boolean</col>
<col>false (default) or true. If true, the definition is not shown in the object creator window of the editor. Should be used for internal definitions, libraries, etc.</col>
<literal_col>AutoContextMenu</literal_col>
<col>Integer</col>
<col>0 or 1. If 1, the building's context menu will open automatically upon entry.</col>
</row>
</table>
</text>
<text>
<table>
<caption id="SektionPhysical">Section [Physical]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>Energy</literal_col>
<col>Integer</col>
<col>0-100000. Maximum life energy.</col>
</row>
<row>
<literal_col>Breath</literal_col>
<col>Integer</col>
<col>0-100000. Maximum breath.</col>
</row>
<row>
<literal_col>Walk</literal_col>
<col>Integer</col>
<col>0-100000. Walking speed.</col>
</row>
<row>
<literal_col>Jump</literal_col>
<col>Integer</col>
<col>0-100000. Jump force.</col>
</row>
<row>
<literal_col>Scale</literal_col>
<col>Integer</col>
<col>0-100000. Scaling speed.</col>
</row>
<row>
<literal_col>Hangle</literal_col>
<col>Integer</col>
<col>0-100000. Hangling speed.</col>
</row>
<row>
<literal_col>Dig</literal_col>
<col>Integer</col>
<col>0-100000. Digging speed.</col>
</row>
<row>
<literal_col>Swim</literal_col>
<col>Integer</col>
<col>0-100000. Swimming speed.</col>
</row>
<row>
<literal_col>Throw</literal_col>
<col>Integer</col>
<col>0-100000. Throwing force.</col>
</row>
<row>
<literal_col>Push</literal_col>
<col>Integer</col>
<col>0-100000. Push power.</col>
</row>
<row>
<literal_col>Magic</literal_col>
<col>Integer</col>
<col>0-100000. Maximal magic energy.</col>
</row>
<row>
<literal_col>Float</literal_col>
<col>Integer</col>
<col>0-100. Flight speed.</col>
</row>
<row>
<literal_col>CanScale</literal_col>
<col>Integer</col>
<col>0 or 1. Scale.</col>
</row>
<row>
<literal_col>CanHangle</literal_col>
<col>Integer</col>
<col>0 or 1. Brachiation.</col>
</row>
<row>
<literal_col>CanDig</literal_col>
<col>Integer</col>
<col>0 or 1. Dig.</col>
</row>
<row>
<literal_col>CanConstruct</literal_col>
<col>Integer</col>
<col>0 or 1. Construct. If greater than 1, percentage construction speed. (100 normal, 50 half, etc.)</col>
</row>
<row>
<literal_col>CorrosionResist</literal_col>
<col>Integer</col>
<col>0 or 1. Determines wether the object resists acid.</col>
</row>
<row>
<literal_col>BreatheWater</literal_col>
<col>Integer</col>
<col>0 object breathes air, 1 object breathes water.</col>
</row>
</table>
</text>
<h>Note:</h>
<text>When a crew member is created, it gets an own physical section in it's Objectinfo (oci). In there, the individual changes to the physicals (for example because of training) are saved and restored when an object enters a player's crew. The physical section of the defcore is only used for new crew members and normal objects.</text>
</part>
<author>Newton</author><date>2013-11</date>
<author>Sven2</author><date>2002-04</date>
</doc>

View File

@ -6,7 +6,7 @@
<title>Object Definitions</title>
<h>Object Definitions</h>
<part>
<text>Object definitions are used for all game objects in clonk: the wooden hut, goal objects and the clonk himself. An object definition is a group file composed from the following components:</text>
<text>Object definitions are used for all game objects in clonk: fire monsters, the wooden hut, and the clonk himself. An object definition is a group file composed from the following components:</text>
<h id="Properties">Object properties</h>
<dl>
<dt><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="definition/defcore.html">DefCore.txt</emlink></dt>
@ -27,25 +27,17 @@
</dl>
<h id="RasterGraphics">Raster Graphics</h>
<dl>
<dt id="Graphicspng"><img height="16" src="../../images/icon_image.png" width="16"/>Graphics.png/Graphics.*.png</dt>
<dt id="Graphicspng"><img height="16" src="../../images/icon_image.png" width="16"/>Graphics.png</dt>
<dd>
<text>Graphics of the object. Base graphics, animation phases and a picture for display in menus are stored in a 32 bit picture with transparency channel (PNG format, 32 bit RGBA color, non interlaced). An optional zoom factor for high-resolution graphics can be provided in the '*'-portion of the name.</text>
<text>Graphics of the object. Base graphics, animation phases and a picture for display in menus are stored in a 32 bit picture with transparency channel (PNG format, 32 bit RGBA color, non interlaced).</text>
</dd>
<dt id="Overlaypng"><img height="16" src="../../images/icon_image.png" width="16"/>Overlay.png</dt>
<dd>
<text>The part of the object's graphics which is to be colored in the player color (see ColorByOwner in <emlink href="definition/defcore.html">DefCore.txt</emlink>) can also be defined using a separate graphics file. In Overlay.png gray scales should be used instead of blue color.</text>
</dd>
<dt id="Normalpng"><img height="16" src="../../images/icon_image.png" width="16"/>Normal.png</dt>
<dd>
<text>An optional normal map for the object, where the red, green and blue components in the image correspond to the normal vectors to be used for the lighting of the object. If this file is not present, the normal vector at each pixel points straight into Z direction (outside of the screen).</text>
</dd>
<dt id="Graphicsex"><img height="16" src="../../images/icon_image.png" width="16"/>Graphics*.png/Overlay*.png (Graphics*.*.png/Overlay*.*.png)</dt>
<dt id="Graphicsex"><img height="16" src="../../images/icon_image.png" width="16"/>Graphics*.png/Overlay*.png</dt>
<dd>
<text>Objects can also contain alternative sets of graphics which can be selected ingame using the script command <funclink>SetGraphics</funclink>(). The name corresponds to the file name portion following "Graphics". The matching overlay is automatically selected. For more information see <funclink>SetGraphics</funclink>().</text>
</dd>
<dt id="SolidMask"><img height="16" src="../../images/icon_image.png" width="16"/>SolidMask.png</dt>
<dd>
<text>Image describing areas in this object that are solid, so vertices of other objects will collide with it. Pixels are made solid if they are 50% or less transparent in this image. Source rectangle within this graphic and target position on the object must be set in <emlink href="definition/defcore.html">DefCore.txt</emlink> property "SolidMask" or using the script function <funclink>SetSolidMask</funclink>.</text>
</dd>
</dl>
<h id="MeshGraphics">3D Graphics</h>
@ -72,7 +64,6 @@
<dt id="wav"><img height="16" src="../../images/icon_sound.png" width="16"/>*.wav/*.ogg</dt>
<dd>
<text>Object local sounds. As these are always loaded and not dynamically unloaded as are scenario sounds you should use these sparingly and with small sound files only.</text>
<text>Object local sounds within valid definitions are automatically put into a namespace with the ID of the object. They can be played using <funclink>Sound</funclink>("id::soundname").</text>
</dd>
</dl>
<h id="CrewMembers">Additional files for crew members</h>

View File

@ -11,143 +11,14 @@
<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>
<text>All material scripts (*.material files) are loaded by the engine before the mesh in the same directory is loaded. Material scripts are simple text files which specify the material properties (material colors, textures, etc.) that can be used by meshes. Each material is assigned a name that can normally be specified in the modeling tool. It should be taken care that names are unique (for example by prefixing all material names with the object name of the object they are supposed to be used with) since all loaded materials can directly be used by any mesh so otherwise they could be naming conflicts.</text>
<text>Material scripts can also be crafted or edited by hand. The format is described in the <a href="http://www.ogre3d.org/docs/manual/manual_14.html">OGRE manual</a>. However not all of the features described there are supported (yet): Especially usage of LOD (Level of Detail) is not yet possible. The usage of pixel, vertex and geometry shaders has some restrictions, as discussed in the section below. For the source1 and source2 fields in the colour_op_ex field in texture units the additional value src_player_colour can be specified to refer to the player color of the object's owner. This can be used to colorize objects (partly) by the player color.</text>
<text>Material scripts can also be crafted or edited by hand. The format is described in the <a href="http://www.ogre3d.org/docs/manual/manual_14.html">OGRE manual</a>. However not all of the features described there are supported (yet): Especially pixel, vertex and geometry shaders cannot be used. Also usage of LOD (Level of Detail) is not yet possible. For the source1 and source2 fields in the colour_op_ex field in texture units the additional value src_player_colour can be specified to refer to the player color of the object's owner. This can be used to colorize objects (partly) by the player color.</text>
<text>At runtime the material script can be changed using the C4Script function <funclink>SetMeshMaterial</funclink>.</text>
<h id="Shaders">Shaders</h>
<text>Pixel, vertex and geometry Shaders can be used to customize the appearance of an object beyond what is possible by the declarations in OGRE passes and texture units. The <a href="http://www.ogre3d.org/docs/manual/manual_14.html">OGRE manual</a> should be consulted to learn how shaders can be used, however, there are some restrictions in OpenClonk.</text>
<text>First and foremost, only shaders written in the GLSL are supported at the moment. None of the <a href="http://www.ogre3d.org/docs/manual/manual_23.html#param_005findexed_005fauto">automatic parameters</a> are available for shaders, however, some of these are implicitly available as GLSL variables.</text>
<text>When a custom fragment shader is used, then that shader is responsible for applying the player color and color modulation to the object, since in that case the engine cannot take care of that. The additional parameters mentioned above can be used for that purpose. Also, when a custom fragment shader is used, the colour_op, colour_op_ex, alpha_op and alpha_op_ex directives in all texture units are ignored.</text>
<text>When a fragment shader or a vertex shader (or both) are not specified, then standard shaders are generated. The standard shaders expect certain GLSL varying variables to be propagated from the vertex shader to the fragment shader, so if you implement a vertex shader but not a fragment shader, make sure to create the following varying variables:</text>
<text>
<table>
<caption id="OCStandardVaryings">Varying variables used by the standard shader</caption>
<rowh>
<col>Variable name</col>
<col>Type</col>
<col>Description</col>
</rowh>
<row>
<literal_col>normalDir</literal_col>
<literal_col>vec3</literal_col>
<col>The interpolated normal vector for lighting calculations.</col>
</row>
<row>
<literal_col>texcoord</literal_col>
<literal_col>vec2</literal_col>
<col>The interpolated texture coordinate, based on the texture coordinates specified in the mesh.</col>
</row>
</table>
</text>
<text>The standard fragment shader uses these values and possibly processes them with what is specified in the texture unit declarations. The standard vertex shader creates these values from the GL state, and is independent of the texture units or other declarations. If no custom vertex shader is provided, the following shader is used:</text>
<code>varying vec3 normalDir;
varying vec2 texcoord;
void main()
{
normalDir = normalize(gl_NormalMatrix * gl_Normal);
texcoord = gl_MultiTexCoord0.xy;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}</code>
<text>Shaders for OpenClonk are composed of various shader slices. This allows to add openclonk-specific code to
the shaders, such as applying color modulation for objects, or lighting.
A slice is specified by <code>slice(position) { ... }</code> in the shader code, and the code within the slice
is then used for composing the whole shader code. Uniform variables should be declared outside of any slices. The
following position values for slices are defined, and slices are inserted from lower to higher values:</text>
<text>
<table>
<caption id="OCMeshShaderSlices">Defined shader slice positions</caption>
<rowh>
<col>Slice position</col>
<col>Value</col>
<col>Description</col>
</rowh>
<row>
<literal_col>texcoord</literal_col>
<literal_col>50</literal_col>
<col>Vertex shader: Should be used to set the <code>texcoord</code> varying variable.</col>
</row>
<row>
<literal_col>normal</literal_col>
<literal_col>60</literal_col>
<col>Vertex shader: Should be used to set the <code>normalDir</code> varying variable.</col>
</row>
<row>
<literal_col>position</literal_col>
<literal_col>80</literal_col>
<col>Vertex shader: Should be used to set the <code>gl_Position</code> variable.</col>
</row>
<row>
<literal_col>init</literal_col>
<literal_col>0</literal_col>
<col>Fragment shader: Should be used for initializing required variables. The standard slices set the initial color value from
the mesh material properties here.</col>
</row>
<row>
<literal_col>coordinate</literal_col>
<literal_col>20</literal_col>
<col>Fragment shader: Should be used for calculating custom texture coordinates.</col>
</row>
<row>
<literal_col>texture</literal_col>
<literal_col>40</literal_col>
<col>Fragment shader: Should be used for texture lookups.</col>
</row>
<row>
<literal_col>material</literal_col>
<literal_col>60</literal_col>
<col>Fragment shader: Used by the landscape shader to query the material pixel.</col>
</row>
<row>
<literal_col>normal</literal_col>
<literal_col>80</literal_col>
<col>Fragment shader: Should be used to compute the normal vector.</col>
</row>
<row>
<literal_col>light</literal_col>
<literal_col>100</literal_col>
<col>Fragment shader: Should be used for lighting calculations.</col>
</row>
<row>
<literal_col>color</literal_col>
<literal_col>120</literal_col>
<col>Fragment shader: Should be used for setting the output color value.</col>
</row>
<row>
<literal_col>finish</literal_col>
<literal_col>140</literal_col>
<col>Fragment shader: Final slice position, can be used for debug code overwriting any previous output, for example.</col>
</row>
</table>
</text>
<text>A slice position can also have a relative constant offset with a plus or minus sign, such as <code>texture+1</code>. The fragment shader slices should modify the implicitly defined value <code>color</code> of type <code>vec4</code>.</text>
<text>In order to make sure that other OGRE mesh viewers can still display the mesh, it is suggested to wrap the slice
definitions into corresponding <code>#ifdef</code> blocks. This also allows to, for example, set default light
conditions when the mesh is shown in a standalone OGRE mesh viewer. An example is given here:</text>
<code>#ifndef OPENCLONK
#define slice(x)
#define color gl_FragColor
varying vec2 texcoord;
void main()
{
color = vec4(1.0, 1.0, 1.0, 1.0); // or gl_FrontMaterial.ambient;
#endif
// Shader slices go here.
slice(XXX) { ... }
#ifndef OPENCLONK
// Custom lighting code for standalone mesh viewers can go here
}
#endif</code>
<text>If the uniform variable <code>oc_PlayerColor</code> is defined with type <code>vec3</code>, it is automatically
set by OpenClonk to the player color of ColorByOwner objects.</text>
<h id="Animations">Animations</h>
<text>As for bitmap based graphics an object can play an animation while executing an action. To do so first a rig for the model and then an animation needs to be created. When exporting it is saved in the *.skeleton (or *.skeleton.xml for the OGRE XML format) file. To play it during an action the Animation field of the action needs to be set in the <emlink href="definition/actmap.html">ActMap</emlink>. The Facet fields are ignored for mesh graphics.</text>
<text>It is also possible, via script, to play multiple animations at the same time or to specify transitions between animations. To learn more about this possibility see <emlink href="definition/animations.html">Animations</emlink>.</text>
<text>Just as scripts, animations can be appended or included to certain definitions. For this purpose the *.skeleton file has to match a certain pattern: appendto.<i>Definition</i>.skeleton adds the animations in that skeleton to the skeleton that was loaded by <i>Definition</i>. Existing animations will not be overloaded. Similarly, include.<i>Definition</i>.skeleton includes animations. Make sure to name your skeleton accordingly when rigging the mesh, if you want to include animations. Obviously, animations from only one definition can be included, but skeletons from multiple animations can be appended.</text>
<h id="Attachment">Attachment of meshes</h>
<h id="Attachment">Attachment of meshs</h>
<text>Meshes can be attached to each other so that they always move together. This allows the clonk to carry objects or to aim with the bow. To attach two meshes the C4Script function <funclink>AttachMesh</funclink> can be used, or <funclink>DetachMesh</funclink> to detach them again. When attaching a bone of both meshes needs to be specified. The attached mesh is then aligned so that its bone has always the same position and orientation as the one to which it is attached.</text>
<text>However it needs to be taken care of the fact that only the meshes, that is the graphics of the objects, are attached. The real position of the attached object (so what is returned by the functions <funclink>GetX</funclink> and <funclink>GetY</funclink> or the area in which the object is found by the functions <funclink>Find_AtPoint</funclink>, <funclink>Find_InRect</funclink> or <funclink>Find_AtRect</funclink>) is <em>not</em> affected.</text>
<text>However it needs to be taken care of the fact that only the meshes, that is the graphics of the objects, are attached. The real position of the attached object (so what is returned by the functions <funclink>GetX</funclink> and <funclink>GetY</funclink> or the area in which the object is found by the functions <funclink>Find_AtPoint</funclink>, <funclink>Find_InRect</funclink> oder <funclink>Find_AtRect</funclink>) is <em>not</em> affected.</text>
<h id="Picture">Picture graphics.</h>
<text>If an object uses a mesh then the Picture entry of the <emlink href="definition/defcore.html">DefCore.txt</emlink> remains without effect. Instead a perspective projection of the mesh will be used. The camera will be placed in the front of the object at a distance so that the mesh is totally covered.</text>
<text>The position and orientation of the mesh with respect to the camera can be changed by making use of the "PictureTransformation" property. This way it can be shown displaced, rotated or scaled. The property should be assigned an array with 12 integer entries which make up a 3x4 matrix. The first four values specify the first row, the next four values specify the second row and the last four entries specify the third one. Those matrices can be conveniently created using the script functions <funclink>Trans_Identity</funclink>, <funclink>Trans_Translate</funclink>, <funclink>Trans_Rotate</funclink>, <funclink>Trans_Scale</funclink> and <funclink>Trans_Mul</funclink>.</text>
@ -164,5 +35,4 @@ slice(XXX) { ... }
</ul>
</part>
<author>Clonk-Karl</author><date>2010-04</date>
<author>Marky</author><date>2015-01</date>
</doc>

View File

@ -14,6 +14,6 @@
<text>This script turns all rotatable objects upside down.</text>
<h id="ocf_fns">OCF Constants</h>
<text>The following OCFs are defined in C4Script:</text>
<text><funclink>OCF_Alive</funclink>, <funclink>OCF_Available</funclink>, <funclink>OCF_Chop</funclink>, <funclink>OCF_Collectible</funclink>, <funclink>OCF_Collection</funclink>, <funclink>OCF_Construct</funclink>, <funclink>OCF_Container</funclink>, <funclink>OCF_CrewMember</funclink>, <funclink>OCF_Entrance</funclink>, <funclink>OCF_Exclusive</funclink>, <funclink>OCF_Fullcon</funclink>, <funclink>OCF_Grab</funclink>, <funclink>OCF_HitSpeed1</funclink>, <funclink>OCF_HitSpeed2</funclink>, <funclink>OCF_HitSpeed3</funclink>, <funclink>OCF_HitSpeed4</funclink>, <funclink>OCF_Inflammable</funclink>, <funclink>OCF_InFree</funclink>, <funclink>OCF_InLiquid</funclink>, <funclink>OCF_InSolid</funclink>, <funclink>OCF_Living</funclink>, <funclink>OCF_NotContained</funclink>, <funclink>OCF_OnFire</funclink>, <funclink>OCF_Rotate</funclink></text>
<text><funclink>OCF_Alive</funclink>, <funclink>OCF_AttractLightning</funclink>, <funclink>OCF_Available</funclink>, <funclink>OCF_Chop</funclink>, <funclink>OCF_Collectible</funclink>, <funclink>OCF_Collection</funclink>, <funclink>OCF_Construct</funclink>, <funclink>OCF_Container</funclink>, <funclink>OCF_CrewMember</funclink>, <funclink>OCF_Entrance</funclink>, <funclink>OCF_Exclusive</funclink>, <funclink>OCF_Fullcon</funclink>, <funclink>OCF_Grab</funclink>, <funclink>OCF_HitSpeed1</funclink>, <funclink>OCF_HitSpeed2</funclink>, <funclink>OCF_HitSpeed3</funclink>, <funclink>OCF_HitSpeed4</funclink>, <funclink>OCF_Inflammable</funclink>, <funclink>OCF_InFree</funclink>, <funclink>OCF_InLiquid</funclink>, <funclink>OCF_InSolid</funclink>, <funclink>OCF_Living</funclink>, <funclink>OCF_NotContained</funclink>, <funclink>OCF_OnFire</funclink>, <funclink>OCF_Rotate</funclink></text>
<author>Sven2</author><date>2002-05</date>
</doc>

View File

@ -21,91 +21,91 @@
<col>Action.Attach</col>
</row>
<row id="WALK">
<col>DFA_WALK</col>
<col>WALK</col>
<col>Walking</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_Bottom</col>
</row>
<row id="FLIGHT">
<col>DFA_FLIGHT</col>
<col>FLIGHT</col>
<col>Free fall</col>
<col>Only gravitational effects</col>
<col>CNAT_None</col>
</row>
<row id="KNEEL">
<col>DFA_KNEEL</col>
<col>KNEEL</col>
<col>Getting up</col>
<col>Behaviour according to <emlink href="definition/actmap.html">activity</emlink>.</col>
<col>CNAT_Bottom</col>
</row>
<row id="SCALE">
<col>DFA_SCALE</col>
<col>SCALE</col>
<col>Scaling a wall</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_Left/Right</col>
</row>
<row id="HANGLE">
<col>DFA_HANGLE</col>
<col>HANGLE</col>
<col>Climbing on the ceiling</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_Top</col>
</row>
<row id="DIG">
<col>DFA_DIG</col>
<col>DIG</col>
<col>Dig</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>. With <emlink href="script/fn/SetActionData.html">Data</emlink>=1 material chunks are dug free.</col>
<col>CNAT_None</col>
</row>
<row id="SWIM">
<col>DFA_SWIM</col>
<col>SWIM</col>
<col>Swimming</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_None</col>
</row>
<row id="THROW">
<col>DFA_THROW</col>
<col>THROW</col>
<col>Throw</col>
<col>Behaviour according to <emlink href="definition/actmap.html">activity</emlink>.</col>
<col>CNAT_Bottom</col>
</row>
<row id="BRIDGE">
<col>DFA_BRIDGE</col>
<col>BRIDGE</col>
<col>Bridge building</col>
<col>According to <emlink href="script/fn/SetComDir.html">ComDir</emlink>. Bridge material is a material number in <emlink href="script/fn/SetActionData.html">Data</emlink>.</col>
<col>CNAT_Bottom</col>
</row>
<row id="PUSH">
<col>DFA_PUSH</col>
<col>PUSH</col>
<col>Pushing</col>
<col>Pushes the <emlink href="script/fn/SetAction.html">target object </emlink> according to <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_Bottom</col>
</row>
<row id="LIFT">
<col>DFA_LIFT</col>
<col>LIFT</col>
<col>Lifting</col>
<col>Lifts the <emlink href="script/fn/SetAction.html">target object</emlink> according to <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_None</col>
</row>
<row id="FLOAT">
<col>DFA_FLOAT</col>
<col>FLOAT</col>
<col>Floating in mid-air</col>
<col>According to current <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_None</col>
</row>
<row id="ATTACH">
<col>DFA_ATTACH</col>
<col>ATTACH</col>
<col>Attachment to another object</col>
<col>Adjusts object position at vertex a to the position of vertex b of the <emlink href="script/fn/SetAction.html">target object</emlink>. a and b are the two low bytes of <emlink href="script/fn/SetActionData.html">ActionData</emlink> (see <emlink href="script/fn/SetActionData.html">SetActionData</emlink> for an example).</col>
<col>CNAT_None</col>
</row>
<row id="CONNECT">
<col>DFA_CONNECT</col>
<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">
<col>DFA_PULL</col>
<col>PULL</col>
<col>Pulling</col>
<col>Pulls the <emlink href="script/fn/SetAction.html">target object</emlink> according to <emlink href="script/fn/SetComDir.html">ComDir</emlink>.</col>
<col>CNAT_Bottom</col>

View File

@ -28,27 +28,27 @@ Stand = {
<row>
<col><code>Prototype</code></col>
<col>proplist</col>
<col>Deprecated. Use <funclink>SetPrototype</funclink> and <funclink>GetPrototype</funclink>.</col>
<col></col>
</row>
<row>
<col><code>Name</code></col>
<col>string</col>
<col>Name of the object. This string should be <emlink href="lang.html">internationalized</emlink>.</col>
<col></col>
</row>
<row>
<col><code>Collectible</code></col>
<col>bool</col>
<col>Whether the object can be picked up.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>Touchable</code></col>
<col>int</col>
<col>1 the object can be grabbed and pushed, 2 the object can only be grabbed.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>ActMap</code></col>
<col>proplist</col>
<col>See the <emlink href="definition/actmap.html">detailed description of the ActMap</emlink>.</col>
<col></col>
</row>
<row>
<col><code>Visibility</code></col>
@ -57,73 +57,68 @@ Stand = {
</row>
<row>
<col><code>LineColors</code></col>
<col>array</col>
<col>An array of two integers. The first denotes the color of the line and the second the color of the endpoints if the object is drawn as a line.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>LineAttach</code></col>
<col>array</col>
<col>An array of two integers. Denotes the position of where the endpoint of the line is located relative to the object center.</col>
</row>
<col></col>
<col></col>
</row>
<row>
<col><code>PictureTransformation</code></col>
<col>array</col>
<col>If the object is a mesh, the picture graphic of the object can be transformed with this property. See <funclink>Trans_Mul</funclink> for an example.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>MeshTransformation</code></col>
<col>array</col>
<col>If the object is a mesh, the ingame graphic of the object can be transformed with this property. See <funclink>Trans_Mul</funclink> for an example.</col>
</row>
<row>
<col><code>MouseDrag</code></col>
<col>bool</col>
<col>Whether the object can be dragged with the mouse. What exactly happens when an object is dragged onto another is defined in script.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>MouseDragImage</code></col>
<col>id / object</col>
<col>The object or object id of which the picture should be displayed below the cursor while dragging.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>Tooltip</code></col>
<col>string</col>
<col>A tooltip that is displayed for objects of the category <emlink href="definition/category.html">C4D_MouseSelect</emlink>. This string should be <emlink href="lang.html">internationalized</emlink>.</col>
<col><code>MouseDrag</code></col>
<col></col>
<col></col>
</row>
<row>
<col><code>Animation</code></col>
<col></col>
<col></col>
</row>
<row>
<col><code>Action</code></col>
<col>proplist</col>
<col>The current action of the object as a proplist.</col>
<col></col>
</row>
<row>
<col><code>BreatheWater</code></col>
<col>bool</col>
<col>Whether the object breathes in water rather than air.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>CorrosionResist</code></col>
<col>bool</col>
<col>Whether the alive object does not loose energy when in corrosive material.</col>
<col></col>
<col></col>
</row>
<row>
<col><code>MaxEnergy</code></col>
<col>int</col>
<col>Maximum life energy in a precision of 100.</col>
<col></col>
</row>
<row>
<col><code>MaxBreath</code></col>
<col>int</col>
<col>Maximum breath.</col>
<col></col>
</row>
<row>
<col><code>ThrowSpeed</code></col>
<col>int</col>
<col>Throwing speed in a precision of 100.</col>
</row>
<row>
<col><code>JumpSpeed</code></col>
<col>int</col>
<col>Jump speed in a precision of 100.</col>
<col></col>
</row>
<row id="Parallaxity">
<col><code>Parallaxity</code></col>
@ -133,27 +128,17 @@ Stand = {
<row id="Plane">
<col><code>Plane</code></col>
<col>int</col>
<col>The Object's minor Z-Position. Negative values are behind the landscape, positive values before it. Use 1-399 for stuff behind Clonks, 401-999 for stuff before Clonks, and 1000+ for GUI objects. Global particles are on 900.</col>
</row>
<row id="SolidMaskPlane">
<col><code>SolidMaskPlane</code></col>
<col>int</col>
<col>If the object moves and other objects are attached to its SolidMask, only objects in front of this plane are moved along with it. Defaults to Plane if zero.</col>
<col>The Object's minor Z-Position. Negative values are behind the landscape, positive values before it. Use 1-399 for stuff behind Clonks, 401-999 for stuff before Clonks, and 1000+ for GUI objects.</col>
</row>
<row>
<literal_col>Placement</literal_col>
<col>Integer</col>
<col>Placement: 0 land surface, 1 in liquid, 2 in mid-air, 3 underground, 4 land surface and underground.</col>
</row>
<row>
<literal_col>ContainBlast</literal_col>
<col>bool</col>
<col>True or false. Determines whether explosions in the object's contents affect other objects outside.</col>
</row>
<row>
<literal_col>BlastIncinerate</literal_col>
<col>Integer</col>
<col>Incineration by explosion: 0 none, otherwise the damage level that has to be reached until the object is incinerated. </col>
<col>Incineration by explosion: 0 none, otherwise the damage level of incineration.</col>
</row>
<row>
<literal_col>BurnTo</literal_col>
@ -168,37 +153,7 @@ Stand = {
<row>
<literal_col>ContactIncinerate</literal_col>
<col>Integer</col>
<col>Probability of incineration by contact: 0 none, or 1 (high) to 5 (low). Implies MaterialIncinerate.</col>
</row>
<row>
<literal_col>MaterialIncinerate</literal_col>
<col>bool</col>
<col>Incineration when submerged in incendiary material.</col>
</row>
<row>
<literal_col>FireproofContainer</literal_col>
<col>bool</col>
<col>Anything contained in this object does not catch fire when submerged in incendiary material.</col>
</row>
<row>
<literal_col>EditCursorCommands</literal_col>
<col>Array</col>
<col>Array of functions made available in the context menu when right-clicking an object in the editor. Functions may be either strings (like "Explode(20)") or function pointers (like this.Hit). Function pointers are always called by name.</col>
</row>
<row>
<literal_col>BorderBound</literal_col>
<col>Integer</col>
<col>Bit mask indicating object boundaries: stop at map sides (C4D_Border_Sides), stop at map top (C4D_Border_Top), stop at map bottom (C4D_Border_Sides), stop at object layer boundaries (C4D_Border_Layer). For example BorderBound = C4D_Border_Top | C4D_Border_Bottom.</col>
</row>
<row>
<literal_col>ContactCalls</literal_col>
<col>bool</col>
<col>True or false. If true, <emlink href="definition/cnat.html">ContactCalls</emlink> are called in the object script.</col>
</row>
<row>
<literal_col>Components</literal_col>
<col>array</col>
<col>List of definitions and counts specifying the components of an object. Example: Components = {Rock = 1, Wood = 3};</col>
<col>Probability of incineration by contact: 0 none, or 1 (high) to 5 (low).</col>
</row>
</table>
</text>

View File

@ -33,11 +33,6 @@
<col>Parameter</col>
<col>Description</col>
</rowh>
<row id="Initialize">
<literal_col>Definition</literal_col>
<col></col>
<col>Called in definition context after all definitions have been loaded and before definition properties are frozen. Use this callback to initialize complex definition properties such as EditorProps or dependencies between definitions. Definition() callbacks are performed in descending order of the DefinitionPriority property or 0 if that property is not defined.</col>
</row>
<row id="Initialize">
<literal_col>Initialize</literal_col>
<col></col>
@ -53,11 +48,6 @@
<col></col>
<col>When the object is removed.</col>
</row>
<row id="EditorInitialize">
<literal_col>EditorInitialize</literal_col>
<col></col>
<col>Called after Construction and Initialize when the object is placed in the editor.</col>
</row>
<row id="Hit">
<literal_col>Hit</literal_col>
<col></col>
@ -92,16 +82,6 @@
<literal_col>Put</literal_col>
<col></col>
<col>When the object puts another object into a container.</col>
</row>
<row id="DigOutObject">
<literal_col>DigOutObject</literal_col>
<col>object obj</col>
<col>When the object dug out another object that was stuck in solid material or when a new object is created from material during digging.</col>
</row>
<row id="DugOut">
<literal_col>DugOut</literal_col>
<col>object object_by</col>
<col>When the object was spawned from dug out material. The object might get removed afterwards if the material has Dig2ObjectCollect=2.</col>
</row>
<row id="Damage">
<literal_col>Damage</literal_col>
@ -163,8 +143,8 @@
<col>object obj, int x, int y</col>
<col>When an object (obj) using the internal pathfinding algorithm is trying to pass the transfer zone of this object on its way to point x/y. The transfer function can then help the object along by giving special script commands and returning <code>true</code>. Also see <emlink href="script/fn/SetTransferZone.html">SetTransferZone</emlink>().</col>
</row>
<row id="OnSynchronized">
<literal_col>OnSynchronized</literal_col>
<row id="UpdateTransferZone">
<literal_col>UpdateTransferZone</literal_col>
<col></col>
<col>When an object is loaded from a savegame or network synchronization is performed. Objects with a transfer zone should reset the zone in this call. Also see <emlink href="script/fn/SetTransferZone.html">SetTransferZone</emlink>().</col>
</row>
@ -198,15 +178,15 @@
<col>object by</col>
<col>Called before the object is hit or punched by another object. By returning <code>true</code>, QueryCatchBlow can reject physical blows.</col>
</row>
<row id="OnLineBreak">
<literal_col>OnLineBreak</literal_col>
<row id="LineBreak">
<literal_col>LineBreak</literal_col>
<col>int cause</col>
<col>When a line object is broken. cause: 0 by movement, 1 because of a missing or incomplete target object.</col>
</row>
<row id="OnLineChange">
<literal_col>OnLineChange</literal_col>
<col>int cause</col>
<col>When a line object is changed, that is when one of it vertices changed its position.</col>
<row id="BuildNeedsMaterial">
<literal_col>BuildNeedsMaterial</literal_col>
<col>id material_definition, int amount</col>
<col>When the object is building another object and building material is required. The parameters are the type and amount of the first needed material. If this function returns <code>true</code>, no material message is displayed above the object.</col>
</row>
<row id="AttachTargetLost">
<literal_col>AttachTargetLost</literal_col>
@ -343,229 +323,22 @@
<col>int player, int new_team, int old_team</col>
<col>Callback in game goal, rule, and environment objects and in the scenario script. Called when a player has successfully switch from old_team to new_team (see <funclink>SetPlayerTeam</funclink>).</col>
</row>
<row id="OnCompletionChange">
<literal_col>OnCompletionChange</literal_col>
<col>int old_con, int new_con</col>
<col>Callback in when the completion of the object has changed (see <funclink>GetCon</funclink>, <funclink>DoCon</funclink> and <funclink>SetCon</funclink>).</col>
<row id="EditCursorSelection">
<literal_col>EditCursorSelection</literal_col>
<col></col>
<col>When object is selected in editor. Use this callback to display extra information for scenario designers.</col>
</row>
<row id="EditCursorMoved">
<literal_col>EditCursorMoved</literal_col>
<col>int old_x, int old_y</col>
<col>When object is moved in editor. Callback is also done when moved in non-network pause mode. old_x, old_y contains object position before movement.</col>
</row>
<row id="SaveScenarioObject">
<literal_col>SaveScenarioObject</literal_col>
<col>proplist props</col>
<col>Called when scenario is saved from the editor. Object should write creation of itself and properties to the buffer props. Return true if the object should be saved and false if saving of this object should be omitted. See <emlink href="definition/script.html#ScenSave">Scenario saving</emlink>.</col>
<row id="EditCursorDeselection">
<literal_col>EditCursorDeselection</literal_col>
<col></col>
<col>When object is deselected in editor. Use this callback to hide any information previously shown in EditCursorSelection.</col>
</row>
</table>
</text>
<h id="ScenSave">Scenario saving</h> <part>
<text>When the user chooses the "Save Scenario" option from the editor menu, the engine calls a global function SaveScenarioObjects defined in System.ocg/SaveScenario.c. This function writes all objects to the Objects.c file in their current state. The function stores all objects except the crew of currently joined human players and objects of a type that starts with GUI_. By default, objects are recreated using a call to <funclink>CreateObject</funclink> followed by setting a number of default properties like position, rotation, speed, action, if they are not in their default state.</text>
<text>For most object, the default saving method should be fine. However, it is possible to override the SaveScenarioObject callback to control how objects are created and which properties are set.</text>
<text>For example if a switch wants to save its target which is stored in a local variable called "target", the switch definition can override the callback:</text>
<code>local target;
func SetTarget(object new_target) { target = new_target; return true; }
func SaveScenarioObject(props)
{
if (!inherited(props, ...)) return false;
if (target) props->AddCall("Target", this, "SetTarget", target);
return true;
}</code>
<text>As a result, the generated Objects.c file will include the call to SetTarget if the switch is saved. Dependent objects should always either be passed to the AddCall function or stored as a string from the <funclink>MakeScenarioSaveName</funclink> function. If this is done, that object is marked as a dependency. The saving mechanism will ensure that any object this object depends on will be created before. In case of circular dependencies, the object property setting script is detached from object creation script.</text>
<text>If an object should not be saved in scenarios - for example, because it is just the helper of another object - the SaveScenarioObject callback should be overloaded to return false.</text>
<text>The object creation procedure can also be adjusted. For example, the waterfall object (defined in Objects.ocd/Environment.ocd/Waterfall.ocd) is created using the global functions CreateWaterfall and CreateLiquidDrain, which create a Waterfall object and attach an effect to it. To generate the creation functions from the effects, the waterfall overrides SaveScenarioObject:</text>
<code>func SaveScenarioObject(props)
{
if (!inherited(props, ...)) return false;
var fx_waterfall = GetEffect("IntWaterfall", this);
if (fx_waterfall)
{
props->RemoveCreation();
props->Add(SAVEOBJ_Creation, "CreateWaterfall(%d,%d,%d,%v)",fx_waterfall.X, fx_waterfall.Y, fx_waterfall.Strength, fx_waterfall.Material);
}
return true;
}</code>
<text>The call to RemoveCreation removes the existing object creation using <funclink>CreateObject</funclink>.</text>
<text>If you need access to one of the objects created in the editor, you can set its "StaticSaveVar" property to the name of a static variable. The InitializeObjects() function will then save the object in that variable.</text>
<text>The following table lists standard properties that are saved if their value is different from the default and if it is not removed using a props->Remove call.
<table>
<rowh>
<col>Property name</col>
<col>Default value</col>
<col>Description</col>
</rowh>
<row id="defprops_Alive">
<literal_col>Alive</literal_col>
<col>true</col>
<col>Category C4D_Living only: If object is not alive, a call to SetKill is stored. See <funclink>GetAlive</funclink> and <funclink>Kill</funclink>.</col>
</row>
<row id="defprops_Action">
<literal_col>Action</literal_col>
<col>this.DefaultAction</col>
<col>Action as retrieved using <funclink>GetAction</funclink> and set using <funclink>SetAction</funclink>. Includes ActionTargets. Not stored by default but only if <funclink>SaveScenarioObjectAction</funclink> is called.</col>
</row>
<row id="defprops_Phase">
<literal_col>Phase</literal_col>
<col>0</col>
<col>Action phase (see <funclink>GetPhase</funclink> and <funclink>SetPhase</funclink>). Not stored by default but only if <funclink>SaveScenarioObjectAction</funclink> is called.</col>
</row>
<row id="defprops_Dir">
<literal_col>Dir</literal_col>
<col>DIR_Left</col>
<col>Animation direction (see <funclink>GetDir</funclink> and <funclink>SetDir</funclink>)</col>
</row>
<row id="defprops_ComDir">
<literal_col>ComDir</literal_col>
<col>COMD_Stop</col>
<col>Commanded movement direction (see <funclink>GetComDir</funclink> and <funclink>SetComDir</funclink>)</col>
</row>
<row id="defprops_Con">
<literal_col>Con</literal_col>
<col>100</col>
<col>Construction percentage, i.e. object size (see <funclink>GetCon</funclink> and <funclink>SetCon</funclink>)</col>
</row>
<row id="defprops_Category">
<literal_col>Category</literal_col>
<col>GetID()->GetCategory()</col>
<col>Object category (see <funclink>GetCategory</funclink> and <funclink>SetCategory</funclink>)</col>
</row>
<row id="defprops_R">
<literal_col>R</literal_col>
<col>0</col>
<col>Rotation (see <funclink>GetR</funclink> and <funclink>SetR</funclink>)</col>
</row>
<row id="defprops_XDir">
<literal_col>XDir</literal_col>
<col>0</col>
<col>Horizontal speed (see <funclink>GetXDir</funclink> and <funclink>SetXDir</funclink>)</col>
</row>
<row id="defprops_YDir">
<literal_col>YDir</literal_col>
<col>0</col>
<col>Vertical speed (see <funclink>GetYDir</funclink> and <funclink>SetYDir</funclink>). Vertical speed is not saved it is very small and the object touches the ground to avoid saving of speed on idle objects.</col>
</row>
<row id="defprops_RDir">
<literal_col>RDir</literal_col>
<col>0</col>
<col>Rotation speed (see <funclink>GetRDir</funclink> and <funclink>SetRDir</funclink>)</col>
</row>
<row id="defprops_Color">
<literal_col>Color</literal_col>
<col>0, 0xffffffff</col>
<col>Object color of ColorByOwner-surfaces (see <funclink>GetColo</funclink> and <funclink>SetColor</funclink>)</col>
</row>
<row id="defprops_ClrModulation">
<literal_col>ClrModulation</literal_col>
<col>0, 0xffffffff</col>
<col>Object color modulation of all surfaces (see <funclink>GetClrModulation</funclink> and <funclink>SetClrModulation</funclink>)</col>
</row>
<row id="defprops_BlitMode">
<literal_col>BlitMode</literal_col>
<col>0</col>
<col>Object drawing mode (see <funclink>GetObjectBlitMode</funclink> and <funclink>SetObjectBlitMode</funclink>)</col>
</row>
<row id="defprops_MeshMaterial">
<literal_col>MeshMaterial</literal_col>
<col>GetID()->GetMeshMaterial()</col>
<col>Custom assignments of mesh materials (see <funclink>GetMeshMaterial</funclink> and <funclink>SetMeshMaterial</funclink>)</col>
</row>
<row id="defprops_Name">
<literal_col>Name</literal_col>
<col>GetID()->GetName()</col>
<col>Object name (see <funclink>GetName</funclink> and <funclink>SetName</funclink>)</col>
</row>
<row id="defprops_MaxEnergy">
<literal_col>MaxEnergy</literal_col>
<col>GetID().MaxEnergy</col>
<col>Maximum energy (see <emlink href="definition/properties.html">Properties</emlink>)</col>
</row>
<row id="defprops_Energy">
<literal_col>Energy</literal_col>
<col>GetID().MaxEnergy/1000</col>
<col>Current energy level (see <funclink>GetEnergy</funclink> and <funclink>DoEnergy</funclink>)</col>
</row>
<row id="defprops_Visibility">
<literal_col>Visibility</literal_col>
<col>VIS_All</col>
<col>Object visibility (see <emlink href="definition/properties.html">Properties</emlink>)</col>
</row>
<row id="defprops_Plane">
<literal_col>Plane</literal_col>
<col>GetID().Plane</col>
<col>Object plane, i.e. z-order (see <emlink href="definition/properties.html">Properties</emlink>)</col>
</row>
<row id="defprops_Position">
<literal_col>Position</literal_col>
<col></col>
<col>Object position. This is only set if the object has a rotation and could not be created directly at the correct offset (see <funclink>SetPosition</funclink>)</col>
</row>
<row id="defprops_Commands">
<literal_col>Command</literal_col>
<col>None</col>
<col>Stores only the topmost command of the chain (see <funclink>GetCommand</funclink> and <funclink>SetCommand</funclink>)</col>
</row>
<row id="defprops_Fire">
<literal_col>Fire</literal_col>
<col></col>
<col>Fire effect.</col>
</row>
</table>
</text>
<text>Properties published to the editor as EditorProps can also be saved automatically by setting the Save property of the EditorProp to a string that serves as an identifier so saved properties can be removed by derived definitions. These properties are atuomatically saved if they are different from their default value. E.g.:</text>
<code>/* Define two properties that can be set in the editor */
// foo is a property with a setter function
local foo = 42;
public func SetFoo(new_foo) { foo = new_foo; return true; }
// bar is just a property without setter
local bar = 23;
local EditorProps = {
foo = { Type="int", Set="SetFoo", Save="Foo" }; // saved as object->SetFoo(value); unless foo is 42.
bar = { Type="int", Save="Bar"; } // saved as object.bar = value; unless bar is 23.
};</code>
<text>By default, effects are not saved in scenarios. To force saving of an effect, define the Fx*SaveScen callback. For example, the fire effect saves itself like this:</text>
<code>global func FxFireSaveScen(object obj, proplist fx, proplist props)
{
// this is burning. Save incineration to scenario.
props->AddCall("Fire", obj, "Incinerate", fx.strength, fx.caused_by, fx.blasted, fx.incinerating_object);
return true;
}</code>
<text>obj and fx refer to the object and effect proplist as for any effect call. save_name is the variable name of the effected object and is unset for global effects.</text>
<h id="ScenSave">Scenario saving reference</h>
<text>The following functions are available to call on the "props" parameter passed to SaveScenarioObject callbacks:</text>
<h>AddCall</h>
<text><code>bool AddCall(string id, object target, string function, any par1, any par2, ...);</code></text>
<text>Adds a new call of format target->Function(par1, par2, ...) to the stored object script. Object parameters may be passed as is; strings must be quoted explicitely.</text>
<text>The id parameter is an identifier which can be used by derived objects to remove the property again.</text>
<h>Add</h>
<text><code>bool AddCall(string id, string script, any par1, any par2, ...);</code></text>
<text>Adds a custom script snippet of any format. script may contain format characters and parameters are formatted into the string using <funclink>Format</funclink>().</text>
<h>Remove</h>
<text><code>int Remove(string id);</code></text>
<text>Remove all strings added previously using AddCall or Add with the given ID. Can also be used to remove default properties. Returns number of script lines removed.</text>
<h>RemoveCreation</h>
<text><code>bool RemoveCreation();</code></text>
<text>Remove all strings added previously using with IDs SAVEOBJ_Creation or SAVEOBJ_ContentsCreation.</text>
<h>Clear</h>
<text><code>bool Clear();</code></text>
<text>Remove all creation and property setting strings.</text>
</part>
</part>
<author>sulai</author><date>2003-11</date>
<author>Sven2</author><date>2004-02</date>
<author>matthes</author><date>2004-07</date>
<author>Clonkonaut</author><date>2008-04</date>
<author>Sven2</author><date>2013-12</date>
</doc>

View File

@ -54,10 +54,6 @@ this.Visibility = [<funclink>VIS_Enemies</funclink>]; // This is also possible (
<col><code>VIS_OverlayOnly</code></col>
<col>Only overlays will be visible, other visibility-rules still apply.</col>
</row>
<row id="VIS_Editor">
<col><code>VIS_Editor</code></col>
<col>Visible in editor (both neutral and player viewports).</col>
</row>
</table>
</text>
<related>

View File

@ -28,7 +28,6 @@
<text>Graphics, sound, and music of the original game are grouped in these folders and should not be modified.</text>
<text>Using the menu system, group files can be edited and/or converted to normal directories. Group file components can then be edited using common applications for text or graphics editing. Menu system and game engine can both load packed group files or unpacked directories directly.</text>
<text>Unpacking group files greatly increases speed while editing large or deeply nested groups.</text>
<text>The global file Sound.ocg may contain any subfolders with .ocg extension to define sound namespaces. For example, a file Sound.ocg/Animals.ocg/Growl.ogg can be played back using <funclink>Sound</funclink>("Animals::Growl").</text>
</dd>
</dl>
<author>Sven2</author><date>2002-04</date>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Folder.txt</title>
<h>Folder.txt</h>
<part>
<text>Scenario folders can contain a file with certain properties, like ordering of the folders in the front end.</text>
<text>
<table>
<caption id="SektionHead">Section [Head]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<col>Index</col>
<col>Integer</col>
<col>Determines the ordering of this folder, folders with low index appear first in the folder list.</col>
</row>
</table>
</text>
</part>
<author>Maikel</author><date>2015-01</date>
</doc>

View File

@ -25,10 +25,11 @@
<dd>
<text>The icon of a scenario folder which is to be displayed instead of the book icon. 24x24 pixels, alpha channel is used for transparency.</text>
</dd>
<dt id="Desc__txt"><img height="16" src="../../images/icon_text.png" width="16"/>Desc*.txt</dt>
<dt id="Desc__rtf"><img height="16" src="../../images/icon_text.png" width="16"/>Desc*.rtf</dt>
<dd>
<text>The description of the folder. '__' must be replaced by the two digit language code, e.g. DE for German and US for American English. Multiple descriptions for several languages can be contained in a folder file of which the game will automatically load the one appropriate for the configured language.</text>
<text>The first line of the file will be used as a heading.</text>
<text>The description text of the scenario in rich text format (rtf). '__' is to be replaced by the two digit language code, e.g. DE for German and US for American English. Multiple descriptions for several languages can be contained in a scenario file of which the game will automatically load the one appropriate for the configured language.</text>
<text>The font of the description text is set internally on display. The character size in the file should be 10pt for headings and 8pt for text. Images or other rtf tags are ignored.</text>
<text>It is recommended to edit this file using a small scale rtf editor such as WordPad.exe in Windows and not a full-blown word processor such as Word as these will stuff kilobytes of unneeded extra information into the rtf file.</text>
</dd>
<dt id="Titletxt"><img height="16" src="../../images/icon_text.png" width="16"/>Title.txt</dt>
<dd>
@ -36,10 +37,6 @@
<code>DE:Meine Rundensammlung
US:My scenario collection</code> <text>Important: No quotation marks and special characters should be used.</text>
</dd>
<dt id="Foldertxt"><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="folder/folder.html">Folder.txt</emlink></dt>
<dd>
<text>Scenario folders can contain a file with some properties for the folder.</text>
</dd>
<dt id="FolderMaptxt"><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="folder/foldermap.html">FolderMap.txt</emlink></dt>
<dd>
<text>Scenario folders can also contain graphical folder maps for the selection of scenarios.</text>

View File

@ -13,6 +13,8 @@
<h>Get started</h>
<text><emlink href="files.html">Game data</emlink> - Get an overview over the game data needed for the creation of custom game content.</text>
<text><emlink href="script/index.html">C4Script</emlink> - View the introduction to the script language C4Script.</text>
<h>Search the documentation</h>
<search/>
</part>
<author>Newton</author><date>2011-08</date>
</doc>

View File

@ -19,9 +19,9 @@ US:Attack of the Killer Wipfs
<code>FR:Les wipfes moerderesque attaquent</code> <text>If an entry for the choosen language is present, the Title entry from the <emlink href="scenario/scenario.html#SektionHead">Scenario.txt</emlink> is replaced by the corresponding name.</text>
<text>Important: No quotation marks and special characters should be used.</text>
</dd>
<dt id="Desctxt"><img height="16" src="../images/icon_text.png" width="16"/>Desc*.txt</dt>
<dt id="Desctxt"><img height="16" src="../images/icon_text.png" width="16"/>Desc*.rtf</dt>
<dd>
<text>To customize the description of a <emlink href="scenario/index.html#Desc__txt">scenario</emlink> language dependant, a Desc*.txt in the scenario has to be present. (The * is a placeholder for the language abbreviation)</text>
<text>To customize the description of a <emlink href="scenario/index.html#Desc__rtf">scenario</emlink> language dependant, a Desc*.rtf in the scenario has to be present. (The * is a placeholder for the language abbreviation)</text>
</dd>
<dt id="Sciptc"><img height="16" src="../images/icon_text.png" width="16"/>Script.c, Teams.txt</dt>
<dd>

View File

@ -11,19 +11,17 @@
<dl>
<dt id="TexMaptxt"><img height="16" src="../../images/icon_text.png" width="16"/>TexMap.txt</dt>
<dd>
<text>Lookup table for color indices in static and dynamic landscapes. Colors 0-255 are matched to a material-texture-reference, except in Map.bmp static landscapes, where colors 0-127 are matched to a material-texture reference, and 128-255 are matched to the same list of references, except they are marked 'underground'.</text>
<text>Each line may contain one material-texture-entry in the format Index=Material-Texture. For example, 12=Earth-earth-topsoil would define color index 12 as earth material with the texture taken from a file called earth-topsoil.png.</text>
<text>The engine will draw materials in the order they are defined in the TexMap file, irrespective of assigned palette indices. Materials drawn late overwrite materials drawn early so that, e.g. using the standard table, rough chunks of earth will overlap water which has a smooth border. Mineral resources have an even higher index so that their rough border overlaps the earth and not the other way around. For this reason, there might be differing numbers of total pixels of a given material drawn than you might expect just from calculating the square sizes of the unzoomed map materials.</text>
<text>Lookup table for color indices in static and dynamic landscapes. Colors 0-127 are matched to a material-texture-reference. Colors 128-255 are matched to the same list of references only these are marked 'underground'.</text>
<text>The engine will draw materials with a higher index above those with a lower index so that, e.g. using the standard table, rough chunks of earth will overlap water which has a smooth border. Mineral resources have an even higher index so that their rough border overlaps the earth and not the other way around. This is also the reason why there might be differing numbers of total pixels of a given material drawn than you might expect just from calculating the square sizes of the unzoomed map materials.</text>
<text>If a custom map fails with the message 'texture n undefined' you should define the specified texture in the TexMap. You should always use a paint program capable of editing indexed color palettes without modifying the palette (MS Paint is not suited for this).</text>
</dd>
<dt id="ocm"><img height="16" src="../../images/icon_material.png" width="16"/><emlink href="material/ocm.html">*.ocm</emlink></dt>
<dd>
<text>The engine will accept up to 252 material definitions at a time. OCM files a simple text files. The materials Vehicle, Tunnel, Water, Snow, Granite, Sand, and Earth must always be available.</text>
<text>The engine will accept up to 125 material definitions at a time. OCM files a simple text files. The materials Vehicle, Tunnel, Water, Snow, Granite, Sand, and Earth must always be available.</text>
</dd>
<dt id="bmp"><img height="16" src="../../images/icon_image.png" width="16"/>*.png, *.jpg</dt>
<dt id="bmp"><img height="16" src="../../images/icon_image.png" width="16"/>*.png</dt>
<dd>
<text>There can be any number of textures in any material group. Width and height of each bitmap must be powers of 2 (that is 16, 32, 64, 128, 256, etc.).</text>
<text>Each texture may optionally have a normal map named texturename_NRM.jpg and a shape texture named texturename_Shape.png (see section below).</text>
</dd>
</dl>
<h id="MaterialTexturReferenzen">Material-Texture-References</h>
@ -44,11 +42,7 @@
</row>
</table>
</text>
<h id="TextureShapes">Texture shapes</h>
<text>Shape textures may be used to denote individual objects like rocks or bricks within a texture. When zooming the map to the landscape, the engine tries to zoom such that only complete objects from the shape texture are used in the final landscape. This is achieved by completing all shapes that have a minimum coverage from the map pixels zoomed at flat shape. The minimum coverage can be set per material using the MinShapeOverlap setting.</text>
<text>Texture files should be named [Texturename]_Shape.png and use one distinct color per shape. Shapes may (and should) wrap around borders, but must not exceed 25% of the total texture size in each dimension. Areas outside a shape must be made fully transparent. All shape colors must be exact, i.e. no anti-aliasing between shapes or to transparency may be used. Shape files should have be sized as a whole multiple of the corresponding texture size divided by its scaler (usually 4). A maximum of 255 shapes may be defined in each texture. See granite_Shape.png in the original Materials.ocg for an example.</text>
<text>For debugging purposes, e.g. for finding problems with spurious single pixels, a summary of all loaded shape textures can be printed to the startup log by setting DebugShapeTextures in the [Developers] section of the configuration to a nonzero unsigned integer.</text>
</part>
<author>Sven2</author><date>2015-10</date>
<author>Sven2</author><date>2002-04</date>
<author>matthes</author><date>2004-04</date>
</doc>

View File

@ -23,7 +23,7 @@
<row>
<col>ColorAnimation</col>
<col>Integer</col>
<col>0 or 1. Color animation.</col>
<col>0 oder 1. Color animation.</col>
</row>
<row>
<col>Shape</col>
@ -33,7 +33,7 @@
<row>
<col>Density</col>
<col>Integer</col>
<col>A density of 25 and above is liquid. 50 and above is solid. <funclink>BlastFree</funclink> offers a parameter to only blast solid materials of a given density or lower.</col>
<col>Density: 50 solid, 25 liquid (other values not allowed).</col>
</row>
<row>
<col>Friction</col>
@ -43,12 +43,12 @@
<row>
<col>DigFree</col>
<col>Integer</col>
<col>0 or 1. Determines wether the material can be dug into.</col>
<col>0 oder 1. Determines wether the material can be dug into.</col>
</row>
<row>
<col>BlastFree</col>
<col>Integer</col>
<col>0 or 1. Determines whether the material can be blasted away.</col>
<col>0 oder 1. Determines whether the material can be blasted away.</col>
</row>
<row>
<col>Blast2Object</col>
@ -83,7 +83,7 @@
<row>
<col>Instable</col>
<col>Integer</col>
<col>0 or 1. Stability.</col>
<col>0 oder 1. Stability.</col>
</row>
<row>
<col>MaxAirSpeed</col>
@ -106,12 +106,9 @@
<col>Inflammability.</col>
</row>
<row>
<col>Incendiary</col>
<col>Incindiary</col>
<col>Integer</col>
<col>
This material incinerates objects.
<em>Note: For compatibility reasons, the misspelling &quot;Incindiary&quot; is also accepted if (and only if) no value with the correct spelling is set.</em>
</col>
<col>This material incinerates objects.</col>
</row>
<row>
<col>Corrode</col>
@ -133,11 +130,6 @@
<col>Integer</col>
<col>Plants grow on this material.</col>
</row>
<row>
<col>Light</col>
<col>Integer</col>
<col>0 or 1. If greater than zero, ambient light is emitted from this material even if drawn unterground.</col>
</row>
<row>
<col>TempConvStrength</col>
<col>Integer</col>
@ -193,6 +185,11 @@
<col>Integer</col>
<col>Direction of temperature conversion: 0 bottom up, 1 top down</col>
</row>
<row>
<col>Alpha</col>
<col>6 integers</col>
<col>Transparency of the three material colors.</col>
</row>
<row>
<col>Placement</col>
<col>Integer</col>
@ -206,7 +203,7 @@
<row>
<col>OverlayType</col>
<col>Integer</col>
<col>Bit mask for texture calculation on this material. Bit 0 (1): exact (no zoom), bit 1 (2): no texture, bit 2 (4): extra large zoom</col>
<col>Bit mask for texture calculation on this material. Bit 0 (1): exact (no zoom), bit 1 (2): no texture, bit 2 (4): extra large zoom, bit 3 (8): calculate texture based on gray scale.</col>
</row>
<row>
<col>PXSGfx</col>
@ -218,11 +215,6 @@
<col>4 integers</col>
<col>Target rectangle for the graphics of loose material pixels. Additional phases on the right and below the specified rectangle will be used. The rectangle should always start in the top left corner and use the complete texture size.</col>
</row>
<row>
<col>MinShapeOverlap</col>
<col>Integer</col>
<col>Used during map-to-landscape zooming when drawn with a texture with shape definitions: Minimum overlap of map pixels to corresponding shapes to cause a full shape expansion. See <emlink href="material/index.html#TextureShapes">Shape textures</emlink>.</col>
</row>
</table>
</text>
</part>
@ -375,11 +367,8 @@
<col>The background material.</col>
</row>
<row>
<col>Incendiary</col>
<col>
All materials that can incinerate objects.
<em>Note: For compatibility reasons, the misspelling &quot;Incindiary&quot; is also accepted.</em>
</col>
<col>Incindiary</col>
<col>All materials to be incinerated.</col>
</row>
<row>
<col>Extinguisher</col>
@ -449,5 +438,5 @@
The return value of the function should be either 1 for removal or 0 for keeping the loose material.
</text>
</part>
<author>Sven2</author><date>2015-10</date>
<author>Sven2</author><date>2006-12</date>
</doc>

View File

@ -7,7 +7,7 @@
<h>Particle</h>
<part>
<text>Particles are lightweight objects which are not synchronized in a network game. This means that on the one hand you can create huge amounts of particles without slowing down the game too much but on the other hand there are only limited options for control of particle behaviour. If the particles are not sufficient for a given effect you have in mind, you can always use true objects instead.</text>
<text>If a particle is defined in a ocd group, any object definition located in the same group is ignored.</text>
<text>If a particle is defined in a ocd group, any object definition located in the same group is ignored. This used to be a way to allow loading of placeholder options in the old graphics system which didn't support particles.</text>
<text>Particles are not stored in savegames and are designed for temporary visual effects only.</text>
<h id="PartikelKomponentenOCD">Particle Components (ocd)</h>
<dl>
@ -34,127 +34,190 @@
<row>
<col>Name</col>
<col>String (max. 30 chars)</col>
<col>Name of the particle definition. This name is also used to refer to this particle type in scripts.</col>
<col>Name of the particle definition. This name is also used to refer to this particle type in scripts. For multi-language display in the menu system you should use the Names.txt component.</col>
</row>
<row>
<col>MaxCount</col>
<col>Integer</col>
<col>Maximum number of instances of this particle type. See <a href="#maxcount">instance control</a>.</col>
</row>
<row>
<col>MinLifetime</col>
<col>Integer</col>
<col>Only for smoke particles: lower limit for the lifetime, which ranges from MinLifetime to MaxLifetime.</col>
</row>
<row>
<col>MaxLifetime</col>
<col>Integer</col>
<col>Only for smoke particles: upper limit for the lifetime, which ranges from MinLifetime to MaxLifetime.</col>
</row>
<row>
<col>InitFn</col>
<col>String (max. 30 chars)</col>
<col>Identifier for the function used to initialize the particle. For valid functions see section <a href="#funcs">particle functions</a>.</col>
</row>
<row>
<col>ExecFn</col>
<col>String (max. 30 chars)</col>
<col>Identifier for the function used to execute the particle each frame. For valid functions see section <a href="#funcs">particle functions</a>.</col>
</row>
<row>
<col>DrawFn</col>
<col>String (max. 30 chars)</col>
<col>Identifier for the function used to draw the particle. For valid functions see section <a href="#drawfuncs">drawing functions</a>.</col>
</row>
<row>
<col>CollisionFn</col>
<col>String (max. 30 chars)</col>
<col>Identifier for the function called upon collision with the landscape. Also see <a href="#collision">collision checking</a>.</col>
</row>
<row>
<col>Face</col>
<col>4 integers</col>
<col>6 integers</col>
<col>Target rectangle for the graphics within Graphics.png. See <a href="#face">particle graphics</a>.</col>
</row>
</table>
</text>
<h id="face">Graphics</h>
<text>The coordinates for the source rectangle within Graphics.png of a particle specify the first phase of the particle graphics the other phases should follow to the right and can be continued in the next row. The animation length is then automatically determined from the image size.</text>
<h id="properties">Properties</h>
<text>Each particle has different attributes like position, lifetime, size and more. These are set by script when creating the particle.</text>
<text>The following properties can be contained in a proplist passed to <funclink>CreateParticle</funclink>. For an example, see <funclink>CreateParticle</funclink></text>
<text>You can assign either constants to the properties (f.e. <code>R = 200</code>) or use certain value provider functions (f.e. <code>R = <funclink>PV_Linear</funclink>(200, 0)</code>). Available value provider functions are:
<funclink>PV_Linear</funclink>
<funclink>PV_Direction</funclink>
<funclink>PV_Random</funclink>
<funclink>PV_Step</funclink>
<funclink>PV_Speed</funclink>
<funclink>PV_KeyFrames</funclink>
<funclink>PV_Wind</funclink>
<funclink>PV_Gravity</funclink>
<funclink>PV_Sin</funclink>
<funclink>PV_Cos</funclink>
</text>
<text>
<table>
<caption id="particledef">Particle definition proplist</caption>
<rowh>
<col>Name</col>
<col>Values</col>
<col>Description</col>
</rowh>
<row>
<col>R</col>
<col>0 to 255</col>
<col>Red part of the color modulation.</col>
</row>
<row>
<col>G</col>
<col>0 to 255</col>
<col>Green part of the color modulation.</col>
</row>
<row>
<col>B</col>
<col>0 to 255</col>
<col>Blue part of the color modulation.</col>
</row>
<row>
<col>Alpha</col>
<col>0 to 255</col>
<col>Alpha part of the color modulation.</col>
</row>
<row>
<col>Size</col>
<col>pixels</col>
<col>Size of the particle in pixels.</col>
</row>
<row>
<col>Stretch</col>
<col>factor</col>
<col>The vertical stretch of the particle. 1000 equals no stretch.</col>
</row>
<row>
<col>Phase</col>
<col>Index of phase</col>
<col>The displayed phase of the particle from the Graphics.png. The index starts at 0 and will be wrapped.</col>
</row>
<row>
<col>Rotation</col>
<col>0 to 360</col>
<col>Rotation of the particle.</col>
</row>
<row>
<col>ForceX</col>
<col>YOff</col>
<col>Integer</col>
<col>Force in x-direction that is constantly applied to the particle's speed. Can f.e. simulate wind.</col>
<col>Upper spatial limit for the particle. At this limit the particles will be deleted as if the landscape would end here. Only StdExec.</col>
</row>
<row>
<col>ForceY</col>
<row>
<col>Delay</col>
<col>Integer</col>
<col>Force in y-direction that is constantly applied to the particle's speed. Ca f.e. simulate gravity.</col>
<col>Delay between two animation phases. If Delay = 0 one randomly chosen phase is permanently displayed.</col>
</row>
<row>
<col>DampingX</col>
<col>0 to 1000</col>
<col>Damping of the particle's speed in x-direction. 1000 means no damping, 0 means instant stop.</col>
</row>
<row>
<col>DampingY</col>
<col>0 to 1000</col>
<col>Damping of the particle's speed in y-direction. 1000 means no damping, 0 means instant stop.</col>
</row>
<row>
<col>BlitMode</col>
<col>0 or GFX_BLIT_Additive</col>
<col>The particle's blit mode. Currently only additive blitting is supported.</col>
</row>
<row>
<col>CollisionVertex</col>
<col>0 to 1000</col>
<col>The offset of the particle's hit point relative to its width. When set, the particle will collide with the landscape. 0 means the particle will collide with its center.</col>
</row>
<row>
<col>CollisionDensity</col>
<row>
<col>Repeats</col>
<col>Integer</col>
<col>The material density above which the particle will collide. This can be used to let the particle collide with liquids. By default, particles collide with solid material if the collision is enabled. Also see <emlink href="material/ocm.html">material definitions</emlink>.</col>
<col>Number of animation runs until the particle is destroyed.</col>
</row>
<row>
<col>OnCollision</col>
<col><funclink>PC_Die</funclink>, <funclink>PC_Bounce</funclink>, <funclink>PC_Stop</funclink></col>
<col>Defines what happens when the particle collides with the landscape.</col>
<row>
<col>Reverse</col>
<col>Integer</col>
<col>0 or 1. If 1 every seconds animation is played backwards.</col>
</row>
<row>
<row>
<col>FadeOutLen</col>
<col>Integer</col>
<col>If specified, this number of animation phases is truncated from the end and reserved for a death animation which is displayed after all repetitions of the standard animation.</col>
</row>
<row>
<col>FadeOutDelay</col>
<col>Integer</col>
<col>Delay between two animation phases of the death animation.</col>
</row>
<row>
<col>RByV</col>
<col>Integer</col>
<col>0 to 3. 0 for no particle rotation. If 1 the particle will be aligned to its direction of travel; the particle's up-side will be in front. If 2 the speed parameters only determine rotation; the particle will not move. If 3 a random rotation is applied.</col>
</row>
<row>
<col>GravityAcc</col>
<col>Integer</col>
<col>Effects of gravity. At 0 the particle is not affected by gravity, at 100 it is fully affected. Negative values are also possible.</col>
</row>
<row>
<col>WindDrift</col>
<col>Integer</col>
<col>Horizontal drift by wind. Same as the material property of the same name.</col>
</row>
<row>
<col>VertexCount</col>
<col>Integer</col>
<col>0 or 1. If 1, <a href="#collision">collision detection</a> is done.</col>
</row>
<row>
<col>VertexY</col>
<col>Integer</col>
<col>Y offset of the collision checking point in percent. Also see <a href="#collision">collision detection</a>.</col>
</row>
<row>
<col>Additive</col>
<col>Integer</col>
<col>0 or 1. If 1, the particle is drawn additively.</col>
</row>
<row>
<col>AlphaFade</col>
<col>Integer</col>
<col>0 to 40. Rate of fade out per FadeDelay. A fully faded particle is removed.</col>
</row>
<row>
<col>FadeDelay</col>
<col>Integer</col>
<col>The default is 1.</col>
</row>
<row>
<col>Parallaxity</col>
<col>2 Integer</col>
<col>Parallaxity in x and y directions. 0 is locked with the viewport; 100 is default (locked with the landscape).</col>
</row>
<row>
<col>Attach</col>
<col>bit mask</col>
<col>Defines the attachment of the particles to the calling object. Can be a combination of ATTACH_Front, ATTACH_Back, and ATTACH_MoveRelative. For example <code>ATTACH_Front | ATTACH_MoveRelative. Non-attached particles are drawn on plane 900 (i.e. before most objects).</code></col>
<col>Integer</col>
<col>0 or 1. If 1 the particle is moving relative to its target object's position.</col>
</row>
</table>
</text>
<h id="attributes">Properties</h>
<text>Each particle has a position (x, y), horizontal and vertical impulse (xdir and ydir), life time (life), and two extra parameters (a and b). These are initialized by script and then processed by the <a href="#funcs">particle functions</a>. For more information see <a href="#funcs">particle functions</a> and <a href="#drawfuncs">drawing functions</a>.</text>
<h id="face">Graphics</h>
<text>The coordinates for the source rectangle within Graphics.png of a particle are comparable to the Face entry in an object's <emlink href="definition/actmap.html">ActMap</emlink>. The coordinates only specify the first animation phase. All following animation phases should be located on the right (with smoke also below) of the initial phase. The animation length is then automatically determined from the image size. For the drawing offset you should usually specify half the particle size. An offset 0/0 would cause the particle graphics to be drawn below actual particle position.</text>
<text>If Delay = 0, a random animation phase is chosen on startup and maintained. The particle will exist until is falls out of the landscape.</text>
<h id="maxcount">Particle Amounts</h>
<text>For each particle type a maximum count is defined which is then also adjusted by the configuration setting for effect levels in the graphics options. As soon as half of the maximum amount of particles is created, new particles are only created based on random selected and the closer you get to the maximum value, the smaller the chance of new particle generation. This ensures a smooth approach to the actual limit.</text>
<h id="collision">Collision Detection</h>
<text>Particles can collide with the landscape. This is not very exact, however. Fast moving particles might pass through very thin layers of solid materials. If you need more precision, you should use objects instead.</text>
<text>Collision detection is only done in StdExec (i.e. not with smoke particles). For valid functions see <a href="#funcs">particle functions</a>. Collision detection is done at the particle center and only if VertexCount is specified. The point of detection can be shifted using VertexY. The specified values are in percent of the particle size, meaning VertexY=100 would check at the bottom of the particle. The visual size specified in Face doesn't affect this.</text>
<h id="funcs">Particle Functions</h>
<text>The behaviour of particles can be controlled by predefined particle functions. These are executed for initialization, then at each fram, and in case of <a href="#collision">collision</a> with the landscape.</text>
<dl>
<dt id="stdexec">StdExec</dt>
<dd>
<text>Standard function ExecFn for almost all particle types. The particle runs through an animation defined by Face, Delay, Repeats, Reverse, FadeOutLen, and FadeOutDelay and is then destroyed. The extra parameter defines the size of the particle in 1/10 pixels. b defines color modulation; if b = 0 no modulation is applied. aa as well as b are not modified by this function and will preserve the <a href="#control">initial</a> values. Also, the particle moves according to xdir and ydir while ydir is affected by gravity if GravityAcc is enabled.</text>
</dd>
<dt id="stdinit">StdInit</dt>
<dd>
<text>Standard function for InitFn to be used with StdExec.</text>
</dd>
<dt id="bounce">Bounce</dt>
<dd>
<text>Collision function: the particle will bounce back into the exact opposite direction.</text>
</dd>
<dt id="bouncey">BounceY</dt>
<dd>
<text>Collision function: the particle will bounce back vertically.</text>
</dd>
<dt id="stop">Stop</dt>
<dd>
<text>Collision function: the particle will stop.</text>
</dd>
<dt id="die">Die</dt>
<dd>
<text>Collision function: the particle will be destroyed.</text>
</dd>
<dt id="smokeexec">SmokeExec</dt>
<dd>
<text>Hard coded processing function for smoke particles. a is puff size; b is color modulation. Smoke graphics must be defined in 4 x 4 animation phases in Graphics.png of which the one on the lower right is used only rarely. The other animation phases are used evenly. Smoke always rises continuously until it collides with the landscape. If the life time has passed, the smoke particle fades out until it is deleted.</text>
</dd>
<dt id="smokeinit">SmokeInit</dt>
<dd>
<text>Hard coded initialization function for smoke to be used in conjunction with SmokeExec.</text>
</dd>
</dl>
<h id="drawfuncs">Drawing Functions</h>
<text>Functions that can be assigned to DrawFn.</text>
<dl>
<dt id="drawstd">Std</dt>
<dd>
<text>Standard function for most particles except smoke. The particle is drawn at position x/y with size a/5 x a/5 and color modulated with b.</text>
</dd>
<dt id="drawsmoke">Smoke</dt>
<dd>
<text>Drawing function for smoke.</text>
</dd>
</dl>
<h id="control">Control</h>
<text>External control of particles is very limited and only allows creation, global offset, and global removal. This is necessary as particles are not synchronized on computers throughout a network game and any deviation in particle handling would cause sync loss. Particles are created using <funclink>CreateParticle</funclink>.</text>
</part>
<author>Zapper</author><date>2013-10</date>
<author>Sven2</author><date>2002-04</date>
</doc>

View File

@ -39,37 +39,32 @@
<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.html#Globals">Global definitions</emlink>.</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.html#Hold">Held keys</emlink>.</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.html#Repeat">Key repeats</emlink>.</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.html#Repeat">Key repeats</emlink>.</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.html#Deactivate">Deactivated commands</emlink>.</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.html#ExtraData">ExtraData</emlink>.</col>
</row>
<row>
<literal_col>CoordinateSpace</literal_col>
<col>Game, Viewport</col>
<col>For viewport the given coordinates are relative to the players top left corner of the window. Default ist Game.</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>
@ -94,7 +89,7 @@
</row>
<row>
<literal_col>Script</literal_col>
<col>Execution of the script function <em>PlayerControl</em>. See <emlink href="playercontrols.html#Script">Script callbacks</emlink>. (Default value)</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>
@ -184,17 +179,17 @@
<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.html#Keys">Key mappings</emlink>.</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.html#Keys">Key mappings</emlink>.</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.html#ControlDef">[ControlDef]</emlink>.</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>
@ -223,7 +218,7 @@
</row>
<row>
<literal_col>TriggerMode</literal_col>
<col>Bitmask</col>
<col>bitmask</col>
<col>
<text>
Trigger mode of this mapping. Bitmask based on the following values:
@ -239,29 +234,24 @@
</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.html#Hold">Held keys</emlink>.</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.html#Hold">Held keys</emlink>.</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>ClearRecentKeys</literal_col>
<col>When the assignment is triggered, all recent keys are deleted and the trigger key is not added to the recent list. This means no future key combos can be triggered with any keys including and preceding the current.</col>
<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>
<row>
<literal_col>OverrideAssignments</literal_col>
<col>Boolean</col>
<col>The assignment overwrites all other assignments for the same control with the same press/release trigger mode.</col>
</row>
</table>
</part>
<h id="Script">Script callbacks</h>
@ -273,7 +263,7 @@
return true;
}</code>
<text>most commands (except for asynchronous commands in the player menu) call a global script function:</text>
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, int state)</code>
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, bool release)</code>
<text>For an explanation of the parameters see <funclink>PlayerControl</funclink>. Amongst others, the function receives the calling player in player as well as the command to be executed in control.</text>
<text>As a simple example let's assume that in the global <em>PlayerControls.txt</em> the following command has been defined:</text>
<code>[ControlDefs]
@ -293,11 +283,11 @@
Control=Jump
Priority=50</code>
<text>This defines a Jump key and the corresponding standard mapping on the keyboard for the first player. The following script is used to handle the control:</text>
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, int state)
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, bool release)
{
// Which command has been issued?
// The constant CON_Jump has been declared automatically through the definition in PlayerControls.txt
if (control == CON_Jump &amp;&amp; state == CONS_Down)
if (control == CON_Jump &amp;&amp; !release)
{
// pressed the jump button. The clonk selected by the player shall jump
var player_clonk = GetCursor(player);
@ -319,17 +309,17 @@
GUIDesc=Going underground
ExtraData=Shovel</code>
<text>Let shovel be the ID of a shovel object. In the global script there could be the following, generic handling for unknown commands, for example:</text>
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, int state)
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, bool release)
{
// Handling of known controls
// [...]
// control with own handling
if (control_extra) return control_extra-&gt;PlayerControl(player, control, x, y, strength, repeat, state);
if (control_extra) return control_extra-&gt;PlayerControl(player, control, x, y, strength, repeat, release);
// unkown control
return false;
}</code>
<text>And in the script of the shovel:</text>
<code>func PlayerControl(int player, int control, int x, int y, int strength, bool repeated, int state)
<code>func PlayerControl(int player, int control, int x, int y, int strength, bool repeated, bool release)
{
// Handling of known controls
// Control dig directly in the shovel
@ -351,9 +341,8 @@
<ul>
<li>When released they also generate <funclink>PlayerControl</funclink> calls in the script with the <em>Release</em> flag set.</li>
<li>Mappings can emulate permanent key presses using the <em>Hold</em>/<em>Release</em> flags.</li>
<li><emlink href="playercontrols.html#Repeat">Key repeats</emlink> are generated.</li>
<li><emlink href="playercontrols.xml#Repeat">Key repeats</emlink> are generated.</li>
<li>The held state of the key can be queried in the script via <funclink>GetPlayerControlState</funclink>.</li>
<li>If the command is bound to an analog stick or trigger on a controller, every change in position causes in a call to PlayerControl() with state = CONS_Moved.</li>
</ul>
</text>
<text>A good example for this functionality is a directional command:</text>
@ -363,7 +352,7 @@
GUIDesc=Walk left
Hold=1</code>
<text>In the script the direction is transferred to the Clonk:</text>
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, int state)
<code>global func PlayerControl(int player, int control, C4ID control_extra, int x, int y, int strength, bool repeated, bool release)
{
if (control == CON_Left) return UpdateControlDir(player);
// ...

View File

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>ParameterDefs.txt</title>
<h>ParameterDefs.txt</h>
<text>This file can be used to specify custom parameters that players can set for this scenario before starting it. Intended usages include difficulty or map size settings.</text>
<text>Names and descriptions can be localized the same way scripts can using $id$ strings and corresponding string table entries.</text>
<text>At the moment, parameters can only be set in the lobby of network games.</text>
<text>
<table>
<caption id="SektionDefs">Any number of sections [ParameterDef]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
<col>Default value</col>
</rowh>
<row>
<col>Name</col>
<col>String</col>
<col>Label put in front of this parameter.</col>
<col></col>
</row>
<row>
<col>Description</col>
<col>String</col>
<col>Description for setting used as tool tip on the control.</col>
<col></col>
</row>
<row>
<col>ID</col>
<col>String</col>
<col>Identifier for this parameter. Should be a valid identifier containing only letters, numbers and underscores and should not begin with a number. The script engine prefixes this name with SCENPAR_ and uses it to register the picked value as a constant before game initialization.</col>
<col></col>
</row>
<row>
<col>Type</col>
<col>String</col>
<col>Data type of parameter. At the moment, only Enumeration is supported.</col>
<col>Enumeration</col>
</row>
<row>
<col>Default</col>
<col>Integer</col>
<col>Value of default option that is chosen if the user does not select anything.</col>
<col>0</col>
</row>
<row>
<col>LeagueValue</col>
<col>Integer</col>
<col>If nonzero, the parameter will be forced to this vlaue in league games.</col>
<col>0</col>
</row>
<row>
<col>Achievement</col>
<col>String</col>
<col>If set to an achievement ID, this parameter is hidden in the selection dialogue and only used to track player achievements for this scenario. See section below.</col>
<col></col>
</row>
</table>
</text>
<text>Each parameter of type Enumeration should be followed by subordinate section [Options], which contains several subordinate sections [Option]. Subordinate sections need to be indented further than their parent section.</text>
<text>
<table>
<caption id="SektionOption">Any number of sections [Option]</caption>
<rowh>
<col>Value</col>
<col>Data type</col>
<col>Description</col>
<col>Default value</col>
</rowh>
<row>
<col>Name</col>
<col>String</col>
<col>Label used in dropdown menu for this option.</col>
<col></col>
</row>
<row>
<col>Description</col>
<col>String</col>
<col>Description for element in dropdown menu for this option. Currently not shown.</col>
<col></col>
</row>
<row>
<col>Value</col>
<col>Integer</col>
<col>Value that is assigned to the script constant if this option is picked. Each option within one parameter definition should have a unique value.</col>
<col>0</col>
</row>
</table>
</text>
<h>Achievements</h>
<text>Scenario achievements are special parameter definitions for which the values are stored per player and per scenario. These parameters cannot be set maually, but can only be gained in game using the <funclink>GainScenarioAchievement</funclink> function. Each achievement that has been gained is represented by a small image beside the scenario title in the scenario selection dialogue.</text>
<text>Achievements need to be defined as parameter definition with the Achievement value set in the [ParameterDef] section. The value corresponds to the icon file name formatted as Achv*.png, where * is replaced by the achievement name. The icon may either be placed in the scenario or - if multiple scenarios share the same icon - in the global Graphics.ocg file. Icons are square with the height determining the dimensions.</text>
<text>By using achievement values higher than one, multiple stages of an achievement may be defined e.g. for finishing a scenario on different difficulties. The achievement value denotes the 1-based index in the icon file with multiple icons arranged from left to right.</text>
<text>If several players are activated while the scenario selection dialogue is opened, the player with the highest achievement value is considered for each achievement.</text>
<h>Example</h>
<text>Example ParameterDef.txt file for a difficulty setting in a scenario that controls the amount of meteorites:</text>
<code>[ParameterDef]
Name=$Difficulty$
Description=$DescDifficulty$
ID=Difficulty
Default=15
[Options]
[Option]
Name=$Easy$
Description=$DescEasy$
Value=15
[Option]
Name=$Hard$
Description=$DescHard$
Value=100
[ParameterDef]
ID=Done
Achievement=Done
[Options]
[Option]
Description=$AchvEasy$
Value=1
[Option]
Description=$AchvHard$
Value=3</code>
<text>The names and descriptions are localized strings which can be set for English in a StringTblUS.txt:</text>
<code>Difficulty=Difficulty
Easy=Easy
Hard=Hard
DescDifficulty=Conrols the amount of meteorites
DescEasy=Very few meteorites
DescHard=Lots of meteorites
AchvEasy=Finished on easy.
AchvHard=Finished on hard.</code>
<text>Finally, the Script.c file of the scenario should contain code to evaluate the setting and give an achievement accordingly:</text>
<code>func Initialize()
{
// Meteorite amount depending on difficulty setting
Meteor->SetChance(SCENPAR_Difficulty);
}
func OnGoalsFulfilled()
{
<funclink>GainScenarioAchievement</funclink>("Done", BoundBy(SCENPAR_Difficulty, 1, 3)); // 1 for easy, 3 for hard
return false;
}</code>
<author>Sven2</author><date>2014-09</date>
</doc>

View File

@ -22,10 +22,6 @@
<dd>
<text>Static landscapes are stretched by factor MapZoom defined in Scenario.txt to the size of the actual landscape in the game. The colors used in Map.bmp correspond to materials and textures as defined in <emlink href="material/index.html#TexMaptxt">TexMap.txt</emlink>.</text>
</dd>
<dt id="MapFgBg"><img height="16" src="../../images/icon_image.png" width="16"/>MapFg.bmp / MapBg.bmp</dt>
<dd>
<text>Same as Map.bmp as defined above, except that foreground and background materials can be drawn separately. In Map.bmp, color indices greater than 127 will result in underground materials. In MapFg.bmp and MapBg.bmp, all color indices up to 255 can be used, and undergroup materials are simply specified by tunnel material in the background map.</text>
</dd>
<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>
@ -54,20 +50,17 @@ US:Attack of the Killer Wipfs</code>
<dd>
<text>The icon of the scenario in png format. Size: 24x24 pixel.</text>
</dd>
<dt id="Desc__txt"><img height="16" src="../../images/icon_text.png" width="16"/>Desc__.txt</dt>
<dt id="Desc__rtf"><img height="16" src="../../images/icon_text.png" width="16"/>Desc__.rtf</dt>
<dd>
<text>The description of the scenario. '__' must be replaced by the two digit language code, e.g. DE for German and US for American English. Multiple descriptions for several languages can be contained in a scenario file of which the game will automatically load the one appropriate for the configured language.</text>
<text>The first line of the file will be used as a heading.</text>
<text>The description text of the scenario in rich text format (rtf). '__' is to be replaced by the two digit language code, e.g. DE for German and US for American English. Multiple descriptions for several languages can be contained in a scenario file of which the game will automatically load the one appropriate for the configured language.</text>
<text>The font of the description text is set internally on display. The character size in the file should be 10pt for headings and 8pt for text. Images or other rtf tags are ignored.</text>
<text>It is recommended to edit this file using a small scale rtf editor such as WordPad.exe in Windows and not a full-blown word processor such as Word as these will stuff kilobytes of unneeded extra information into the rtf file.</text>
</dd>
</dl>
<h id="Additional">Additional files</h>
<dl>
<dt id="ParameterDefstxt"><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="scenario/ParameterDefs.html">ParameterDefs.txt</emlink></dt>
<dd>
<text>Contains custom scenario parameters that players can adjust like e.g. difficulty settings.</text>
</dd>
<dt id="Teamstxt"><img height="16" src="../../images/icon_text.png" width="16"/><emlink href="scenario/Teams.html">Teams.txt</emlink></dt>
<dd>
<text>Contains the Teamsettings for multiplayer scenarios.</text>
@ -80,11 +73,10 @@ US:Attack of the Killer Wipfs</code>
<dt id="Soundocg"><img height="16" src="../../images/icon_system.png" width="16"/>Sound.ocg</dt>
<dd>
<text>Scenarios can contain any number of sound files (*.ogg or *.wav). These can be played back by script during the game. Scenario local sounds are loaded dynamically on demand which might cause delays with large scenario files. The sounds should be stored in a local sound group.</text>
<text>Just like the global sound file, scenario local Sound.ocg groups may contain any subfolders with .ocg extension to define sound namespaces. For example, a file Sound.ocg/Animals.ocg/Growl.ogg can be played back using <funclink>Sound</funclink>("Animals::Growl").</text>
</dd>
<dt id="Musicocg"><img height="16" src="../../images/icon_system.png" width="16"/>Music.ocg</dt>
<dd>
<text>If the scenario contains music (*.ogg) files, these can be played back during the game in random order. Also see the script command <emlink href="script/fn/Music.html">Music</emlink>(). Local music files should be stored in a local music group.</text>
<text>If the scenario contains music (*.ogg or *.mid) files, these can be played back during the game in random order. Also see the script command <emlink href="script/fn/Music.html">Music</emlink>(). Local music files should be stored in a local music group.</text>
</dd>
<dt id="Materialocg"><img height="16" src="../../images/icon_system.png" width="16"/><emlink href="material/index.html">Material.ocg</emlink></dt>
<dd>
@ -107,18 +99,19 @@ US:Attack of the Killer Wipfs</code>
<h id="SaveGames">Additional files created for saved games or scenarios</h>
<dl>
<dt id="Landscapepng"><img height="16" src="../../images/icon_image.png" width="16"/>Landscape.png</dt>
<dd>
<text>Full size map for exact landscapes. This is mainly used in savegames to store the exact terrain including transparent materials and their texture. Exact landscapes consume an extreme amount of memory and should not be used for regularly distributed scenarios.</text>
</dd>
<dt id="MatMaptxt"><img height="16" src="../../images/icon_text.png" width="16"/>MatMap.txt</dt>
<dd>
<text>Stores the material table used in this scenario. The materials listed here are used by the exact landscape and have to be available in the loaded Material.ocg group.</text>
</dd>
<dt id="Objectstxt"><img height="16" src="../../images/icon_text.png" width="16"/>Game.txt</dt>
<dt id="Objectstxt"><img height="16" src="../../images/icon_text.png" width="16"/>Objects.txt</dt>
<dd>
<text>This component is generated by the engine and stores runtime object data of a savegame.</text>
</dd>
<dt id="Objectsc"><img height="16" src="../../images/icon_text.png" width="16"/>Objects.c</dt>
<dd>
<text>This component is generated by the engine if the game is stored as a scenario. Contains an InitializeObjects() function to recreate all objects placed during editing before. See <emlink href="definition/script.html#ScenSave">Object saving</emlink>.</text>
</dd>
</dl>
<h id="UeberladungenOCS">Overloading Rules</h>
<text>Various system components (graphics, loader screens, materials, music, or objects) can be overloaded in scenarios. In doing this, parent scenario folders (ocf) are searched. Also, components located in child groups will always overload the same components located in parent groups.</text>

View File

@ -68,12 +68,7 @@
<row>
<col>MissionAccess</col>
<col>String</col>
<col>The scenario will only load if the player gained this password in another scenario. See script function <funclink>GainScenarioAccess</funclink>().</col>
</row>
<row>
<col>Secret</col>
<col>Bool</col>
<col>If true and MissionAccess is set, the scenario is invisible in the scenario selection list if the player does not have the required password access.</col>
<col>The scenario will only load if the player gained this password in another scenario. See script function <funclink>GainMissionAccess</funclink>().</col>
</row>
<row>
<col>ForcedFairCrew</col>
@ -100,11 +95,6 @@
<col>Data type</col>
<col>Description</col>
</rowh>
<row>
<col>Mode</col>
<col>String</col>
<col>General game mode of this scenario. Used by network and league servers to determine which league to host the game in. Currently suggested identifiers are: Melee, Parkour, Settlement, Defense. Strings should be valid identifiers.</col>
</row>
<row>
<col>Rules</col>
<col>ID list</col>
@ -121,14 +111,9 @@
<col>List of definitions for which the values should be overridden. The amount will be the new value.</col>
</row>
<row>
<col>FoWEnabled</col>
<col>Bool</col>
<col>0 or 1. If 0, FoW is disabled, and the whole landscape is visible. Default 1.</col>
</row>
<row>
<col>EvaluateOnAbort</col>
<col>Bool</col>
<col>If enabled, the game will be evaluated even when aborted by the player. This is intended for scenarios like Tower of Despair that save progress in players. Default false.</col>
<col>FoWColor</col>
<col>DWORD</col>
<col>Color of the fog of war</col>
</row>
</table>
</text>
@ -176,12 +161,12 @@
<col>Objects the player should initially be able to create.</col>
</row>
<row>
<literal_col>BaseMaterial</literal_col>
<literal_col>HomeBaseMaterial</literal_col>
<col>ID list</col>
<col>Materials available to buy at game start.</col>
</row>
<row>
<literal_col>BaseProduction</literal_col>
<literal_col>HomeBaseProduction</literal_col>
<col>ID list</col>
<col>Additional supply of materials to buy.</col>
</row>
@ -238,7 +223,7 @@
<row>
<literal_col>TopOpen</literal_col>
<col>Integer</col>
<col>0, 1 or 2. Determines wether the top of the game world should be open. Values analogous to BottomOpen.</col>
<col>0 or 1. Determines wether the top of the game world should be open.</col>
</row>
<row>
<literal_col>LeftOpen</literal_col>
@ -253,7 +238,7 @@
<row>
<literal_col>AutoScanSideOpen</literal_col>
<col>Integer</col>
<col>0, 1, or 2. If 1, the left and right borders are closed if the corresponding map pixel in the left or right row has non-sky foreground or background and open otherwise. If 2, it only checks the background.</col>
<col>0 or 1. If 1, LeftOpen and RightOpen will be set automatically depending on the landscape at game start.</col>
</row>
<row>
<literal_col>MapWidth</literal_col>
@ -268,7 +253,7 @@
<row>
<literal_col>MapZoom</literal_col>
<col>4 integers</col>
<col>Factor for zooming the map to the real game world. Default is 8.</col>
<col>Factor for zooming the map to the real game world. Default is 10.</col>
</row>
<row>
<literal_col>Amplitude</literal_col>
@ -350,11 +335,6 @@
<col>Integer</col>
<col>0 or 1. If 1, all landscape chunks are drawn flat when the map is zoomed to draw the landscape. Set this while drawing a static map in console mode to fix small gaps of lower order materials hidden behind materials of chunky shape.</col>
</row>
<row>
<literal_col>Secret</literal_col>
<col>Bool</col>
<col>Whether to hide the map from <code><funclink>NO_OWNER</funclink></code> viewports (e.g. observers not following a player in network rounds)</col>
</row>
</table>
</text>
<text>

View File

@ -27,11 +27,6 @@
<col>int player, int x, int y, object base, int team, id extra_data</col>
<col>Called after when a new player joins the game. At this point, the clonks, materials, structures etc. are already placed at the position given in the <emlink href="scenario/scenario.html#SektionenPlayer1Player2Player3Player4">Scenario.txt</emlink>. <code>x</code> and <code>y</code> specify the starting position of the player, <code>base</code> is the player's base (if any), <code>team</code> denotes the team of the player. For <code>extra_data</code>, see <funclink>CreateScriptPlayer</funclink></col>
</row>
<row id="InitializePlayers">
<literal_col>InitializePlayers</literal_col>
<col></col>
<col>Called after all initial players joined. Can be used e.g. to start intros.</col>
</row>
<row id="RelaunchPlayer">
<literal_col>RelaunchPlayer</literal_col>
<col>int player, int killed_by_player</col>
@ -76,12 +71,6 @@
<col>int player</col>
<col>Called when the wealth of a player has changed.</col>
</row>
<row id="InitializeAmbience">
<literal_col>InitializeAmbience</literal_col>
<col></col>
<col>Called on game initialization in Frame zero (i.e. not in savegames). To be used to create sound and music controller objects. If not defined and Objects.ocd is loaded, falls back to a global function defined in Ambience.ocd which creates the default ambience controller.</col>
</row>
</table>
</text>

View File

@ -9,26 +9,10 @@
<text>With #appendto, you can modify an existing object defintion script without changing the original file. For example, a scenario could change flints to cause bigger explosions, without having to duplicate the entire flint in the scenario.</text>
<h id="Syntax">Declaration</h>
<code>#appendto [id]</code>
<text>A script can append itself to one or multiple existing scripts using the <code>#appendto</code> directive. Such script needs to be placed in System.ocg directory. Functions of the same name will overload functions in the target script. The original overloaded functions can still be called using <emlink href="script/fn/inherited.html">inherited</emlink>. #included scripts are not appended with #append, but #appended scripts are included by #include.</text>
<text>A script can append itself to one or multiple existing scripts using the <code>#appendto</code> directive. Functions of the same name will overload functions in the target script. The original overloaded functions can still be called using <emlink href="script/fn/inherited.html">inherited</emlink>. #included scripts are not appended with #append, but #appended scripts are included by #include.</text>
<code>#appendto *</code>
<text>Appending to <code>*</code> will append this script to all definitions.</text>
<text>A script can contain multiple #appendto directives. It is always compiled with the original script. This is of interest whenever local variables or functions from the appended script are used.</text>
<h id="Example">Example</h>
<code>#appendto WindBag
// This function will be "overwritten" in the original windbag.
// You can however call the original function by calling <funclink>_inherited</funclink>(...)
// You'll find this quite often in other scenarios. Just take a look at other
// scenarios that contain a System.ocg folder.
func FxIntReloadTimer(object target, proplist effect)
{
// Make the windbag reload faster.
var old_fill = fill_amount;
var ret = <funclink>inherited</funclink>(target, effect, ...);
if (fill_amount > old_fill)
fill_amount += (fill_amount - old_fill) * 5;
return ret;
}</code>
</part>
<author>Sven2</author><date>2002-04</date>
<author>matthes</author><date>2004-06</date>

View File

@ -1,288 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Diagnostic Messages</title>
<h>Diagnostic Messages</h>
<part>
<text>
Certain constructs may be flagged by the engine as potentially
unintended or deprecated. In these cases, the engine will, by default,
emit a warning to the log file.
</text>
<text>
On occasion, these constructs are in fact intended by the script
author. In order to avoid unwanted warning messages hiding more important
messages, the engine supports selectively suppressing a warning category
for parts of a script.
</text>
</part>
<part>
<text>
Suppression and re-enablement is handled by the <code>#warning</code>
directive. The directive must be placed on a separate line.
</text>
<text>Warnings can be controlled using this syntax:</text>
<code>#warning {enable|disable} [warning_category [warning_category...]]</code>
<text>
If no category is given, the engine will suppress or enable all messages,
including those that are not enabled by default. A category remains
disabled or enabled until the next directive that affects it, or until
the end of the script. A script linked to via the <code>#include</code>
or <code>#appendto</code> directives does not affect, and is itself not
affected by, the warning settings of the current script.
</text>
<text>
It is not an error to specify a category that does not exist; the
invalid category is simply ignored. No separate warning is emitted.
</text>
</part>
<part>
<h>Warning Categories</h>
<text>The following warning categories currently exist:</text>
<table>
<rowh>
<col>Category</col>
<col>Description</col>
</rowh>
<row>
<col>invalid_escape_sequence</col>
<col>
<text>
The engine found an escape sequence inside a string that it
did not recognize.
</text>
<part><code>"\p"</code></part>
</col>
</row>
<row>
<col>invalid_hex_escape</col>
<col>
<text>
The engine found the start of a hexadecimal escape sequence
inside a string, but no hexadecimal digits followed it.
</text>
<part><code>"\xGN"</code></part>
</col>
</row>
<row>
<col>type_name_used_as_par_name</col>
<col>
<text>
A function parameter was declared without an explicit type
specification, but with a name that is the same as a built-in type.
</text>
<part><code>func f(array)</code></part>
<text>
This warning is not enabled by default.
<a href="#fn1" title="The warning may be enabled by default in a future version.">¹</a>
</text>
</col>
</row>
<row>
<col>empty_parameter_in_call</col>
<col>
<text>
In a function call, a parameter was left empty. The engine is
passing <code>nil</code> in its place.
</text>
<part><code><funclink>CreateObject</funclink>(Clonk,, 30, 100);</code></part>
<text>
This warning is not enabled by default.
<a href="#fn1" title="The warning may be enabled by default in a future version.">¹</a>
</text>
</col>
</row>
<row>
<col>empty_parameter_in_array</col>
<col>
<text>
In an array literal, an entry was left empty. The engine is
using <code>nil</code> in its place.
</text>
<part><code>[1, 2,, 3, 4]</code></part>
<text>
This warning is not enabled by default.
<a href="#fn1" title="The warning may be enabled by default in a future version.">¹</a>
</text>
</col>
</row>
<row>
<col>implicit_range_loop_var_decl</col>
<col>
<text>
The loop variable of a for-in loop was not declared either in the
loop header itself nor in the containing function. This is only
accepted for backwards compatibility and may be removed in a
future release. Explicitly declare the variable by adding the
<code>var</code> keyword.
</text>
<part>
<code>func f() {
&#9;for (i in [1, 2, 3]) {
&#9;}
}</code>
</part>
</col>
</row>
<row>
<col>non_global_var_is_never_const</col>
<col>
<text>
A variable has been declared as <code>const</code>, but is not
global. At this time, non-global variables are always mutable.
</text>
<part>
<code>const local a = {}</code>
</part>
</col>
</row>
<row>
<col>variable_shadows_variable</col>
<col>
<text>
The declaration of a variable uses the same name as a variable
in a greater scope. Changes to the shadowing variable will not
affect the shadowed variable.
</text>
<part>
<code>static foo;
func f() {
&#9;var foo = 3;
}</code>
</part>
</col>
</row>
<row>
<col>redeclaration</col>
<col>
<text>
A variable has been redeclared in the same scope. Make sure
you do not accidentally overwrite values another part of the
code relies upon.
</text>
<part>
<code>func f() {
&#9;var i;
&#9;var i;
}</code>
</part>
</col>
</row>
<row>
<col>variable_out_of_scope</col>
<col>
<text>
A variable has been used outside of the block it has been
declared in. This is accepted only for backwards compatibility
and may be removed in a future release.
</text>
<part>
<code>func f(a) {
&#9;i = 0;
&#9;if (a) {
&#9;&#9;var i = 1;
&#9;}
&#9;return i;
}</code>
</part>
</col>
</row>
<row>
<col>undeclared_varargs</col>
<col>
<text>
Use of <code><funclink>Par</funclink></code> inside a function
implicitly declares it as using a variable number of arguments.
This is not immediately obvious to callers of the function, and
should be explicitly declared in the function signature by
adding a final <code>...</code> parameter.
</text>
<part>
<code>func f(a) {
&#9;return <funclink>Par</funclink>(a);
}
// Better:
func g(a, ...) {
&#9;return <funclink>Par</funclink>(a);
}</code>
</part>
</col>
</row>
<row>
<col>arg_count_mismatch</col>
<col>
<text>
A function call passes more parameters than the function will
accept.
</text>
<part>
<code><funclink>GetDir</funclink>(0)</code>
</part>
</col>
</row>
<row>
<col>arg_type_mismatch</col>
<col>
<text>
The parameter given in a function call is of a different type
than the called function expects. The call will likely fail at
runtime.
</text>
<part>
<code><funclink>Sin</funclink>("huh?")</code>
</part>
</col>
</row>
<row>
<col>empty_if</col>
<col>
<text>
An <code>if</code> conditional is controlling an empty statement.
Use the empty block <code>{}</code> if this is intentional, or
remove the conditional entirely.
</text>
<part>
<code>if (true);</code>
</part>
</col>
</row>
<row>
<col>suspicious_assignment</col>
<col>
<text>
An assignment was found where an expression was expected. While
an assignment returns its own value, usually a comparison was
intended instead.
</text>
<part>
<code>if (a = b + 1) { /* Do something */}</code>
</part>
<text>
If the assignment is intentional, make this more obvious by
extracting it to a separate statement, or explicitly handle the
boolean conversion by adding a comparison operator.
</text>
</col>
</row>
</table>
</part>
<part>
<h>Examples</h>
<examples>
<example>
<code>func f(string s) {
&#9;Sin(s);&#x9;// WARNING: parameter 0 of call to 'Sin' passes string (int expected)
#warning disable arg_type_mismatch
&#9;Sin(s);
#warning enable arg_type_mismatch
&#9;Sin(s);&#x9;// WARNING: parameter 0 of call to 'Sin' passes string (int expected)
}</code>
</example>
</examples>
</part>
<a id="fn1" style="font-size: smaller; color: inherit;">¹ The warning may be enabled by default in a future version.</a>
</doc>

View File

@ -51,8 +51,7 @@ func Destruction()
<text>The magic spell object exists until the spell has ended and then makes the clonk visible again. Also, if the spell object is deleted for other reasons (e.g. a scenario section change), the clonk is made visible in the Destruction callback (if this wasn't so, the clonk would remain invisible for ever). Also there is a Timer (defined in the DefCore) called every second. Notice you couldn't just have a single timer call to mark the end of the spell because timer intervals are marked in the engine beginning with the start of the round and you wouldn't know at what point within an engine timer interval the spell would start.</text>
<text>However, there are some problems with this implementation: for example, the magician can not cast a second invisibility spell while he's already invisible - the second spell would have practically no effect, because the end of the first spell would make the clonk visible again. The spell script would have to do some special handling for this case - but not only for multiple invisibility spells, but also for any other spell or script that might affect visibility or coloration of the clonk. Even if this spell would remember the previous value e.g. for coloration it could not handle a situation in which other scripts change the color of their own in the middle of the spell. The same problems occur when multiple scripts modify temporary clonk physcials such as jumping, walking speed, fight strength or visibility range, energy, magic energy etc. Using effects, these conflicts can be avoided.</text>
<h id="Usage">Application</h>
<text>Effects are created using <funclink>CreateEffect</funclink> and removed with <funclink>RemoveEffect</funclink>. If an effect was successfully created, the callback <emlink href="script/Effects.html#Construction">Construction</emlink> is made. Depending on the parameters, there can also be an <emlink href="script/Effects.html#TimerCallback">Timer</emlink> call for continuous activity such as casting sparks, adjusting energy etc. Finally, when the effect is deleted, the callback <emlink href="script/Effects.html#Destruction">Destruction</emlink> is made.</text>
<text>Now, the invisibility spell implemented using effects:</text>
<text>Effects are created using <funclink>AddEffect</funclink> and removed with <funclink>RemoveEffect</funclink>. If an effect was successfully created, the callback Fx*Start is made (* is replaced with the effect name). Depending on the parameters, there can also be an Fx*Timer call for continuous activity such as casting sparks, adjusting energy etc. Finally, when the effect is deleted, the callback Fx*Stop is made. Now, the invisibility spell implemented using effects:</text>
<code>/* Invisibility spell with effect system */
// visibility - previous visibility
@ -60,86 +59,92 @@ func Destruction()
func Activate(object caster, object caster2)
{
// get caster
if (caster2) caster = caster2;
// get caster
if (caster2) caster = caster2;
// start effect
caster-><funclink>CreateEffect</funclink>(InvisPSpell, 200, 1111);
// done - the spell object is not needed anymore
<funclink>RemoveObject</funclink>();
return true;
// start effect
<funclink>AddEffect</funclink>(&quot;InvisPSpell&quot;, caster, 200, 1111, nil, GetID());
// done - the spell object is not needed anymore
<funclink>RemoveObject</funclink>();
return true;
}
local InvisPSpell = new Effect {
Start = func() {
// Save the casters previous visibility
this.visibility = Target.Visibility;
this.old_mod = Target-&gt;<funclink>GetClrModulation</funclink>();
// Make the caster invisible
Target.Visibility = <funclink>VIS_Owner</funclink> | <funclink>VIS_Allies</funclink> | <funclink>VIS_God</funclink>;
// Semitransparent and slightly blue for owner and allies
Target-&gt;SetClrModulation(<funclink>ModulateColor</funclink>(this.old_mod, RGBa(127,127,255,127)));
},
Stop = func() {
// restore previous values
Target-&gt;<funclink>SetClrModulation</funclink>(this.old_mod);
Target.Visibility = this.visibility;
}
func FxInvisPSpellStart(object target, proplist effect)
{
// Save the casters previous visibility
effect.visibility = target.Visibility;
effect.old_mod = target-&gt;<funclink>GetClrModulation</funclink>();
// Make the caster invisible
target.Visibility = <funclink>VIS_Owner</funclink> | <funclink>VIS_Allies</funclink> | <funclink>VIS_God</funclink>;
// Semitransparent and slightly blue for owner and allies
target-&gt;SetClrModulation(<funclink>ModulateColor</funclink>(effect.old_mod, RGBa(127,127,255,127)));
// Fertig
return true;
}
func FxInvisPSpellStop(object target, proplist effect)
{
// restore previous values
target-&gt;<funclink>SetClrModulation</funclink>(effect.old_mod);
target.Visibility = effect.visibility;
// done
return true;
}</code>
<text>In this case, the magic spell object only starts the effect, then deletes itself immediately. The engine ensures that there are no conflicts with multiple effects modifying the visibility: effects are stored in a stack which ensures that effects are always removed in the opposite order of their addition. For this, there are a couple of extra Start and Stop calls to be made which are explained in detail later.</text>
<text>This effects does not have a timer function. It does, however, define a timer interval of 1111 which will invoke the standard timer function after 1111 frames which will delete the effect. Alternatively, you could define a timer function as such:</text>
<code>Timer = func()
<code>func FxInvisPSpellTimer()
{
// return value of -1 means that the effect should be removed
return -1;
// return value of -1 means that the effect should be removed
return -1;
}</code>
<text>To store the previous status of the target object, properties of the effect are used. This way effects are independant of other objects and effects - remember that the magic spell object which has created the effect is already deleted. If you need to call functions in the context of the target object or other objects, use <code>-></code>.</text>
<text>To store the previous status of the target object, properties of the effect are used. This is necessary because in this case the effect callbacks do not have any object script context. So you cannot access any object local variables in the effect callbacks - remember that the magic spell object which has created the effect is already deleted. If you require an object context in the effect callbacks you can specify one in <funclink>AddEffect</funclink>(). In that case, effect callbacks would be in object local context and the effect would automatically be deleted if the target object is destroyed.</text>
<h id="Priorities">Priorities</h>
<text>When creating an effect you always specify a priority value which determines the effect order. The engine ensures that effects with lower priority are added before effects with a higher priority - even if this means deleting an existing effect of higher priority. So if one effect colors the clonk green and another colors the clonk red, the result will be that of the effect with higher priority. If two effects have the same priority, the order is undefined. However, it is guaranteed that effects added later always notify the <code>Effect</code> callback of the same priority.</text>
<text>In the case of the red and green color, one effect could also determine the previous coloring and then mix a result using ModulateColor. But priorities also have another function: an effect of higher priority can prevent the addition of other effects of lower priority. This is done through the <code>Effect</code> callback. If any existing effect reacts to this callback with the return value -1, the new effect is not added (the same applies to the Start callback of the effect itself). Here an example:</text>
<text>When creating an effect you always specify a priority value which determines the effect order. The engine ensures that effects with lower priority are added before effects with a higher priority - even if this means deleting an existing effect of higher priority. So if one effect colors the clonk green and another colors the clonk red, the result will be that of the effect with higher priority. If two effects have the same priority, the order is undefined. However, it is guaranteed that effects added later always notify the Fx*Effect callback of the same priority.</text>
<text>In the case of the red and green color, one effect could also determine the previous coloring and then mix a result using ModulateColor. But priorities also have another function: an effect of higher priority can prevent the addition of other effects of lower priority. This is done through the Fx*Effect callback. If any existing effect reacts to this callback with the return value -1, the new effect is not added (the same applies to the Start callback of the effect itself). Here an example:</text>
<code>/* Spell of immunity against fire */
func Activate(object caster, object caster2)
{
// get caster
if (caster2) caster = caster2;
// get caster
if (caster2) caster = caster2;
// start effect
caster-><funclink>CreateEffect</funclink>(BanBurnPSpell, 180, 1111);
// start effect
<funclink>AddEffect</funclink>(&quot;BanBurnPSpell&quot;, caster, 180, 1111, nil, GetID());
// done - the spell object is not needed anymore
<funclink>RemoveObject</funclink>();
return true;
// done - the spell object is not needed anymore
<funclink>RemoveObject</funclink>();
return true;
}
local BanBurnPSpell = new Effect {
Construction = func()
{
// On start of the effect: extinguish clonk
Target-&gt;<funclink>Extinguish</funclink>();
},
Effect = func(string new_name)
{
// block fire
if (<funclink>WildcardMatch</funclink>(new_name, &quot;*Fire*&quot;)) return -1;
// everything else is ok
return 0;
}
};</code>
<text>This effect makes the clonk fire-proof for 30 seconds. The effect is implemented without any Timer or Stop callbacks as the complete functionality is achieved by simply blocking other effects which might have "Fire" as part of their name. This especially applies to the engine internal fire which has exactly the name "Fire". Of course, you could still add a Timer callback for graphic effects so the player can see that his clonk is immune. Also, you could create special visual effects when preventing incineration in <code>Effect</code>. For the like:</text>
<code>[...]
Effect = func(string new_name, var1, var2, var3, var4)
func FxBanBurnPSpellStart(object target, proplist effect, bool temporary)
{
// only handle fire
if (!<funclink>WildcardMatch</funclink>(new_name, &quot;*Fire*&quot;)) return 0;
// with fire, the three extra parameters have the following meaning:
// var1: caused_by - player that is responsible for the fire
// var2: blasted - bool: if the fire has been created by an explosion
// var3: burning_object - object: incineratable object
// extinguish burning object
if (var3 &amp;&amp; <funclink>GetType</funclink>(var3) == <funclink>C4V_C4Object</funclink>) var3-&gt;<funclink>Extinguish</funclink>();
// block fire
return -1;
// On start of the effect: extinguish clonk
if (!temporary) target-&gt;<funclink>Extinguish</funclink>();
return true;
}
func FxBanBurnPSpellEffect(string new_name)
{
// block fire
if (<funclink>WildcardMatch</funclink>(new_name, &quot;*Fire*&quot;)) return -1;
// everything else is ok
return 0;
}</code>
<text>This effect makes the clonk fire-proof for 30 seconds. The effect is implemented without any Timer or Stop callbacks as the complete functionality is achieved by simply blocking other effects which might have "Fire" as part of their name. This especially applies to the engine internal fire which has exactly the name "Fire". Of course, you could still add a Timer callback for graphic effects so the player can see that his clonk is immune. Also, you could create special visual effects when preventing incineration in FxBanBurnPSpellEffect. For the like:</text>
<code>[...]
func FxBanBurnPSpellEffect(string new_name, object target, proplist effect, var1, var2, var3)
{
// only handle fire
if (!<funclink>WildcardMatch</funclink>(new_name, &quot;*Fire*&quot;)) return 0;
// with fire, the three extra parameters have the following meaning:
// var1: caused_by - player that is responsible for the fire
// var2: blasted - bool: if the fire has been created by an explosion
// var3: burning_object - object: incineratable object
// extinguish burning object
if (var3 &amp;&amp; <funclink>GetType</funclink>(var3) == <funclink>C4V_C4Object</funclink>) var3-&gt;<funclink>Extinguish</funclink>();
// block fire
return -1;
}</code>
<text>This would even delete all burning objects which would otherwise incinerate the target object. The type check for var3 avoids possible conflicts with other "Fire" effects that might have differing parameters. Obviously, conflict situations like this should be avoided at all cost.</text>
<text>The following table contains general guidelines for priorities in effects of the original pack:</text>
@ -205,44 +210,44 @@ Effect = func(string new_name, var1, var2, var3, var4)
func Activate(object caster, object caster2)
{
// get caster
if (caster2) caster = caster2;
// get caster
if (caster2) caster = caster2;
// start effect
caster-><funclink>CreateEffect</funclink>(ReincarnationPSpell, 180, 0);
// done - the spell object is not needed anymore
<funclink>RemoveObject</funclink>();
return true;
// start effect
<funclink>AddEffect</funclink>(&quot;ReincarnationPSpell&quot;, caster, 180, 0, nil, GetID());
// done - the spell object is not needed anymore
<funclink>RemoveObject</funclink>();
return true;
}
local ReincarnationPSpell = new Effect {
Construction = func() {
// Only at the first start: message
Target-&gt;<funclink>Message</funclink>(&quot;%s gets an extra life&quot;, Target-&gt;<funclink>GetName</funclink>());
return true;
},
func FxReincarnationPSpellStart(object target, proplist effect, bool temporary)
{
// Only at the first start: message
if (!temporary) target-&gt;<funclink>Message</funclink>(&quot;%s gets an extra life&quot;, target-&gt;<funclink>GetName</funclink>());
return true;
}
func Stop(int reason, bool temporary) {
// only when the clonk died
if (reason != 4) return true;
// the clonk has already been resurrected
if (Target-&gt;<funclink>GetAlive</funclink>()) return -1;
// resurrect clonk
Target-&gt;<funclink>SetAlive</funclink>(true);
// give energy
Target-&gt;<funclink>DoEnergy</funclink>(100);
// message
Target-&gt;<funclink>Message</funclink>(&quot;%s has been resurrected.&quot;, Target-&gt;<funclink>GetName</funclink>());
func FxReincarnationPSpellStop(object target, proplist effect, int reason, bool temporary)
{
// only when the clonk died
if (reason != 4) return true;
// the clonk has already been resurrected
if (target-&gt;<funclink>GetAlive</funclink>()) return -1;
// resurrect clonk
target-&gt;<funclink>SetAlive</funclink>(true);
// give energy
target-&gt;<funclink>DoEnergy</funclink>(100);
// message
target-&gt;<funclink>Message</funclink>(&quot;%s has been resurrected.&quot;, target-&gt;<funclink>GetName</funclink>());
// remove
return true;
}
};</code>
// remove
return true;
}</code>
<text>This effect reanimates the clonk as many times as he has cast the reanimation spell.</text>
<h id="GlobalEffects">Global Effects</h>
<text>There are two global effect types: Scenerio effects and global effects. They are bound to the <code>Scenario</code> and <code>Global</code> proplists. With these effects, too, priorities are observed and temporary Add/Remove calls might be necessary to ensure order.</text>
<text>Global effects are effects that are not bound to any target object. With global effects, too, priorities are observed and temporary Add/Remove calls might be necessary to ensure order. Simply imagine all global effects are attached to an imaginary object. Global effects are accessed whenever you specify <code>nil</code> for the target object.</text>
<text>This can be used to make changes to gravity, sky color, etc. Here's an example for a spell that temporarily reduces gravity and then resets the original value:</text>
<code>/* Gravitation spell */
@ -328,39 +333,34 @@ func FxGravChangeUSpellAdd(object target, proplist effect, string new_name, int
<table>
<caption id="PropertiesTable">Effect Properties</caption>
<rowh>
<col>Name</col>
<col>Data type</col>
<col>Name</col>
<col>Description</col>
</rowh>
<row>
<col><code>Name</code></col>
<col>string</col>
<col><code>Name</code></col>
<col>Can be changed.</col>
</row>
<row>
<col><code>Priority</code></col>
<col>int</col>
<col><code>Priority</code></col>
<col>See <a href="Priorities">Priorities</a></col>
</row>
<row>
<col><code>Interval</code></col>
<col>int</col>
<col><code>Interval</code></col>
<col>Of the <a href="#TimerCallback">Timer callback</a>.</col>
</row>
<row>
<col><code>Time</code></col>
<col>int</col>
<col><code>Time</code></col>
<col>The age of the effect in frames, used for the <a href="#TimerCallback">Timer callback</a>. Can be changed.</col>
</row>
<row>
<col>proplist</col>
<col><code>CommandTarget</code></col>
<col>proplist</col>
<col><code>nil</code> when created by <funclink>CreateEffect</funclink>, as the effect gets the callbacks itself. When created by <funclink>AddEffect</funclink> either the command object or the command definition, depending on which is used.</col>
</row>
<row>
<col><code>Target</code></col>
<col>proplist</col>
<col>The object the effect belongs to, or the proplists <code>Scenario</code> or <code>Global</code> for scenario and global effects.</col>
<col>Either the command object or the command definition, depending on which is used.</col>
</row>
</table>
<h id="UserCallbacks">User Defined Properties</h>
@ -488,19 +488,19 @@ global func FxExplodeOnDeathCurseStop(object target, proplist effect, int reason
</row>
</table>
</text>
<text>Effect names are case sensitive. Also, you should avoid using any of these identifiers in your effect names if your effect doesn't have anything to do with them.</text>
<text>Warning: as function names may not be more than 100 characters in length (and you will lose oversight eventually), you should not stuff too much information into the effect name. Effect names are case sensitive. Also, you should avoid using any of these identifiers in your effect names if your effect doesn't have anything to do with them.</text>
<h id="CBRef">Callback Reference</h>
<part>
<text>The following callbacks are made by the engine and should be implemented in your effect prototype as necessary.</text>
<h>Start</h>
<text><code>int Start (int temporary, any var1, any var2, any var3, any var4);</code></text>
<text>Called at the start of the effect. <code>this</code> is the effect itself. It can be used to manipulate the effect, for example with <code>this.Interval=newinterval</code>.</text>
<text>The following callbacks are made by the engine and should be implemented in your script according to necessity. * is to be replaced by your effect name.</text>
<h>Fx*Start</h>
<text><code>int Fx*Start (object target, proplist effect, int temporary, any var1, any var2, any var3, any var4);</code></text>
<text>Called at the start of the effect. target is the target object of the effect. <code>effect</code> is the effect itself. <code>effect</code> can be used to manipulate the effect, for example with <code>effect.Interval=newinterval</code>.</text>
<text>In normal operation the parameter temporary is 0. It is 1 if the effect is re-added after having been temporarily removed and 2 if the effect was temporarily removed and is now to be deleted (in this case a Remove call will follow).</text>
<text>If temporary is 0, var1 to var4 are the additional parameters passed to <funclink>CreateEffect</funclink>().</text>
<text>If temporary is 0 and this callback returns -1 the effect is not created and the corrsponding <funclink>CreateEffect</funclink>() call returns <code>nil</code>.</text>
<h>Stop</h>
<text><code>int Stop (int reason, bool temporary);</code></text>
<text>When the effect is temporarily or permanently removed. <code>this</code> is the effect itself.</text>
<text>If temporary is 0, var1 to var4 are the additional parameters passed to <funclink>AddEffect</funclink>().</text>
<text>If temporary is 0 and this callback returns -1 the effect is not created and the corrsponding <funclink>AddEffect</funclink>() call returns 0.</text>
<h>Fx*Stop</h>
<text><code>int Fx*Stop (object target, proplist effect, int reason, bool temporary);</code></text>
<text>When the effect is temporarily or permanently removed. target again is the target object and <code>effect</code> the effect itself.</text>
<text>reason contains the cause of the removal and can be one of the following values:</text>
<text>
<table>
@ -537,34 +537,26 @@ global func FxExplodeOnDeathCurseStop(object target, proplist effect, int reason
</table>
</text>
<text>The effect can prevent removal by returning -1. This will not help, however, in temporary removals or if the target object has been deleted.</text>
<h id="FxConstructionCallback">Construction</h>
<text><code>int Construction (any var1, any var2, any var3, any var4);</code></text>
<text>Called when the effect is first created, before it is started. The parameters <code>var1</code> to <code>var4</code> are passed through from <funclink>CreateEffect</funclink>.</text>
<text>The return value is ignored.</text>
<h id="FxDestructionCallback">Destruction</h>
<text><code>nil Destruction (int reason);</code></text>
<text>Callback when the effect is removed. <code>reason</code> is the same as in the preceding <code>Stop</code> call, see above.</text>
<text>The return value is ignored.</text>
<h id="TimerCallback">Timer</h>
<text><code>int Timer (int time);</code></text>
<text>Periodic timer call, if a timer interval has been specified at effect creation.</text>
<h id="TimerCallback">Fx*Timer</h>
<text><code>int Fx*Timer (object target, proplist effect, int time);</code></text>
<text>Periodic timer call, if a timer interval has been specified at effect creation. target and <code>effect</code> as usual.</text>
<text>time specifies how long the effect has now been active. This might alternatively be determined using effect.Time.</text>
<text>If this function is not implemented or returns -1, the effect will be deleted after this call.</text>
<h>Effect</h>
<text><code>int Effect (string new_name, any var1, any var2, any var3, any var4);</code></text>
<text>A call to all effects of higher priority if a new effect is to be added to the same target object. new_name is the name of the new effect; <code>this</code> is the effect being called.</text>
<h>Fx*Effect</h>
<text><code>int Fx*Effect (string new_name, object target, proplist effect, any var1, any var2, any var3, any var4);</code></text>
<text>A call to all effects of higher priority if a new effect is to be added to the same target object. new_name is the name of the new effect; <code>effect</code> is the effect being called.</text>
<text>Warning: the new effect is not yet properly initialized and should not be manipulated in any way. Especially the priority field might not yet have been set.</text>
<text>This function can return -1 to reject the new effect. As the new effect might also be rejected by other effects, this callback should not try to add effects or similar (see gravitation spell). Generally you should not try to manipulate any effects during this callback.</text>
<text>Return -2 or -3 to accept the new effect. As long as the new effect is not rejected by any other effect, the <code>Add</code> call is then made to the accepting effect, the new effect is not actually created, and the calling <funclink>CreateEffect</funclink> function returns the accepting effect. The return value -3 will also temporarily remove all higher prioriy effects just before the <code>Add</code> callback and re-add them later.</text>
<text>var1 bis var4 are the parameters passed to <funclink>CreateEffect</funclink>()</text>
<h>Add</h>
<text><code>int Add (string new_name, int new_timer, any var1, any var2, any var3, any var4);</code></text>
<text>Callback to the accepting effect if that has returned -2 or -3 to a prior <code>Effect</code> call. <code>this</code> identifies the accepting effect to which the consequences of the new effect will be added.</text>
<text>Return -2 or -3 to accept the new effect. As long as the new effect is not rejected by any other effect, the Fx*Add call is then made to the accepting effect, the new effect is not actually created, and the calling AddEffect function returns the effect index of the accepting effect. The return value -3 will also temporarily remove all higher prioriy effects just before the Fx*Add callback and re-add them later.</text>
<text>var1 bis var4 are the parameters passed to <funclink>AddEffect</funclink>()</text>
<h>Fx*Add</h>
<text><code>int Fx*Add (object target, proplist effect, string new_name, int new_timer, any var1, any var2, any var3, any var4);</code></text>
<text>Callback to the accepting effect if that has returned -2 or -3 to a prior Fx*Effect call. <code>effect</code> identifies the accepting effect to which the consequences of the new effect will be added; target is the target object (0 for global effects).</text>
<text>new_timer is the timer interval of the new effect; var1 to var4 are the parameters from AddEffect. Notice: in temporary calls, these parameters are not available - here they will be 0.</text>
<text>If -1 is returned, the accepting effect is deleted also. Logically, the calling <funclink>CreateEffect</funclink> function will then return <code>nil</code>.</text>
<h>Damage</h>
<text><code>int Damage (int damage, int cause, int by_player);</code></text>
<text>Every effect receives this callback whenever the energy or damage value of the target object is to change. If the function is defined, it should then return the damage to be done to the target.</text>
<text>If -1 is returned, the accepting effect is deleted also. Logically, the calling AddEffect function will then return -2.</text>
<h>Fx*Damage</h>
<text><code>int Fx*Damage (object target, proplist effect, int damage, int cause);</code></text>
<text>Every effect receives this callback whenever the energy or damage value of the target object is to change. If the function is defined, it should then return whether to allow the change.</text>
<text id="damagecause">This callback is made upon life energy changes in living beings and damage value changes in non-livings - but not vice versa. cause contains the value change and reason:</text>
<text>
<table>
@ -647,7 +639,7 @@ global func FxExplodeOnDeathCurseStop(object target, proplist effect, int reason
<text>There are the following functions for manipulation of effects:</text>
<text>
<ul>
<li><funclink>CreateEffect</funclink>() - for effect creation</li>
<li><funclink>AddEffect</funclink>() - for effect creation</li>
<li><funclink>RemoveEffect</funclink>() - for effect removal</li>
<li><funclink>GetEffect</funclink>() - to search for effects</li>
<li><funclink>GetEffectCount</funclink>() - for effect counting</li>

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Fuzzy Logic library</title>
<h>Fuzzy Logic library</h>
<part>
<text>The fuzzy logic library, defined in Objects.ocd/Libraries.ocd/FuzzyLogic.ocd provides functionality for declaring and evaluating fuzzy logic rules and actions that can be used to deduce an action to be executed from some observations. For example, the fish uses fuzzy logic to navigate in a Clonk landscape while avoiding predators and heading towards food. To make the fuzzy logic functions available in a script, you need to include the library.</text>
<h>Creating a new fuzzy logic instance</h>
<text>The first step when working with the fuzzy logic library is to create a new instance and save it. All interface functions will be called on that instance later.</text>
<code>var fuzzy_logic = FuzzyLogic->Init();</code>
<text></text>
<h>Set definitions</h>
<code>fuzzy_logic->AddSet(string set_name, string textual_value, array [[int first_value, int assignment], [int second_value, int assignment], [int third_value, int assignment]]);</code>
<text>First you have to define on which sets (imagine them like <i>categories</i>) your logic should work. One set could e.g. be <b>temperature</b> and the values in the set could be <b>{low, medium, high}</b>.</text>
<text>You also have to specify what numerical values describe the textual values in the set best. For example, we could say that a temperature between -20 and 0 is clearly <b>low</b> and then slowly becomes less <b>low</b> until 20. The definition would look like this:</text>
<code>fuzzy_logic->AddSet("temperature", "low", [[-20, 1], [0, 1], [20, 0]]);</code>
<text>The <i>assignment</i> parameter specifies how strongly the value belongs to the set (0 or 1). Values that lie between the given three are interpolated.</text>
<text>Similarly, we can also add definitions for <b>medium</b> and <b>high</b>.</text>
<code>
fuzzy_logic->AddSet("temperature", "medium", [[0, 0], [20, 1], [40, 0]]);
fuzzy_logic->AddSet("temperature", "high", [[10, 0], [40, 1], [100, 1]]);
</code>
<text>In a similar way, you also have to add sets for your actions (as opposed to your observations, like the <b>temperature</b> above). To continue our example, we will create an automatic heater control that turns the heater higher when it's cold. Let's say the heater's power can go from 0 to 100. Then we could define the following set:</text>
<code>
fuzzy_logic->AddSet("heater", "full_power", [[80, 0], [100, 1], [100, 1]]);
fuzzy_logic->AddSet("heater", "a_little", [[10, 0], [30, 1], [40, 0]]);
fuzzy_logic->AddSet("heater", "off", [[0, 1], [0, 1], [10, 0]]);
</code>
<h>Rule definition</h>
<code>fuzzy_logic->AddRule(string/array condition, string result);</code>
<text>Now that we have defined our sets, we can also define rules that are based on those sets. A rule consists of one (or more) condition in the form of "&lt;set_name&gt;=&lt;textual_value&gt;" (e.g. "temperature=high") and exactly one resulting action in the same format (e.g. "heater=off"). There can be multiple different rules defined and the end result will take into account every definition. For our example above, we could define the rules as follows:</text>
<code>
fuzzy_logic->AddRule("temperature=low", "heater=full_power");
fuzzy_logic->AddRule("temperature=medium", "heater=a_little");
fuzzy_logic->AddRule("temperature=high", "heater=off");
</code>
<h>Rule operators</h>
<code>
fuzzy_logic->And(condition1, condition2);
fuzzy_logic->Or(condition1, condition2);
fuzzy_logic->Not(condition);
</code>
<text>A simple example like above would obviously be boring. We can also combine different conditions into one rule. Imagine we would also have defined the set <b>window</b> with the textual value of <b>open</b>. Then we could adjust our rules as follows:</text>
<code>fuzzy_logic->AddRule(fuzzy_logic->And("temperature=medium", fuzzy_logic->Not("window=open")), "heater=a_little");</code>
<h>Setting Values</h>
<code>fuzzy_logic->Fuzzify(string set, int value);</code>
<text>After we have defined all sets and rules, we need to provide values for our sets. The function <i>Fuzzify</i> calculates how much a value fits to the different textual values of a set (e.g. how much the value 15 belongs to the textual <b>temperature</b> value <b>low</b>). The <i>Fuzzify</i> function can be called an arbitrary amount of times before the next <i>Execute</i>.</text>
<code>
local fuzzy_logic;
private func Construction()
{
fuzzy_logic = FuzzyLogic->Init();
// Define sets and rules here...
// ...
// Update temperature every second.
AddTimer("UpdateTemperature", 30);
}
private func UpdateTemperature()
{
fuzzy_logic->Fuzzify("temperature", <funclink>GetTemperature</funclink>());
}
</code>
<h>Getting actions</h>
<code>proplist fuzzy_logic->Execute();</code>
<text>After having set all necessary values, the resulting actions according to the rules are calculated when calling <i>Execute</i>. The return value is a proplist with all the sets that occur in the rule definitions as results. The values of the sets are the calculated values from set definitions.</text>
<code>
// Called regularly!
private func ExecuteActions()
{
// Calculate the resulting actions from our fuzzified values.
var actions = fuzzy_logic->Execute();
// The properties in 'actions' are the numerical values here.
Log("Turning the heater to %d%%!", actions["heater"]);
}
</code>
</part>
<author>Zapper</author><date>2015-09</date>
</doc>

View File

@ -1,319 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Script GUIs</title>
<h>Script GUIs</h>
<part>
<text>Scripted GUIs can be used to create menus, HUD elements and scoreboards.</text>
<h>Properties</h>
<text>(For a detailed explanation and examples, see below.) Every window can be defined by the following properties, which can additionally be <emlink href="#tagsforproperties">tagged</emlink>:</text>
<table>
<rowh>
<col>Name</col>
<col>Data type</col>
<col>Example</col>
<col>Description</col>
</rowh>
<row>
<col>ID</col>
<col>int</col>
<col>2</col>
<col>The ID of the window. See <emlink href="#windowid">below</emlink>.</col>
</row>
<row>
<col>Target</col>
<col>object</col>
<col><funclink>GetCursor</funclink>(0)</col>
<col>The target of the window. See <emlink href="#windowid">below</emlink>.</col>
</row>
<row>
<col>Left</col>
<col>string</col>
<col>"0%" (default)</col>
<col>The left corner of the window. See <emlink href="#coordinates">below</emlink>.</col>
</row>
<row>
<col>Top</col>
<col>string</col>
<col>"0%" (default)</col>
<col>The top corner of the window. See <emlink href="#coordinates">below</emlink>.</col>
</row>
<row>
<col>Right</col>
<col>string</col>
<col>"100%" (default)</col>
<col>The right corner of the window. See <emlink href="#coordinates">below</emlink>.</col>
</row>
<row>
<col>Bottom</col>
<col>string</col>
<col>"100%" (default)</col>
<col>The bottom corner of the window. See <emlink href="#coordinates">below</emlink>.</col>
</row>
<row>
<col>Margin</col>
<col>array</col>
<col><em>["1em", "1em"]</em></col>
<col>Margin around the window; used for layouts. The order is [<em>left</em>, <em>top</em>, <em>right</em>, <em>bottom</em> and will wrap around. You can specify all margins by giving only one item (f.e. <em>["1em"]</em>) or the X and Y margins by giving two items (f.e. <em>["1em, "0em"]</em>).</col>
</row>
<row>
<col>BackgroundColor</col>
<col>int</col>
<col><funclink>RGBa</funclink>(255, 0, 0, 128)</col>
<col>Solid background color of the window. The value 0 means no background color.</col>
</row>
<row>
<col>Symbol</col>
<col>object/definition</col>
<col>Clonk</col>
<col>A symbol that will be drawn in the window. The symbol can be an object as well, in this case the current graphics and animations of that object will be drawn.</col>
</row>
<row>
<col>GraphicsName</col>
<col>string</col>
<col>"Infinite"</col>
<col>Only if Symbol is a definition: the name of the graphics to use.</col>
</row>
<row>
<col>Decoration</col>
<col>definition</col>
<col>GUI_MenuDeco</col>
<col>Menu decoration of the window. The menu decoration can be defined as for <funclink>CustomMessage</funclink>().</col>
</row>
<row>
<col>Text</col>
<col>string</col>
<col>"Hi there!"</col>
<col>Text that will be drawn in the window. The window's height will be adjusted to fit all the text</col>
</row>
<row>
<col>Tooltip</col>
<col>string</col>
<col>"Buy Loam"</col>
<col>Tooltip of the window.</col>
</row>
<row>
<col>Style</col>
<col>int</col>
<col>GUI_TextVCenter</col>
<col>Combination of style-flags. For possible values, see <emlink href="#styleflags">below</emlink>.</col>
</row>
<row>
<col>OnClick</col>
<col>array</col>
<col><funclink>GuiAction_Call</funclink>("GameOver")</col>
<col>Action that will be executed when the window is clicked, see <emlink href="#actions">below</emlink>.</col>
</row>
<row>
<col>OnMouseIn</col>
<col>array</col>
<col><funclink>GuiAction_SetTag</funclink>("Hover")</col>
<col>Action that will be executed when the cursor enters the window, see <emlink href="#actions">below</emlink>.</col>
</row>
<row>
<col>OnMouseOut</col>
<col>array</col>
<col><funclink>GuiAction_SetTag</funclink>("Std")</col>
<col>Action that will be executed when the cursor leaves the window, see <emlink href="#actions">below</emlink>.</col>
</row>
<row>
<col>OnClose</col>
<col>array</col>
<col><funclink>GuiAction_Call</funclink>("RemoveHelper")</col>
<col>Action that will be executed when the window is closed, see <emlink href="#actions">below</emlink>.</col>
</row>
<row>
<col>Priority</col>
<col>int</col>
<col>1000</col>
<col>Priority of the window that is used for layouts and for the drawing order. Higher number means higher priority.</col>
</row>
<row>
<col>Player</col>
<col>player number</col>
<col><funclink>GetOwner</funclink>()</col>
<col>If given, the window is only visible to this player. Note that the target object also restricts visibility.</col>
</row>
</table>
<text>All other properties are proplists that define sub-windows. You should use non-capital names (i.e. <em>header</em>, not <em>Header</em>) for your sub-windows.</text>
<text>The names of your sub-windows properties can also be used in updates when you want to update properties in both a parent window and a child window. Names starting with an underscore (e.g. <em>_child</em>) are anonymous. That means that they can not be referenced by their name later and will not be overwritten by an update that uses the same name again. This can be used to add several new windows later without having to care for duplicate names. For an example, see <funclink>GuiUpdate</funclink>().</text>
<h id="styleflags">Style Flags</h>
Every window can have a combination of style flags as the <em>Style</em> property.
<table>
<rowh>
<col>Name</col>
<col>Description</col>
</rowh>
<row>
<col>GUI_Multiple</col>
<col>Only one window without this flag will be shown at a time, can be used to show multiple HUD elements using the GUI.</col>
</row>
<row>
<col>GUI_TextVCenter</col>
<col>The text will be centered vertically.</col>
</row>
<row>
<col>GUI_TextHCenter</col>
<col>The text will be centered horizontally.</col>
</row>
<row>
<col>GUI_TextRight</col>
<col>The text will be aligned to the right.</col>
</row>
<row>
<col>GUI_TextLeft</col>
<col>Default. The text will be aligned to the left.</col>
</row>
<row>
<col>GUI_TextTop</col>
<col>Default. The text will be at the top.</col>
</row>
<row>
<col>GUI_TextBottom</col>
<col>The text will be at the bottom.</col>
</row>
<row>
<col>GUI_GridLayout</col>
<col>The sub-windows of this window will automatically be arranged in a grid.</col>
</row>
<row>
<col>GUI_TightGridLayout</col>
<col>Like GUI_GridLayout but might reorder items and lead to less empty space between sub-windows.</col>
</row>
<row>
<col>GUI_VerticalLayout</col>
<col>The sub-windows of this window will automatically be arranged vertically in a list.</col>
</row>
<row>
<col>GUI_FitChildren</col>
<col>The window will adjust its height to fit the sub-windows. No scroll-bar will be shown.</col>
</row>
<row>
<col>GUI_IgnoreMouse</col>
<col>No mouse-input will be used for this window. The window will not block mouse clicks to the landscape behind.</col>
</row>
<row>
<col>GUI_NoCrop</col>
<col>Children of this window may be drawn outside the window's bounds. Text in this window set with the <strong>Text</strong> property will not automatically be broken into multiple lines. Note that clipping is only performed for subwindows, not root windows.</col>
</row>
</table>
<text>For example multiple Style elements can be combined as: <em>Style = GUI_Multiple | GUI_TextVCenter | GUI_TextHCenter</em></text>
<h>The Window Concept</h>
<text>The whole menu system is basically just a way to display rectangles on the screen and react to events (clicks, mouse-over) that affect those rectangles. Every rectangle (now called <em>windows</em>) is defined by a proplist. Every property is either one of the attribute-properties which always start with a capital letter or defines a sub-window.</text>
<h id="windowid">A Window ID</h>
<text>For certain features, the scripter needs to be able to identify windows. This may be important to either react to events affecting certain windows or to update windows after the initial creation. Window IDs can be assigned using the property <strong>ID</strong>, but only <em>together</em> with the property <strong>Target</strong> (which stands for an ingame object) does an <strong>ID</strong> identify a window! This is important to allow the easy creation of menu libraries and pluggable-submenus which do not have to care for unique IDs that way. All callbacks coming from a window or updating a window will always take both a target and an ID. Aditionally, a window inherits the visibility of the target object and is destroyed when the target object is removed. Note that <em>nil</em> is a valid <strong>Target</strong> for all interactions. But if you are writing a library or a menu interface, you should consider giving your menus proper targets if they need to interact.</text>
<text>When you open your menu via <funclink>GuiOpen</funclink>() you get another ID, which is the ID of your root window that you cannot set yourself. You use that ID when you interact with the already opened GUI - for example when you want to close it, for an example see <funclink>GuiClose</funclink>().</text>
<h id="coordinates">Coordinates</h>
<text>A window can have four properties to define its position: <strong>Left</strong>, <strong>Top</strong>, <strong>Right</strong>, <strong>Bottom</strong>. The coordinates are given as strings in percent of the parent window. The properties Right and Bottom define the position of the right and bottom border of the window and not the width and height. The definition to have a window cover the right half of its parent would look as follows:</text>
<code>
func MakeMyMenu()
{
var menu =
{
Left = "50%",
Top = "0%",
Right = "100%",
Bottom = "100%",
...
};
var menu_id = <funclink>GuiOpen</funclink>(menu);
// I made up my mind, I'd rather not have a menu.
GuiClose(menu_id);
}
</code>
<text>While the relative positioning is prefered, windows can also have an absolute position that is added to the relative position. Imagine you would want to add fixed-size images below and on the left of the previous menu:</text>
<code>
func MakeMyMenu()
{
var menu =
{
Left = "50% + 3.5em",
Top = "0%",
Right = "100%",
Bottom = "100% - 3.5em",
...
};
GuiOpen(menu);
}
</code>
<text>The unit of the absolute values is in <em>em</em> - 1em is exactly the height of the font, so a text box of 2em height can always contain two lines of text. For both the relative and the absolute values, you can provide decimal numbers (f.e. <em>Left = "10.5321% - 1.3333em"</em>).</text>
<text>Especially if you need to do some math with the positions, there are some interesting helper functions defined for you in <strong>System.ocg/GUIs.c</strong>.</text>
<h>Positioning Example</h>
<text>Here is an example with a screenshot that details in what margins the given positions will result.</text>
<code>
func MakeMyMenu()
{
var menu =
{
Text = "I am the container!",
BackgroundColor = <funclink>RGB</funclink>(255, 255, 100),
rightbottom =
{
Text = "I am at the bottom right",
BackgroundColor = <funclink>RGB</funclink>(100, 255, 255),
Left = "25% + 6em",
Top = "25%", Bottom = "90%",
centerbottom =
{
Text = "I might be a text box",
BackgroundColor = <funclink>RGB</funclink>(255, 100, 255),
Left = "10%", Right = "90%",
Top = "100% - 5em", Bottom = "100%"
}
}
};
GuiOpen(menu);
}
</code>
<text><img src="../../images/GuiPositioning.jpg" width="829" height="561"/><br />The result of the example code above.</text>
<text>In the screenshot the GUI debugging info is activated, too. You can reach it via hitting CTRL+F7 multiple times.</text>
<h id="tagsforproperties">Tags for Properties</h>
<text>Nearly all properties can be tagged - that means they can be assigned different values for different <em>tags</em>. The default tag for every window is <em>Std</em>. To assign multiple values for different tags, just assign a proplist instead of the original property value, such as:</text>
<code>
BackgroundColor =
{
Std = <funclink>RGB</funclink>(255, 0, 0),
Hover = <funclink>RGB</funclink>(0, 255, 0)
}
</code>
<text>instead of <em>BackgroundColor = <funclink>RGB</funclink>(255, 0, 0)</em></text>
<text>To change the tag of a window use <funclink>GuiUpdateTag</funclink>() or <funclink>GuiAction_SetTag</funclink>(). When you change a tag, the change usually also affects the children of the window. Note that the window <strong>ID</strong> and <strong>Target</strong> can not be tagged.</text>
<h id="actions">Actions</h>
<text>To make the player able to interact with the windows, actions can be defined that are executed on a certain event. Possible events are for example <em>OnClick</em>, <em>OnMouseIn</em>, <em>OnMouseOut</em>. Possible actions are <funclink>GuiAction_Call</funclink>() and <funclink>GuiAction_SetTag</funclink>(). An example:</text>
<code>
func Initialize()
{
var menu =
{
BackgroundColor =
{
Std = 0,
Hover = <funclink>RGBa</funclink>(255, 0, 0, 200)
},
OnMouseIn = [<funclink>GuiAction_SetTag</funclink>("Hover"), <funclink>GuiAction_Call</funclink>(this, "Hovering", "I am a parameter")],
OnMouseOut = <funclink>GuiAction_SetTag</funclink>("Std"),
OnClick = <funclink>GuiAction_Call</funclink>(this, "ClickedMyMenu")
};
GuiOpen(menu);
}
func Hovering(data, int player, int ID, int subwindow_ID, object target)
{
Log("Player %d is hovering on my menu.", player);
Log("The custom parameter was: %s", data);
// output "The custom parameter was: I am a parameter"
}
func ClickedMyMenu(data, int player, int ID, int subwindow_ID, object target)
{
Log("Player %s clicked on my menu! Blowing up something..", <funclink>GetPlayerName</funclink>(player));
var clonk = <funclink>FindObject</funclink>(Find_OCF(OCF_Alive), <funclink>Find_Not</funclink>(Find_Owner(player)));
if (clonk) clonk-&gt;<funclink>Explode</funclink>(20);
}
</code>
</part>
<author>Zapper</author><date>2014-10</date>
</doc>

View File

@ -23,7 +23,7 @@ func InitializeMap(proplist map)
// Draw some resources into the ground
DrawWaterVeins(3, [0,map.Hgt/3,map.Wdt,map.Hgt*2/3]);
DrawCoal(6);
DrawFirestone(4);
DrawSulphur(4);
DrawRock(15);
DrawOre(4);
DrawGold(2*GetStartupPlayerCount()); // amount of gold depends on player count!
@ -53,7 +53,7 @@ Blit(layer, [0,0,layer.Wdt/2,layer.Hgt]);</code>
<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, Op=checkerboard};
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
@ -62,8 +62,8 @@ var copy_layer = Duplicate();
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>MAPALGO_Layer</h><part>
<text>Returns the pixel value at the x,y position of the given layer. Instead of passing a MAPALGO_Layer prop list, layers can also be passed directly as algorithms.</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>
@ -71,7 +71,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>The layer from which pixel values are taken.</col>
</row>
</table></text></part>
<h>MAPALGO_RndChecker</h><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>
@ -96,7 +96,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<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>MAPALGO_Rect</h><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>
@ -117,7 +117,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Height of rectangle.</col>
</row>
</table></text></part>
<h>MAPALGO_Ellipsis</h><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>
@ -138,7 +138,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Vertical radius of ellipsis</col>
</row>
</table></text></part>
<h>MAPALGO_Polygon</h><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>
@ -163,33 +163,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<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>MAPALGO_Lines</h><part>
<text>Returns one if the point is on regular stripes and zero otherwise.</text>
<text>Vector (X,Y) determines both width and direction of the stripes. So, for instance, if you want to draw vertical stripes of 10 pixels width and a gap of 5 pixels between them, you would set X=10, Y=0, Distance=15.</text>
<text><table><rowh><col>Parameter</col><col>Default</col><col>Meaning</col></rowh>
<row>
<col>X</col>
<col>0</col>
<col>X size of vector that points perpendicular to stripes.</col>
</row><row>
<col>Y</col>
<col>0</col>
<col>Y size of vector that points perpendicular to stripes.</col>
</row><row>
<col>OffX</col>
<col>0</col>
<col>Offset of stripes. If unspecified, stripes begin at (0,0).</col>
</row><row>
<col>OffY</col>
<col>0</col>
<col>Offset of stripes.</col>
</row><row>
<col>Distance</col>
<col>2*Sqrt(X*X+Y*Y)</col>
<col>Distance between two stripes. Includes the stripe width!</col>
</row>
</table></text></part>
<h>MAPALGO_And</h><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>
@ -198,7 +172,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Array of algorithms that are tested.</col>
</row>
</table></text></part>
<h>MAPALGO_Or</h><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>
@ -207,7 +181,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Array of algorithms that are tested.</col>
</row>
</table></text></part>
<h>MAPALGO_Not</h><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>
@ -216,7 +190,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Algorithms that is negated.</col>
</row>
</table></text></part>
<h>MAPALGO_Xor</h><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>
@ -225,7 +199,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Array of two algorithms that are tested.</col>
</row>
</table></text></part>
<h>MAPALGO_Offset</h><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>
@ -242,7 +216,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Vertical offset downwards.</col>
</row>
</table></text></part>
<h>MAPALGO_Scale</h><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>
@ -260,14 +234,14 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
</row><row>
<col>OffX</col>
<col>0</col>
<col>X position of fixed point that remains in position. Actual fixed point is translated left by -0.5 pixels to achieve proper pixel mapping.</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. Actual fixed point is translated up by -0.5 pixels to achieve proper pixel mapping.</col>
<col>Y position of fixed point that remains in position.</col>
</row>
</table></text></part>
<h>MAPALGO_Rotate</h><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>
@ -288,14 +262,10 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Y position of fixed point that remains in position.</col>
</row>
</table></text></part>
<h>MAPALGO_Turbulence</h><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>Op</col>
<col></col>
<col>Algorithms that is being manipulated.</col>
</row><row>
<col>Seed</col>
<col>Random(65536)</col>
<col>If nonzero, the offset map is generated from a fixed seed.</col>
@ -313,7 +283,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<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>MAPALGO_Border</h><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>
@ -342,7 +312,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<col>Border width downwards. Definition like Wdt. Falls back to Wdt if not specified.</col>
</row>
</table></text></part>
<h>MAPALGO_Filter</h><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>
@ -394,18 +364,13 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<row>
<col>Sky</col>
<col>Sky</col>
<col>Draws a sky material. Within the map generator, explicit sky is drawn as index 0xff, which is converted to index zero on map drawing. That way, sky can be blitted to other layers without being transparent.</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>
<row>
<col>FgMatTex:BgMatTex</col>
<col>Water:Tunnel-brickback</col>
<col>Draws with a specified background material. In the example, draws water which, when drained, exposes bricks instead of tunnel behind it. FgMatTex and BgMatTex can be any of the other specifications in this table, except the ones prefixed with ^. However, the specification FgMatTex:Sky is equivalent to ^FgMatTex.</col>
</row>
</table>
</text>
<h>Material-texture masks (string mask_spec)</h>
@ -430,7 +395,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<row>
<col>Sky</col>
<col>Sky</col>
<col>True for explicit sky material (0xff) only. Not true for transaprent (0) pixels.</col>
<col>True for explicit sky material (0x80) only. Not true for transaprent (0) pixels.</col>
</row>
<row>
<col>Transparent</col>
@ -455,7 +420,7 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<row>
<col>*</col>
<col>*</col>
<col>True for all materials, including sky.</col>
<col>True for all materials.</col>
</row>
<row>
<col>^Definition</col>
@ -492,16 +457,10 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
<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 GetDefaultBackgroundIndex(any col);</code></text>
<text>Returns the material-texture index of the default background color of the given color. It may be given either as string (mattex) or palette index.</text>
<text><code>int GetMaterialTextureIndex(string mattex);</code></text>
<text>Returns the material-texture index of the given string. Can be either "Sky", "Transparent", a material name, or a material-texture combination.</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>int GetBackPixel(int x, int y);</code></text>
<text>Gets the pixel color of the background material 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, any new_fg, any new_bg);</code></text>
<text>Sets the pixel and the background pixel at position x,y in this layer to new_fg and new_bg, respectively. Color may be given as string (mattex) or palette index. Use nil to keep foreground or background unchanged. Returns true on success.</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>

View File

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Shape library</title>
<h>Shape library</h>
<part>
<text>The shape library, defined in Objects.ocd/Libraries.ocd/Shape.ocd and available under the definition name Shape, provides functionality for defining 2D shapes typically used to address landscape areas e.g. for plant seed ranges, or search areas. For example, the <funclink>PlaceVegetation</funclink> engine function accepts a shape as an optional way to define the area in which vegetation should be placed. Shape coordinates are defined as-is and do not perform any coordinate transformation between global and object-local contexts.</text>
<h>Shape creation</h>
<text>Shape creation functions are public functions in the Shape definition. They return proplists with a common <a href="#interface">interface</a>. The following shapes can be created:</text>
<text></text>
<code>proplist Shape->Rectangle(int x, int y, int w, int h);</code>
<text>Represents a rectangular shape starting at point (x,y) with width w and height h. By definition, point (x,y) is included in the area while point (x+w,x+h) is not.</text>
<text></text>
<code>proplist Shape->Circle(int cx, int cy, int r);</code>
<text>Returns a circular shape around the center point (cx,cy) with radius r.</text>
<text></text>
<code>proplist Shape->Combine(proplist s1, proplist s2, ...);</code>
<text>Returns the shape that is a combination of the two or more sub-shapes passed as parameters s1 through sn. That is, a point is contained in the result shape iff it is contained in any of the sub-shapes.</text>
<text></text>
<code>proplist Shape->Intersect(proplist s1, proplist s2, ...);</code>
<text>Returns the shape that is an intersection of the two or more sub-shapes passed as parameters s1 through sn. That is, a point is contained in the result shape iff it is contained in all of the sub-shapes.</text>
<text></text>
<code>proplist Shape->Subtract(proplist in, proplist ex);</code>
<text>Returns the shape that is contains the sub-shape in but does not contain the sub-shape ex.</text>
<text></text>
<code>proplist Shape->LandscapeRectangle();</code>
<text>Returns a rectangle encompassing the whole landscape.</text>
</part><part>
<h>Shape interface</h>
<text>Each shape type implements a common set of interface functions to be called in the context of the shape proplist:</text>
<text></text>
<code>bool IsPointContained(int x, int y);</code>
<text>Returns true iff the the point at (x,y) is contained in the shape.</text>
<text></text>
<code>bool GetRandomPoint(proplist out, optional int max_tries = 200);</code>
<text>Finds a random position in the shape and returns it as properties x and y in the supplied proplist. The return value indivates whether a point could be found.</text>
<text>The parameter max_tries indicates how many times the algorithm tries to find a point within the shape. The function is guaranteed to succeed for non-empty base shapes (i.e. rectangle and circle) as well as combined shapes on a single try. However a stochastic approach is used for intersection and subtraction shapes where random points are queried from one of the sub-shapes and subsequently checked against the other sub-shapes.</text>
<text></text>
<code>bool GetArea();</code>
<text>Returns the area covered by the shape in squared pixels.</text>
<text></text>
<code>proplist GetBoundingRectangle();</code>
<text>Returns a rectangular shape that includes at least the whole shape used as calling context.</text>
<text></text>
<part>
<h>Rectangle interface</h>
<text>If the shape is a rectangle, the following two helper functions for the <funclink>FindObjects</funclink>-family of functions:</text>
<code>array Find_In(object context);
array Find_At(object context);</code>
<text>These functions return <funclink>Find_InRect</funclink> and <funclink>Find_AtRect</funclink> search criterions for the defined rectangle areas respectively. Optionally, a context object may be supplied, in which case the areas are interpreted in local object coordinates.</text>
</part>
</part><part>
<h>Examples</h>
<code>func Initialize()
{
PlaceObjectsInShape(Rock, 20, Shape->Circle(LandscapeWidth()/2, LandscapeHeight()/2, 300));
PlaceObjectsInShape(Nugget, 50, Shape->LandscapeRectangle());
PlaceObjectsInShape(Coal, 30, Shape->Subtract(Shape->LandscapeRectangle(), Shape->Circle(LandscapeWidth()/2, LandscapeHeight()/2, 300)));
return true;
}
private func PlaceObjectsInShape(def item_id, int count, proplist area)
{
var pos = {};
while (count--)
if (area->GetRandomPoint(pos))
if (GBackSolid(pos.x, pos.y))
CreateObject(item_id, pos.x, pos.y);
return true;
}</code>
<text>Example scenario script that places some underground materials. Up to 20 pieces of rock are placed in a circular area of radius 300 from the center of the landscape. Up to 50 pieces of gold are placed spread all over the map. Up to 30 pieces of coal are placed anywhere in the landscape outside a central, circular area.</text>
<text></text>
<code>func Initialize()
{
// Create message trigger for central landscape position
CreateMessageTrigger("You've reached the landscape center.", Shape->Rectangle(LandscapeWidth()/2-50, LandscapeHeight()/2-50, 100, 100));
// Create message trigger for border position
CreateMessageTrigger("You've reached the left or right landscape border.",
Shape->Combine(
Shape->Rectangle(0, 0, 50, LandscapeHeight()),
Shape->Rectangle(LandscapeWidth()-50, 0, 50, LandscapeHeight())
));
return true;
}
// Creates a trigger that displays the message to any living objects entering the area
func CreateMessageTrigger(string message, proplist area)
{
area.find_condition = area->GetBoundingRectangle()->Find_In();
return ScheduleCall(nil, Scenario.TestMessageTrigger, 3, 0x7fffffff, message, area);
}
// Periodically called for each message trigger
func TestMessageTrigger(message, area)
{
// Look for any objects in the bounding region
for (var obj in FindObjects(area.find_condition, Find_OCF(OCF_Alive)))
// Check the exact shape of the trigger region
if (area->IsPointContained(obj->GetX(), obj->GetY()))
// OK, show message!
obj->Message(message);
return true;
}</code>
<text>Example scenario script that Generates two trigger regions in which messages are displayed above the heads of clonks or other animals entering them.</text>
</part>
<author>Sven2</author><date>2015-07</date>
</doc>

View File

@ -1,338 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
<title>Sound modifiers</title>
<h>Sound modifiers</h>
<part>
<h>Usage</h>
<text>A number of different sound modifiers can be attached to sounds. Sound modifiers are accessed via script by passing a prop list defining them to the <funclink>Sound</funclink> script functions. Sample prop lists are already defined in the Ambience definition in Objects.ocd. If Objects.ocd is loaded, you can for example play the "Ding" sound with a reverb-effect:</text>
<code>Sound("Ding",,,,,,,Ambience.CaveModifier);</code>
<text>Custom modifiers may also be created using the prototype classes provided in the ambience object:</text>
<code>// Play "Ding" sound with an extra-long reverb modifier
long_reverb_modifier = new Ambience.SoundModifier {
Type = C4SMT_Reverb,
Reverb_Decay_Time = 10000,
};
Sound("Ding",,,,,,,long_reverb_modifier);
modifier->Release();</code>
<text>Sound modifiers are lazy-initialized, that is the filters are computed when the first sound with that effect is played. The engine also holds filters of any used modifiers attached to the used prop list in memory until released by the Release()-call provided by the ambience library, which wraps <funclink>ChangeSoundModifier</funclink> with appropriate parameters.</text>
<text>Since filter creation may cost some performance, it is recommended to create filter prop lists at round start and keep them for any effects. Please note that modifier lookup happens by prop list pointer only, not by its contents. Recreating and failing to release sound modifier prop lists therefore constitutes a memory-leak.</text>
<text>If sound modifiers are released, they are kept active until the last sound using them finishes. Note that for modifiers such as echo, this could still cut off sounds because the modifier outlasts the original sound (potentially forever for echo without decay).</text>
<text>Some existing modifiers may also be updated and updates reflected to the sounds played, even with those currently playing, by using the Update()-call such as in this example scenario script:</text>
<code>static reverb_modifier;
func Initialize()
{
// Play "Ding" sound repeatedly and modify reverb
reverb_modifier = new Ambience.SoundModifier {
Type = C4SMT_Echo,
Echo_Feedback = 1000,
};
Sound("Ding",,,,1,,,reverb_modifier);
ScheduleCall(nil, this.Timer, 30, 99999);
return true;
}
func Timer()
{
// Update effect every 30 frames
reverb_modifier.Echo_Feedback = Random(2) * 500;
reverb_modifier->Update();
return true;
}</code>
<text>Note that runtime updating does not work for the reverb modifier in the openal-soft library.</text>
<part>
<h>Global modifiers</h>
<text>Global modifiers can be set using the <funclink>SetGlobalSoundModifier</funclink> (see function documentation for example). These modifiers are applied to all sounds played in the viewport of a player or all players that do not have a modifier yet. Please note that it is not possible to combine multiple modifiers on a single sound.</text>
</part>
</part>
<part>
<h>Property reference</h>
<text>The effect is selected from the Type-property, which may have the following values:</text>
<table>
<rowh>
<col>Constant</col>
<col>Effect</col>
</rowh>
<row>
<col>C4SMT_Reverb</col>
<col>Reverb effect caused by sound bouncing off walls in enclosed spaces.</col>
</row>
<row>
<col>C4SMT_Echo</col>
<col>Sound repeat as caused by loud sounds reflected in very large spaces.</col>
</row>
<row>
<col>C4SMT_Equalizer</col>
<col>Custom amplification of up to four definable frequency bands. Note: When running with OpenAL soft, only supported with version 1.16 or above (not shipped by default).</col>
</row>
</table>
<text>Each modifier has a number of parameters. These consult to standard parameters for the OpenAL EFX library by dividing all given integer values by 1000 to yield float values.</text>
<part><h>Reverb modifier</h>
<table>
<rowh>
<col>Property</col>
<col>Type</col>
<col>Default</col>
<col>Minmum</col>
<col>Maximum</col>
<col>Remarks</col>
</rowh>
<row>
<col>Reverb_Density</col>
<col>int</col>
<col>1000</col>
<col>0</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Reverb_Diffusion</col>
<col>int</col>
<col>1000</col>
<col>0</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Reverb_Gain</col>
<col>int</col>
<col>316</col>
<col>0</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Reverb_GainHF</col>
<col>int</col>
<col>1000</col>
<col>0</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Reverb_Decay_Time</col>
<col>int</col>
<col>2910</col>
<col>100</col>
<col>20000</col>
<col></col>
</row>
<row>
<col>Reverb_Decay_HFRatio</col>
<col>int</col>
<col>1300</col>
<col>100</col>
<col>20000</col>
<col></col>
</row>
<row>
<col>Reverb_Reflections_Gain</col>
<col>int</col>
<col>500</col>
<col>0</col>
<col>3160</col>
<col></col>
</row>
<row>
<col>Reverb_Reflections_Delay</col>
<col>int</col>
<col>15</col>
<col>0</col>
<col>300</col>
<col></col>
</row>
<row>
<col>Reverb_Late_Reverb_Gain</col>
<col>int</col>
<col>706</col>
<col>0</col>
<col>10000</col>
<col></col>
</row>
<row>
<col>Reverb_Late_Reverb_Delay</col>
<col>int</col>
<col>22</col>
<col>0</col>
<col>100</col>
<col></col>
</row>
<row>
<col>Reverb_Air_Absorption_GainHF</col>
<col>int</col>
<col>994</col>
<col>892</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Reverb_Room_Rolloff_Factor</col>
<col>int</col>
<col>0</col>
<col>0</col>
<col>10000</col>
<col></col>
</row>
<row>
<col>Reverb_Decay_HFLimit</col>
<col>bool</col>
<col>true</col>
<col></col>
<col></col>
<col></col>
</row>
</table>
</part>
<part><h>Echo modifier</h>
<table>
<rowh>
<col>Property</col>
<col>Type</col>
<col>Default</col>
<col>Minmum</col>
<col>Maximum</col>
<col>Description</col>
</rowh>
<row>
<col>Echo_Delay</col>
<col>int</col>
<col>100</col>
<col>0</col>
<col>207</col>
<col>Time delay for first, centered echo.</col>
</row>
<row>
<col>Echo_LRDelay</col>
<col>int</col>
<col>100</col>
<col>0</col>
<col>404</col>
<col>Time delay for secondary, panning echo.</col>
</row>
<row>
<col>Echo_Damping</col>
<col>int</col>
<col>500</col>
<col>0</col>
<col>990</col>
<col>Amount of high-frequency damping.</col>
</row>
<row>
<col>Echo_Feedback</col>
<col>int</col>
<col>500</col>
<col>0</col>
<col>1000</col>
<col>Amount of original signal fed into the echo. A value of 1000 would lead to an infinite echo.</col>
</row>
<row>
<col>Echo_Spread</col>
<col>int</col>
<col>-1000</col>
<col>-1000</col>
<col>+1000</col>
<col>Controls the amount of panning left and right, with the sign determining if the first jump is left or right. A value of zero means no echo panning.</col>
</row>
</table>
</part>
<part><h>Equalizer modifier</h>
<table>
<rowh>
<col>Property</col>
<col>Type</col>
<col>Default</col>
<col>Minmum</col>
<col>Maximum</col>
<col>Remarks</col>
</rowh>
<row>
<col>Equalizer_Low_Gain</col>
<col>int</col>
<col>1000</col>
<col>126</col>
<col>7943</col>
<col></col>
</row>
<row>
<col>Equalizer_Low_Cutoff</col>
<col>int</col>
<col>200000</col>
<col>50000</col>
<col>800000</col>
<col></col>
</row>
<row>
<col>Equalizer_Mid1_Gain</col>
<col>int</col>
<col>1000</col>
<col>126</col>
<col>7943</col>
<col></col>
</row>
<row>
<col>Equalizer_Mid1_Center</col>
<col>int</col>
<col>500000</col>
<col>200000</col>
<col>3000000</col>
<col></col>
</row>
<row>
<col>Equalizer_Mid1_Width</col>
<col>int</col>
<col>1000</col>
<col>10</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Equalizer_Mid2_Gain</col>
<col>int</col>
<col>1000</col>
<col>126</col>
<col>7943</col>
<col></col>
</row>
<row>
<col>Equalizer_Mid2_Center</col>
<col>int</col>
<col>3000000</col>
<col>1000000</col>
<col>8000000</col>
<col></col>
</row>
<row>
<col>Equalizer_Mid2_Width</col>
<col>int</col>
<col>1000</col>
<col>10</col>
<col>1000</col>
<col></col>
</row>
<row>
<col>Equalizer_High_Gain</col>
<col>int</col>
<col>1000</col>
<col>126</col>
<col>7943</col>
<col></col>
</row>
<row>
<col>Equalizer_High_Cutoff</col>
<col>int</col>
<col>6000000</col>
<col>4000000</col>
<col>16000000</col>
<col></col>
</row>
</table>
</part>
</part>
<author>Sven2</author><date>2015-07</date>
</doc>

View File

@ -6,7 +6,7 @@
<func>
<title>Abs</title>
<category>Arithmetics</category>
<version>1.0 OC</version>
<version>5.1 OC</version>
<syntax>
<rtype>int</rtype>
<params>

View File

@ -7,7 +7,7 @@
<title>AbsX</title>
<category>Objects</category>
<subcat>Position</subcat>
<version>1.0 OC</version>
<version>5.1 OC</version>
<syntax>
<rtype>int</rtype>
<params>

View File

@ -7,7 +7,7 @@
<title>AbsY</title>
<category>Objects</category>
<subcat>Position</subcat>
<version>1.0 OC</version>
<version>5.1 OC</version>
<syntax>
<rtype>int</rtype>
<params>

View File

@ -7,7 +7,7 @@
<title>ActIdle</title>
<category>Objects</category>
<subcat>Activity</subcat>
<version>1.0 OC</version>
<version>5.1 OC</version>
<syntax><rtype>bool</rtype></syntax>
<desc>Checks whether an object is currently performing an activity.</desc>
<related>

View File

@ -7,7 +7,7 @@
<title>AddCommand</title>
<category>Objects</category>
<subcat>Commands</subcat>
<version>1.0 OC</version>
<version>5.1 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
@ -111,7 +111,7 @@
<examples>
<example>
<code>
var obj = <funclink>FindObject</funclink>(<funclink>Find_InRect</funclink>(-20, -40, 40, 40), <funclink>Find_OCF</funclink>(<funclink>OCF_CrewMember</funclink>));
var obj = <funclink>FindObject</funclink>(<funclink>Find_Rect</funclink>(-20, -40, 40, 40), <funclink>Find_OCF</funclink>(<funclink>OCF_CrewMember</funclink>));
if(obj)
if(obj-&gt;<funclink>GetComDir</funclink>() == <funclink>COMD_Right</funclink>)
obj-&gt;<funclink>AddCommand</funclink>(&quot;Jump&quot;);

View File

@ -6,8 +6,7 @@
<func>
<title>AddEffect</title>
<category>Effects</category>
<version>1.0 OC</version>
<deprecated />
<version>5.1 OC</version>
<syntax>
<rtype>proplist</rtype>
<params>
@ -19,7 +18,7 @@
<param>
<type>object</type>
<name>target</name>
<desc>Target object for the effect. If <code>nil</code>, <code>Global</code> is used, but the target parameter of the callbacks will get <code>nil</code>.</desc>
<desc>Target object for the effect. If <code>nil</code>, a global effect is created.</desc>
<optional />
</param>
<param>
@ -75,7 +74,6 @@
<remark>For examples and more information see the <emlink href="script/Effects.html">effects documentation</emlink>.</remark>
<related>
<emlink href="script/Effects.html">Effects Documentation</emlink>
<funclink>CreateEffect</funclink>
<funclink>CheckEffect</funclink>
<funclink>GetEffectCount</funclink>
<funclink>EffectCall</funclink>

View File

@ -1,60 +0,0 @@
<?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>AddFragmentShader</title>
<category>Global</category>
<version>8.0 OC</version>
<syntax>
<rtype>int</rtype>
<params>
<param>
<type>string</type>
<name>category</name>
<desc>
Shader category or shader name the slices are added to. Known categories:
<table>
<rowh>
<col>Category</col>
<col>Description</col>
</rowh>
<row>
<col>Common</col>
<col>Applies to everything.</col>
</row>
<row>
<col>Object</col>
<col>Applies to all objects and sprites.</col>
</row>
<row>
<col>Landscape</col>
<col>Applies to the landscape.</col>
</row>
</table>
</desc>
</param>
<param>
<type>string</type>
<name>shader</name>
<desc>The GLSL shader code.</desc>
</param>
</params>
</syntax>
<desc>Adds shader slices to a category of shaders or to a single shader. Returns an identifier for removal.</desc>
<remark>
Consider using built-in functions such as <funclink>SetGamma</funclink>, <funclink>SetMatAdjust</funclink>, or <funclink>SetClrModulation</funclink> for changing colors instead of writing a custom shader.
</remark>
<examples>
<example>
<code>AddFragmentShader("Landscape", "slice(color+1) { fragColor.r = 1.f; }");</code>
<text>Makes the landscape very red.</text>
</example>
</examples>
<related>
<funclink>RemoveShader</funclink>
</related>
</func>
<author>Luchs</author><date>2016-10</date>
</funcs>

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