merge with latest defaul, fixing compiling with fpc, parsing and rendering with pas2c, some minor problems with compiling with clang webgl
authorkoda
Fri, 11 Oct 2013 17:43:13 +0200
branchwebgl
changeset 9521 8054d9d775fd
parent 9282 92af50454cf2 (current diff)
parent 9519 b8b5c82eb61b (diff)
child 9950 2759212a27de
merge with latest defaul, fixing compiling with fpc, parsing and rendering with pas2c, some minor problems with compiling with clang
.hgignore
CMakeLists.txt
QTfrontend/CMakeLists.txt
QTfrontend/game.cpp
QTfrontend/gameuiconfig.cpp
QTfrontend/hwform.cpp
QTfrontend/net/newnetclient.cpp
QTfrontend/res/campaign/A Classic Fairytale/backstab.png
QTfrontend/res/campaign/A Classic Fairytale/dragon.png
QTfrontend/res/campaign/A Classic Fairytale/enemy.png
QTfrontend/res/campaign/A Classic Fairytale/epil.png
QTfrontend/res/campaign/A Classic Fairytale/family.png
QTfrontend/res/campaign/A Classic Fairytale/first_blood.png
QTfrontend/res/campaign/A Classic Fairytale/journey.png
QTfrontend/res/campaign/A Classic Fairytale/queen.png
QTfrontend/res/campaign/A Classic Fairytale/shadow.png
QTfrontend/res/campaign/A Classic Fairytale/united.png
QTfrontend/ui/page/pagevideos.cpp
QTfrontend/ui/widget/about.cpp
cmake_modules/CMakePascalInformation.cmake
cmake_modules/paths.cmake
gameServer/Actions.hs
gameServer/HWProtoInRoomState.hs
hedgewars/ArgParsers.inc
hedgewars/ArgParsers.pas
hedgewars/CMakeLists.txt
hedgewars/GSHandlers.inc
hedgewars/SDLh.pas
hedgewars/VGSHandlers.inc
hedgewars/hwengine.pas
hedgewars/options.inc
hedgewars/uAI.pas
hedgewars/uAIAmmoTests.pas
hedgewars/uAmmos.pas
hedgewars/uChat.pas
hedgewars/uCollisions.pas
hedgewars/uCommandHandlers.pas
hedgewars/uConsts.pas
hedgewars/uGame.pas
hedgewars/uGears.pas
hedgewars/uGearsHandlers.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uGearsUtils.pas
hedgewars/uIO.pas
hedgewars/uInputHandler.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uLandTemplates.pas
hedgewars/uMisc.pas
hedgewars/uPhysFSLayer.pas
hedgewars/uScript.pas
hedgewars/uStats.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uTouch.pas
hedgewars/uTypes.pas
hedgewars/uUtils.pas
hedgewars/uVariables.pas
hedgewars/uVisualGears.pas
hedgewars/uVisualGearsHandlers.pas
hedgewars/uWorld.pas
misc/libfreetype/Android.mk
misc/libfreetype/ChangeLog
misc/libfreetype/ChangeLog.20
misc/libfreetype/ChangeLog.21
misc/libfreetype/ChangeLog.22
misc/libfreetype/ChangeLog.23
misc/libfreetype/Jamfile
misc/libfreetype/Jamrules
misc/libfreetype/README
misc/libfreetype/README.git
misc/libfreetype/Xcode-iOS/Freetype.xcodeproj/default.mode1v3
misc/libfreetype/Xcode-iOS/Freetype.xcodeproj/default.pbxuser
misc/libfreetype/Xcode-iOS/Freetype.xcodeproj/project.pbxproj
misc/libfreetype/Xcode-iOS/Freetype_Prefix.pch
misc/libfreetype/Xcode/Freetype.xcodeproj/default.mode1v3
misc/libfreetype/Xcode/Freetype.xcodeproj/default.pbxuser
misc/libfreetype/Xcode/Freetype.xcodeproj/project.pbxproj
misc/libfreetype/Xcode/Freetype_Prefix.pch
misc/libfreetype/autogen.sh
misc/libfreetype/builds/amiga/include/freetype/config/ftconfig.h
misc/libfreetype/builds/amiga/include/freetype/config/ftmodule.h
misc/libfreetype/builds/amiga/makefile
misc/libfreetype/builds/amiga/makefile.os4
misc/libfreetype/builds/amiga/smakefile
misc/libfreetype/builds/amiga/src/base/ftdebug.c
misc/libfreetype/builds/amiga/src/base/ftsystem.c
misc/libfreetype/builds/atari/ATARI.H
misc/libfreetype/builds/atari/FNames.SIC
misc/libfreetype/builds/atari/FREETYPE.PRJ
misc/libfreetype/builds/atari/README.TXT
misc/libfreetype/builds/atari/deflinejoiner.awk
misc/libfreetype/builds/atari/gen-purec-patch.sh
misc/libfreetype/builds/mac/FreeType.m68k_cfm.make.txt
misc/libfreetype/builds/mac/FreeType.m68k_far.make.txt
misc/libfreetype/builds/mac/FreeType.ppc_carbon.make.txt
misc/libfreetype/builds/mac/FreeType.ppc_classic.make.txt
misc/libfreetype/builds/mac/ascii2mpw.py
misc/libfreetype/builds/mac/ftlib.prj.xml
misc/libfreetype/builds/mac/ftmac.c
misc/libfreetype/builds/newline
misc/libfreetype/builds/symbian/bld.inf
misc/libfreetype/builds/symbian/freetype.mmp
misc/libfreetype/builds/unix/configure.raw
misc/libfreetype/builds/unix/freetype-config.in
misc/libfreetype/builds/unix/freetype2.in
misc/libfreetype/builds/unix/freetype2.m4
misc/libfreetype/builds/unix/ft-munmap.m4
misc/libfreetype/builds/unix/ft2unix.h
misc/libfreetype/builds/unix/ftconfig.in
misc/libfreetype/builds/unix/ftsystem.c
misc/libfreetype/builds/unix/install-sh
misc/libfreetype/builds/unix/mkinstalldirs
misc/libfreetype/builds/unix/unix-cc.in
misc/libfreetype/builds/unix/unix-def.in
misc/libfreetype/builds/vms/ftconfig.h
misc/libfreetype/builds/vms/ftsystem.c
misc/libfreetype/builds/win32/ftdebug.c
misc/libfreetype/builds/win32/vc2005/freetype.sln
misc/libfreetype/builds/win32/vc2005/freetype.vcproj
misc/libfreetype/builds/win32/vc2005/index.html
misc/libfreetype/builds/win32/vc2008/freetype.sln
misc/libfreetype/builds/win32/vc2008/freetype.vcproj
misc/libfreetype/builds/win32/vc2008/index.html
misc/libfreetype/builds/win32/vc2010/freetype.sln
misc/libfreetype/builds/win32/vc2010/freetype.vcxproj
misc/libfreetype/builds/win32/vc2010/freetype.vcxproj.filters
misc/libfreetype/builds/win32/vc2010/index.html
misc/libfreetype/builds/win32/visualc/freetype.dsp
misc/libfreetype/builds/win32/visualc/freetype.dsw
misc/libfreetype/builds/win32/visualc/freetype.sln
misc/libfreetype/builds/win32/visualc/freetype.vcproj
misc/libfreetype/builds/win32/visualc/index.html
misc/libfreetype/builds/win32/visualce/freetype.dsp
misc/libfreetype/builds/win32/visualce/freetype.dsw
misc/libfreetype/builds/win32/visualce/freetype.vcproj
misc/libfreetype/builds/win32/visualce/index.html
misc/libfreetype/builds/wince/ftdebug.c
misc/libfreetype/builds/wince/vc2005-ce/freetype.sln
misc/libfreetype/builds/wince/vc2005-ce/freetype.vcproj
misc/libfreetype/builds/wince/vc2005-ce/index.html
misc/libfreetype/builds/wince/vc2008-ce/freetype.sln
misc/libfreetype/builds/wince/vc2008-ce/freetype.vcproj
misc/libfreetype/builds/wince/vc2008-ce/index.html
misc/libfreetype/configure
misc/libfreetype/devel/ft2build.h
misc/libfreetype/devel/ftoption.h
misc/libfreetype/docs/CHANGES
misc/libfreetype/docs/CUSTOMIZE
misc/libfreetype/docs/DEBUG
misc/libfreetype/docs/FTL.TXT
misc/libfreetype/docs/GPL.TXT
misc/libfreetype/docs/INSTALL
misc/libfreetype/docs/INSTALL.ANY
misc/libfreetype/docs/INSTALL.CROSS
misc/libfreetype/docs/INSTALL.GNU
misc/libfreetype/docs/INSTALL.MAC
misc/libfreetype/docs/INSTALL.UNIX
misc/libfreetype/docs/INSTALL.VMS
misc/libfreetype/docs/LICENSE.TXT
misc/libfreetype/docs/MAKEPP
misc/libfreetype/docs/PROBLEMS
misc/libfreetype/docs/TODO
misc/libfreetype/docs/UPGRADE.UNIX
misc/libfreetype/docs/VERSION.DLL
misc/libfreetype/docs/formats.txt
misc/libfreetype/docs/raster.txt
misc/libfreetype/docs/release
misc/libfreetype/include/freetype/config/ftconfig.h
misc/libfreetype/include/freetype/config/ftheader.h
misc/libfreetype/include/freetype/config/ftmodule.h
misc/libfreetype/include/freetype/config/ftoption.h
misc/libfreetype/include/freetype/config/ftstdlib.h
misc/libfreetype/include/freetype/freetype.h
misc/libfreetype/include/freetype/ftadvanc.h
misc/libfreetype/include/freetype/ftbbox.h
misc/libfreetype/include/freetype/ftbdf.h
misc/libfreetype/include/freetype/ftbitmap.h
misc/libfreetype/include/freetype/ftbzip2.h
misc/libfreetype/include/freetype/ftcache.h
misc/libfreetype/include/freetype/ftchapters.h
misc/libfreetype/include/freetype/ftcid.h
misc/libfreetype/include/freetype/fterrdef.h
misc/libfreetype/include/freetype/fterrors.h
misc/libfreetype/include/freetype/ftgasp.h
misc/libfreetype/include/freetype/ftglyph.h
misc/libfreetype/include/freetype/ftgxval.h
misc/libfreetype/include/freetype/ftgzip.h
misc/libfreetype/include/freetype/ftimage.h
misc/libfreetype/include/freetype/ftincrem.h
misc/libfreetype/include/freetype/ftlcdfil.h
misc/libfreetype/include/freetype/ftlist.h
misc/libfreetype/include/freetype/ftlzw.h
misc/libfreetype/include/freetype/ftmac.h
misc/libfreetype/include/freetype/ftmm.h
misc/libfreetype/include/freetype/ftmodapi.h
misc/libfreetype/include/freetype/ftmoderr.h
misc/libfreetype/include/freetype/ftotval.h
misc/libfreetype/include/freetype/ftoutln.h
misc/libfreetype/include/freetype/ftpfr.h
misc/libfreetype/include/freetype/ftrender.h
misc/libfreetype/include/freetype/ftsizes.h
misc/libfreetype/include/freetype/ftsnames.h
misc/libfreetype/include/freetype/ftstroke.h
misc/libfreetype/include/freetype/ftsynth.h
misc/libfreetype/include/freetype/ftsystem.h
misc/libfreetype/include/freetype/fttrigon.h
misc/libfreetype/include/freetype/fttypes.h
misc/libfreetype/include/freetype/ftwinfnt.h
misc/libfreetype/include/freetype/ftxf86.h
misc/libfreetype/include/freetype/internal/autohint.h
misc/libfreetype/include/freetype/internal/ftcalc.h
misc/libfreetype/include/freetype/internal/ftdebug.h
misc/libfreetype/include/freetype/internal/ftdriver.h
misc/libfreetype/include/freetype/internal/ftgloadr.h
misc/libfreetype/include/freetype/internal/ftmemory.h
misc/libfreetype/include/freetype/internal/ftobjs.h
misc/libfreetype/include/freetype/internal/ftpic.h
misc/libfreetype/include/freetype/internal/ftrfork.h
misc/libfreetype/include/freetype/internal/ftserv.h
misc/libfreetype/include/freetype/internal/ftstream.h
misc/libfreetype/include/freetype/internal/fttrace.h
misc/libfreetype/include/freetype/internal/ftvalid.h
misc/libfreetype/include/freetype/internal/internal.h
misc/libfreetype/include/freetype/internal/psaux.h
misc/libfreetype/include/freetype/internal/pshints.h
misc/libfreetype/include/freetype/internal/services/svbdf.h
misc/libfreetype/include/freetype/internal/services/svcid.h
misc/libfreetype/include/freetype/internal/services/svgldict.h
misc/libfreetype/include/freetype/internal/services/svgxval.h
misc/libfreetype/include/freetype/internal/services/svkern.h
misc/libfreetype/include/freetype/internal/services/svmm.h
misc/libfreetype/include/freetype/internal/services/svotval.h
misc/libfreetype/include/freetype/internal/services/svpfr.h
misc/libfreetype/include/freetype/internal/services/svpostnm.h
misc/libfreetype/include/freetype/internal/services/svpscmap.h
misc/libfreetype/include/freetype/internal/services/svpsinfo.h
misc/libfreetype/include/freetype/internal/services/svsfnt.h
misc/libfreetype/include/freetype/internal/services/svttcmap.h
misc/libfreetype/include/freetype/internal/services/svtteng.h
misc/libfreetype/include/freetype/internal/services/svttglyf.h
misc/libfreetype/include/freetype/internal/services/svwinfnt.h
misc/libfreetype/include/freetype/internal/services/svxf86nm.h
misc/libfreetype/include/freetype/internal/sfnt.h
misc/libfreetype/include/freetype/internal/t1types.h
misc/libfreetype/include/freetype/internal/tttypes.h
misc/libfreetype/include/freetype/t1tables.h
misc/libfreetype/include/freetype/ttnameid.h
misc/libfreetype/include/freetype/tttables.h
misc/libfreetype/include/freetype/tttags.h
misc/libfreetype/include/freetype/ttunpat.h
misc/libfreetype/include/ft2build.h
misc/libfreetype/modules.cfg
misc/libfreetype/src/autofit/afangles.c
misc/libfreetype/src/autofit/afangles.h
misc/libfreetype/src/autofit/afcjk.c
misc/libfreetype/src/autofit/afcjk.h
misc/libfreetype/src/autofit/afdummy.c
misc/libfreetype/src/autofit/afdummy.h
misc/libfreetype/src/autofit/aferrors.h
misc/libfreetype/src/autofit/afglobal.c
misc/libfreetype/src/autofit/afglobal.h
misc/libfreetype/src/autofit/afhints.c
misc/libfreetype/src/autofit/afhints.h
misc/libfreetype/src/autofit/afindic.c
misc/libfreetype/src/autofit/afindic.h
misc/libfreetype/src/autofit/aflatin.c
misc/libfreetype/src/autofit/aflatin.h
misc/libfreetype/src/autofit/aflatin2.c
misc/libfreetype/src/autofit/aflatin2.h
misc/libfreetype/src/autofit/afloader.c
misc/libfreetype/src/autofit/afloader.h
misc/libfreetype/src/autofit/afmodule.c
misc/libfreetype/src/autofit/afmodule.h
misc/libfreetype/src/autofit/afpic.c
misc/libfreetype/src/autofit/afpic.h
misc/libfreetype/src/autofit/aftypes.h
misc/libfreetype/src/autofit/afwarp.c
misc/libfreetype/src/autofit/afwarp.h
misc/libfreetype/src/autofit/autofit.c
misc/libfreetype/src/base/basepic.c
misc/libfreetype/src/base/basepic.h
misc/libfreetype/src/base/ftadvanc.c
misc/libfreetype/src/base/ftapi.c
misc/libfreetype/src/base/ftbase.c
misc/libfreetype/src/base/ftbase.h
misc/libfreetype/src/base/ftbbox.c
misc/libfreetype/src/base/ftbdf.c
misc/libfreetype/src/base/ftbitmap.c
misc/libfreetype/src/base/ftcalc.c
misc/libfreetype/src/base/ftcid.c
misc/libfreetype/src/base/ftdbgmem.c
misc/libfreetype/src/base/ftdebug.c
misc/libfreetype/src/base/ftfstype.c
misc/libfreetype/src/base/ftgasp.c
misc/libfreetype/src/base/ftgloadr.c
misc/libfreetype/src/base/ftglyph.c
misc/libfreetype/src/base/ftgxval.c
misc/libfreetype/src/base/ftinit.c
misc/libfreetype/src/base/ftlcdfil.c
misc/libfreetype/src/base/ftmac.c
misc/libfreetype/src/base/ftmm.c
misc/libfreetype/src/base/ftobjs.c
misc/libfreetype/src/base/ftotval.c
misc/libfreetype/src/base/ftoutln.c
misc/libfreetype/src/base/ftpatent.c
misc/libfreetype/src/base/ftpfr.c
misc/libfreetype/src/base/ftpic.c
misc/libfreetype/src/base/ftrfork.c
misc/libfreetype/src/base/ftsnames.c
misc/libfreetype/src/base/ftstream.c
misc/libfreetype/src/base/ftstroke.c
misc/libfreetype/src/base/ftsynth.c
misc/libfreetype/src/base/ftsystem.c
misc/libfreetype/src/base/fttrigon.c
misc/libfreetype/src/base/fttype1.c
misc/libfreetype/src/base/ftutil.c
misc/libfreetype/src/base/ftwinfnt.c
misc/libfreetype/src/base/ftxf86.c
misc/libfreetype/src/bdf/bdf.c
misc/libfreetype/src/bdf/bdf.h
misc/libfreetype/src/bdf/bdfdrivr.c
misc/libfreetype/src/bdf/bdfdrivr.h
misc/libfreetype/src/bdf/bdferror.h
misc/libfreetype/src/bdf/bdflib.c
misc/libfreetype/src/bzip2/Jamfile
misc/libfreetype/src/bzip2/ftbzip2.c
misc/libfreetype/src/cache/ftcache.c
misc/libfreetype/src/cache/ftcbasic.c
misc/libfreetype/src/cache/ftccache.c
misc/libfreetype/src/cache/ftccache.h
misc/libfreetype/src/cache/ftccback.h
misc/libfreetype/src/cache/ftccmap.c
misc/libfreetype/src/cache/ftcerror.h
misc/libfreetype/src/cache/ftcglyph.c
misc/libfreetype/src/cache/ftcglyph.h
misc/libfreetype/src/cache/ftcimage.c
misc/libfreetype/src/cache/ftcimage.h
misc/libfreetype/src/cache/ftcmanag.c
misc/libfreetype/src/cache/ftcmanag.h
misc/libfreetype/src/cache/ftcmru.c
misc/libfreetype/src/cache/ftcmru.h
misc/libfreetype/src/cache/ftcsbits.c
misc/libfreetype/src/cache/ftcsbits.h
misc/libfreetype/src/cff/cff.c
misc/libfreetype/src/cff/cffcmap.c
misc/libfreetype/src/cff/cffcmap.h
misc/libfreetype/src/cff/cffdrivr.c
misc/libfreetype/src/cff/cffdrivr.h
misc/libfreetype/src/cff/cfferrs.h
misc/libfreetype/src/cff/cffgload.c
misc/libfreetype/src/cff/cffgload.h
misc/libfreetype/src/cff/cffload.c
misc/libfreetype/src/cff/cffload.h
misc/libfreetype/src/cff/cffobjs.c
misc/libfreetype/src/cff/cffobjs.h
misc/libfreetype/src/cff/cffparse.c
misc/libfreetype/src/cff/cffparse.h
misc/libfreetype/src/cff/cffpic.c
misc/libfreetype/src/cff/cffpic.h
misc/libfreetype/src/cff/cfftoken.h
misc/libfreetype/src/cff/cfftypes.h
misc/libfreetype/src/cid/ciderrs.h
misc/libfreetype/src/cid/cidgload.c
misc/libfreetype/src/cid/cidgload.h
misc/libfreetype/src/cid/cidload.c
misc/libfreetype/src/cid/cidload.h
misc/libfreetype/src/cid/cidobjs.c
misc/libfreetype/src/cid/cidobjs.h
misc/libfreetype/src/cid/cidparse.c
misc/libfreetype/src/cid/cidparse.h
misc/libfreetype/src/cid/cidriver.c
misc/libfreetype/src/cid/cidriver.h
misc/libfreetype/src/cid/cidtoken.h
misc/libfreetype/src/cid/type1cid.c
misc/libfreetype/src/gxvalid/gxvalid.c
misc/libfreetype/src/gxvalid/gxvalid.h
misc/libfreetype/src/gxvalid/gxvbsln.c
misc/libfreetype/src/gxvalid/gxvcommn.c
misc/libfreetype/src/gxvalid/gxvcommn.h
misc/libfreetype/src/gxvalid/gxverror.h
misc/libfreetype/src/gxvalid/gxvfeat.c
misc/libfreetype/src/gxvalid/gxvfeat.h
misc/libfreetype/src/gxvalid/gxvfgen.c
misc/libfreetype/src/gxvalid/gxvjust.c
misc/libfreetype/src/gxvalid/gxvkern.c
misc/libfreetype/src/gxvalid/gxvlcar.c
misc/libfreetype/src/gxvalid/gxvmod.c
misc/libfreetype/src/gxvalid/gxvmod.h
misc/libfreetype/src/gxvalid/gxvmort.c
misc/libfreetype/src/gxvalid/gxvmort.h
misc/libfreetype/src/gxvalid/gxvmort0.c
misc/libfreetype/src/gxvalid/gxvmort1.c
misc/libfreetype/src/gxvalid/gxvmort2.c
misc/libfreetype/src/gxvalid/gxvmort4.c
misc/libfreetype/src/gxvalid/gxvmort5.c
misc/libfreetype/src/gxvalid/gxvmorx.c
misc/libfreetype/src/gxvalid/gxvmorx.h
misc/libfreetype/src/gxvalid/gxvmorx0.c
misc/libfreetype/src/gxvalid/gxvmorx1.c
misc/libfreetype/src/gxvalid/gxvmorx2.c
misc/libfreetype/src/gxvalid/gxvmorx4.c
misc/libfreetype/src/gxvalid/gxvmorx5.c
misc/libfreetype/src/gxvalid/gxvopbd.c
misc/libfreetype/src/gxvalid/gxvprop.c
misc/libfreetype/src/gxvalid/gxvtrak.c
misc/libfreetype/src/gzip/adler32.c
misc/libfreetype/src/gzip/ftgzip.c
misc/libfreetype/src/gzip/infblock.c
misc/libfreetype/src/gzip/infblock.h
misc/libfreetype/src/gzip/infcodes.c
misc/libfreetype/src/gzip/infcodes.h
misc/libfreetype/src/gzip/inffixed.h
misc/libfreetype/src/gzip/inflate.c
misc/libfreetype/src/gzip/inftrees.c
misc/libfreetype/src/gzip/inftrees.h
misc/libfreetype/src/gzip/infutil.c
misc/libfreetype/src/gzip/infutil.h
misc/libfreetype/src/gzip/zconf.h
misc/libfreetype/src/gzip/zlib.h
misc/libfreetype/src/gzip/zutil.c
misc/libfreetype/src/gzip/zutil.h
misc/libfreetype/src/lzw/ftlzw.c
misc/libfreetype/src/lzw/ftzopen.c
misc/libfreetype/src/lzw/ftzopen.h
misc/libfreetype/src/otvalid/otvalid.c
misc/libfreetype/src/otvalid/otvalid.h
misc/libfreetype/src/otvalid/otvbase.c
misc/libfreetype/src/otvalid/otvcommn.c
misc/libfreetype/src/otvalid/otvcommn.h
misc/libfreetype/src/otvalid/otverror.h
misc/libfreetype/src/otvalid/otvgdef.c
misc/libfreetype/src/otvalid/otvgpos.c
misc/libfreetype/src/otvalid/otvgpos.h
misc/libfreetype/src/otvalid/otvgsub.c
misc/libfreetype/src/otvalid/otvjstf.c
misc/libfreetype/src/otvalid/otvmath.c
misc/libfreetype/src/otvalid/otvmod.c
misc/libfreetype/src/otvalid/otvmod.h
misc/libfreetype/src/pcf/README
misc/libfreetype/src/pcf/pcf.c
misc/libfreetype/src/pcf/pcf.h
misc/libfreetype/src/pcf/pcfdrivr.c
misc/libfreetype/src/pcf/pcfdrivr.h
misc/libfreetype/src/pcf/pcferror.h
misc/libfreetype/src/pcf/pcfread.c
misc/libfreetype/src/pcf/pcfread.h
misc/libfreetype/src/pcf/pcfutil.c
misc/libfreetype/src/pcf/pcfutil.h
misc/libfreetype/src/pfr/pfr.c
misc/libfreetype/src/pfr/pfrcmap.c
misc/libfreetype/src/pfr/pfrcmap.h
misc/libfreetype/src/pfr/pfrdrivr.c
misc/libfreetype/src/pfr/pfrdrivr.h
misc/libfreetype/src/pfr/pfrerror.h
misc/libfreetype/src/pfr/pfrgload.c
misc/libfreetype/src/pfr/pfrgload.h
misc/libfreetype/src/pfr/pfrload.c
misc/libfreetype/src/pfr/pfrload.h
misc/libfreetype/src/pfr/pfrobjs.c
misc/libfreetype/src/pfr/pfrobjs.h
misc/libfreetype/src/pfr/pfrsbit.c
misc/libfreetype/src/pfr/pfrsbit.h
misc/libfreetype/src/pfr/pfrtypes.h
misc/libfreetype/src/psaux/afmparse.c
misc/libfreetype/src/psaux/afmparse.h
misc/libfreetype/src/psaux/psaux.c
misc/libfreetype/src/psaux/psauxerr.h
misc/libfreetype/src/psaux/psauxmod.c
misc/libfreetype/src/psaux/psauxmod.h
misc/libfreetype/src/psaux/psconv.c
misc/libfreetype/src/psaux/psconv.h
misc/libfreetype/src/psaux/psobjs.c
misc/libfreetype/src/psaux/psobjs.h
misc/libfreetype/src/psaux/t1cmap.c
misc/libfreetype/src/psaux/t1cmap.h
misc/libfreetype/src/psaux/t1decode.c
misc/libfreetype/src/psaux/t1decode.h
misc/libfreetype/src/pshinter/pshalgo.c
misc/libfreetype/src/pshinter/pshalgo.h
misc/libfreetype/src/pshinter/pshglob.c
misc/libfreetype/src/pshinter/pshglob.h
misc/libfreetype/src/pshinter/pshinter.c
misc/libfreetype/src/pshinter/pshmod.c
misc/libfreetype/src/pshinter/pshmod.h
misc/libfreetype/src/pshinter/pshnterr.h
misc/libfreetype/src/pshinter/pshpic.c
misc/libfreetype/src/pshinter/pshpic.h
misc/libfreetype/src/pshinter/pshrec.c
misc/libfreetype/src/pshinter/pshrec.h
misc/libfreetype/src/psnames/psmodule.c
misc/libfreetype/src/psnames/psmodule.h
misc/libfreetype/src/psnames/psnamerr.h
misc/libfreetype/src/psnames/psnames.c
misc/libfreetype/src/psnames/pspic.c
misc/libfreetype/src/psnames/pspic.h
misc/libfreetype/src/psnames/pstables.h
misc/libfreetype/src/raster/ftmisc.h
misc/libfreetype/src/raster/ftraster.c
misc/libfreetype/src/raster/ftraster.h
misc/libfreetype/src/raster/ftrend1.c
misc/libfreetype/src/raster/ftrend1.h
misc/libfreetype/src/raster/raster.c
misc/libfreetype/src/raster/rasterrs.h
misc/libfreetype/src/raster/rastpic.c
misc/libfreetype/src/raster/rastpic.h
misc/libfreetype/src/sfnt/sfdriver.c
misc/libfreetype/src/sfnt/sfdriver.h
misc/libfreetype/src/sfnt/sferrors.h
misc/libfreetype/src/sfnt/sfnt.c
misc/libfreetype/src/sfnt/sfntpic.c
misc/libfreetype/src/sfnt/sfntpic.h
misc/libfreetype/src/sfnt/sfobjs.c
misc/libfreetype/src/sfnt/sfobjs.h
misc/libfreetype/src/sfnt/ttbdf.c
misc/libfreetype/src/sfnt/ttbdf.h
misc/libfreetype/src/sfnt/ttcmap.c
misc/libfreetype/src/sfnt/ttcmap.h
misc/libfreetype/src/sfnt/ttcmapc.h
misc/libfreetype/src/sfnt/ttkern.c
misc/libfreetype/src/sfnt/ttkern.h
misc/libfreetype/src/sfnt/ttload.c
misc/libfreetype/src/sfnt/ttload.h
misc/libfreetype/src/sfnt/ttmtx.c
misc/libfreetype/src/sfnt/ttmtx.h
misc/libfreetype/src/sfnt/ttpost.c
misc/libfreetype/src/sfnt/ttpost.h
misc/libfreetype/src/sfnt/ttsbit.c
misc/libfreetype/src/sfnt/ttsbit.h
misc/libfreetype/src/sfnt/ttsbit0.c
misc/libfreetype/src/smooth/ftgrays.c
misc/libfreetype/src/smooth/ftgrays.h
misc/libfreetype/src/smooth/ftsmerrs.h
misc/libfreetype/src/smooth/ftsmooth.c
misc/libfreetype/src/smooth/ftsmooth.h
misc/libfreetype/src/smooth/ftspic.c
misc/libfreetype/src/smooth/ftspic.h
misc/libfreetype/src/smooth/smooth.c
misc/libfreetype/src/tools/apinames.c
misc/libfreetype/src/tools/chktrcmp.py
misc/libfreetype/src/tools/cordic.py
misc/libfreetype/src/tools/docmaker/content.py
misc/libfreetype/src/tools/docmaker/docbeauty.py
misc/libfreetype/src/tools/docmaker/docmaker.py
misc/libfreetype/src/tools/docmaker/formatter.py
misc/libfreetype/src/tools/docmaker/sources.py
misc/libfreetype/src/tools/docmaker/tohtml.py
misc/libfreetype/src/tools/docmaker/utils.py
misc/libfreetype/src/tools/ftrandom/ftrandom.c
misc/libfreetype/src/tools/glnames.py
misc/libfreetype/src/tools/test_afm.c
misc/libfreetype/src/tools/test_bbox.c
misc/libfreetype/src/tools/test_trig.c
misc/libfreetype/src/truetype/truetype.c
misc/libfreetype/src/truetype/ttdriver.c
misc/libfreetype/src/truetype/ttdriver.h
misc/libfreetype/src/truetype/tterrors.h
misc/libfreetype/src/truetype/ttgload.c
misc/libfreetype/src/truetype/ttgload.h
misc/libfreetype/src/truetype/ttgxvar.c
misc/libfreetype/src/truetype/ttgxvar.h
misc/libfreetype/src/truetype/ttinterp.c
misc/libfreetype/src/truetype/ttinterp.h
misc/libfreetype/src/truetype/ttobjs.c
misc/libfreetype/src/truetype/ttobjs.h
misc/libfreetype/src/truetype/ttpic.c
misc/libfreetype/src/truetype/ttpic.h
misc/libfreetype/src/truetype/ttpload.c
misc/libfreetype/src/truetype/ttpload.h
misc/libfreetype/src/type1/t1afm.c
misc/libfreetype/src/type1/t1afm.h
misc/libfreetype/src/type1/t1driver.c
misc/libfreetype/src/type1/t1driver.h
misc/libfreetype/src/type1/t1errors.h
misc/libfreetype/src/type1/t1gload.c
misc/libfreetype/src/type1/t1gload.h
misc/libfreetype/src/type1/t1load.c
misc/libfreetype/src/type1/t1load.h
misc/libfreetype/src/type1/t1objs.c
misc/libfreetype/src/type1/t1objs.h
misc/libfreetype/src/type1/t1parse.c
misc/libfreetype/src/type1/t1parse.h
misc/libfreetype/src/type1/t1tokens.h
misc/libfreetype/src/type1/type1.c
misc/libfreetype/src/type42/t42drivr.c
misc/libfreetype/src/type42/t42drivr.h
misc/libfreetype/src/type42/t42error.h
misc/libfreetype/src/type42/t42objs.c
misc/libfreetype/src/type42/t42objs.h
misc/libfreetype/src/type42/t42parse.c
misc/libfreetype/src/type42/t42parse.h
misc/libfreetype/src/type42/t42types.h
misc/libfreetype/src/type42/type42.c
misc/libfreetype/src/winfonts/fnterrs.h
misc/libfreetype/src/winfonts/winfnt.c
misc/libfreetype/src/winfonts/winfnt.h
misc/libfreetype/version.sed
misc/libfreetype/vms_make.com
misc/libopenalbridge/CMakeLists.txt
misc/libopenalbridge/commands.c
misc/libopenalbridge/commands.h
misc/libopenalbridge/globals.h
misc/libopenalbridge/loaders.c
misc/libopenalbridge/loaders.h
misc/libopenalbridge/openalbridge.c
misc/libopenalbridge/openalbridge.def
misc/libopenalbridge/openalbridge.h
misc/libopenalbridge/openalbridge_t.h
misc/libopenalbridge/tester.c
misc/libopenalbridge/wrappers.c
misc/libopenalbridge/wrappers.h
misc/libtremor/Android.mk
misc/libtremor/Xcode/Tremor.xcodeproj/default.mode1v3
misc/libtremor/Xcode/Tremor.xcodeproj/default.pbxuser
misc/libtremor/Xcode/Tremor.xcodeproj/project.pbxproj
misc/libtremor/Xcode/Tremor_Prefix.pch
misc/libtremor/tremor/CHANGELOG
misc/libtremor/tremor/COPYING
misc/libtremor/tremor/Makefile.am
misc/libtremor/tremor/README
misc/libtremor/tremor/Version_script.in
misc/libtremor/tremor/asm_arm.h
misc/libtremor/tremor/autogen.sh
misc/libtremor/tremor/backends.h
misc/libtremor/tremor/bitwise.c
misc/libtremor/tremor/block.c
misc/libtremor/tremor/block.h
misc/libtremor/tremor/codebook.c
misc/libtremor/tremor/codebook.h
misc/libtremor/tremor/codec_internal.h
misc/libtremor/tremor/config_types.h
misc/libtremor/tremor/configure.in
misc/libtremor/tremor/floor0.c
misc/libtremor/tremor/floor1.c
misc/libtremor/tremor/framing.c
misc/libtremor/tremor/info.c
misc/libtremor/tremor/ivorbiscodec.h
misc/libtremor/tremor/ivorbisfile.h
misc/libtremor/tremor/ivorbisfile_example.c
misc/libtremor/tremor/lsp_lookup.h
misc/libtremor/tremor/mapping0.c
misc/libtremor/tremor/mdct.c
misc/libtremor/tremor/mdct.h
misc/libtremor/tremor/mdct_lookup.h
misc/libtremor/tremor/misc.h
misc/libtremor/tremor/ogg.h
misc/libtremor/tremor/os.h
misc/libtremor/tremor/os_types.h
misc/libtremor/tremor/registry.c
misc/libtremor/tremor/registry.h
misc/libtremor/tremor/res012.c
misc/libtremor/tremor/sharedbook.c
misc/libtremor/tremor/synthesis.c
misc/libtremor/tremor/vorbisfile.c
misc/libtremor/tremor/window.c
misc/libtremor/tremor/window.h
misc/libtremor/tremor/window_lookup.h
project_files/Android-build/CMakeLists.txt
project_files/Android-build/SDL-android-project/assets/Data/Locale/hedgewars_en.qm
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/CMakeLists.txt
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/backstab.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/campaign.ini
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/dragon.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/enemy.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/epil.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/family.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.hwp
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.hwp
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/queen.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.hwp
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/united.lua
--- a/.hgignore	Fri Oct 11 11:55:31 2013 +0200
+++ b/.hgignore	Fri Oct 11 17:43:13 2013 +0200
@@ -28,10 +28,7 @@
 glob:project_files/HedgewarsMobile/Data/
 glob:project_files/HedgewarsMobile/build/
 glob:gameServer/dist/
-glob:misc/libtremor/Xcode/build/
 glob:misc/liblua/Xcode/build/
-glob:misc/libfreetype/Xcode/build/
-glob:misc/libfreetype/Xcode-iOS/build/
 glob:misc/libphysfs/Xcode/build/
 glob:misc/libphyslayer/Xcode/build/
 glob:moc_*.cxx_parameters
@@ -67,4 +64,4 @@
 glob:version_info.txt
 glob:*.tar.*
 glob:*.or
-glob:*.res
\ No newline at end of file
+glob:*.res
--- a/CMakeLists.txt	Fri Oct 11 11:55:31 2013 +0200
+++ b/CMakeLists.txt	Fri Oct 11 17:43:13 2013 +0200
@@ -37,7 +37,6 @@
 option(NOPASCAL "Compile hwengine as native C [default: off]" ${WEBGL})
 option(GL2 "Enable OpenGL 2 rendering [default: off]" OFF)
 
-set(FPFLAGS "" CACHE STRING "Additional Freepascal flags")
 set(GHFLAGS "" CACHE STRING "Additional Haskell flags")
 if(UNIX AND NOT APPLE)
     set(DATA_INSTALL_DIR "share/hedgewars" CACHE STRING "Resource folder path")
@@ -76,44 +75,36 @@
 #perform safe check that enable/disable compilation features
 include(${CMAKE_MODULE_PATH}/compilerchecks.cmake)
 
-#set default flags values for all projects (unless MINIMAL_FLAGS is true)
-if(NOT ${MINIMAL_FLAGS})
-    set(CMAKE_C_FLAGS "-pipe ${CMAKE_C_FLAGS}")
-    set(CMAKE_C_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_C_FLAGS_RELEASE}")
-    set(CMAKE_C_FLAGS_DEBUG "-Wall -O0 -g ${CMAKE_C_FLAGS_DEBUG}")
-    set(CMAKE_CXX_FLAGS "-pipe ${CMAKE_CXX_FLAGS}")
-    set(CMAKE_CXX_FLAGS_RELEASE "-w -Os -fomit-frame-pointer ${CMAKE_CXX_FLAGS_RELEASE}")
-    set(CMAKE_CXX_FLAGS_DEBUG "-Wall -O0 -g ${CMAKE_CXX_FLAGS_DEBUG}")
-else()
-    #CMake adds a lot of additional configuration flags, so let's clear them up
-    set(CMAKE_C_FLAGS_RELEASE "")
-    set(CMAKE_C_FLAGS_DEBUG "-Wall")
-    set(CMAKE_CXX_FLAGS_RELEASE "")
-    set(CMAKE_CXX_FLAGS_DEBUG "-Wall")
+#set default compiler flags
+add_flag_append(CMAKE_C_FLAGS "-Wall -pipe -fPIC")
+add_flag_append(CMAKE_C_FLAGS_RELEASE "-Os")
+add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0")
+add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe -fPIC")
+add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-Os")
+add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")
+add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000 -fPIC")
+add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv")
+add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs")
+
+#CMake adds a lot of additional configuration flags, so let's clear them up
+if(${MINIMAL_FLAGS})
+    unset(CMAKE_C_FLAGS_RELEASE)
+    unset(CMAKE_C_FLAGS_DEBUG)
+    unset(CMAKE_CXX_FLAGS_RELEASE)
+    unset(CMAKE_CXX_FLAGS_DEBUG)
 endif()
 
 
 #parse additional parameters
-if(FPFLAGS)
-    add_flag_prepend(CMAKE_Pascal_FLAGS ${FPFLAGS})
-endif()
 if(GHFLAGS)
-    if(${allow_parse_args})
+    if(${CMAKE_VERSION} VERSION_GREATER 2.6)
         separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS})
     else()
-        message("*** FPFLAGS and GHFLAGS are available only when using CMake >= 2.8 ***")
+        message("*** GHFLAGS are available only when using CMake >= 2.8 ***")
     endif()
 endif()
 
-
-list(APPEND haskell_flags ${ghflags_parsed} # user flags
-                 "-O2"                      # optimise for faster code
-                 )
-
-#-vm4079,4080,4081
-add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000")
-add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv")
-add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs")
+list(APPEND haskell_flags ${ghflags_parsed} "-O2")
 
 #get BUILD_TYPE and enable/disable optimisation
 message(STATUS "Using ${CMAKE_BUILD_TYPE} configuration")
--- a/COPYING	Fri Oct 11 11:55:31 2013 +0200
+++ b/COPYING	Fri Oct 11 17:43:13 2013 +0200
@@ -1,12 +1,12 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
+                GNU GENERAL PUBLIC LICENSE
+                   Version 2, June 1991
 
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-			    Preamble
+       Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -56,7 +56,7 @@
   The precise terms and conditions for copying, distribution and
 modification follow.
 
-		    GNU GENERAL PUBLIC LICENSE
+      GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License applies to any program or other work which contains
@@ -255,7 +255,7 @@
 of preserving the free status of all derivatives of our free software and
 of promoting the sharing and reuse of software generally.
 
-			    NO WARRANTY
+       NO WARRANTY
 
   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
@@ -277,9 +277,9 @@
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
+       END OF TERMS AND CONDITIONS
 
-	    How to Apply These Terms to Your New Programs
+     How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -338,3 +338,362 @@
 consider it more useful to permit linking proprietary applications with the
 library.  If this is what you want to do, use the GNU Library General
 Public License instead of this License.
+
+
+
+                GNU Free Documentation License
+                  Version 1.2, November 2002
+
+  Copyright (C) 2000,2001,2002  Free Software Foundation, Inc.
+  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+  Everyone is permitted to copy and distribute verbatim copies
+  of this license document, but changing it is not allowed.
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other functional
+and useful document "free" in the sense of freedom: to assure everyone the
+effective freedom to copy and redistribute it, with or without modifying it,
+either commercially or noncommercially. Secondarily, this License preserves for
+the author and publisher a way to get credit for their work, while not being
+considered responsible for modifications made by others.
+
+This License is a kind of "copyleft", which means that derivative works of the
+document must themselves be free in the same sense. It complements the GNU
+General Public License, which is a copyleft license designed for free software.
+
+We have designed this License in order to use it for manuals for free software,
+because free software needs free documentation: a free program should come with
+manuals providing the same freedoms that the software does. But this License is
+not limited to software manuals; it can be used for any textual work,
+regardless of subject matter or whether it is published as a printed book. We
+recommend this License principally for works whose purpose is instruction or
+reference.
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that contains
+a notice placed by the copyright holder saying it can be distributed under the
+terms of this License. Such a notice grants a world-wide, royalty-free license,
+unlimited in duration, to use that work under the conditions stated herein. The
+"Document", below, refers to any such manual or work. Any member of the public
+is a licensee, and is addressed as "you". You accept the license if you copy,
+modify or distribute the work in a way requiring permission under copyright
+law.
+
+A "Modified Version" of the Document means any work containing the Document or
+a portion of it, either copied verbatim, or with modifications and/or
+translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of the
+Document that deals exclusively with the relationship of the publishers or
+authors of the Document to the Document's overall subject (or to related
+matters) and contains nothing that could fall directly within that overall
+subject. (Thus, if the Document is in part a textbook of mathematics, a
+Secondary Section may not explain any mathematics.) The relationship could be a
+matter of historical connection with the subject or with related matters, or of
+legal, commercial, philosophical, ethical or political position regarding them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles are
+designated, as being those of Invariant Sections, in the notice that says that
+the Document is released under this License. If a section does not fit the
+above definition of Secondary then it is not allowed to be designated as
+Invariant. The Document may contain zero Invariant Sections. If the Document
+does not identify any Invariant Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed, as
+Front-Cover Texts or Back-Cover Texts, in the notice that says that the
+Document is released under this License. A Front-Cover Text may be at most 5
+words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy, represented
+in a format whose specification is available to the general public, that is
+suitable for revising the document straightforwardly with generic text editors
+or (for images composed of pixels) generic paint programs or (for drawings)
+some widely available drawing editor, and that is suitable for input to text
+formatters or for automatic translation to a variety of formats suitable for
+input to text formatters. A copy made in an otherwise Transparent file format
+whose markup, or absence of markup, has been arranged to thwart or discourage
+subsequent modification by readers is not Transparent. An image format is not
+Transparent if used for any substantial amount of text. A copy that is not
+"Transparent" is called "Opaque".
+
+Examples of suitable formats for Transparent copies include plain ASCII without
+markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly
+available DTD, and standard-conforming simple HTML, PostScript or PDF designed
+for human modification. Examples of transparent image formats include PNG, XCF
+and JPG. Opaque formats include proprietary formats that can be read and edited
+only by proprietary word processors, SGML or XML for which the DTD and/or
+processing tools are not generally available, and the machine-generated HTML,
+PostScript or PDF produced by some word processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself, plus such
+following pages as are needed to hold, legibly, the material this License
+requires to appear in the title page. For works in formats which do not have
+any title page as such, "Title Page" means the text near the most prominent
+appearance of the work's title, preceding the beginning of the body of the text.
+
+A section "Entitled XYZ" means a named subunit of the Document whose title
+either is precisely XYZ or contains XYZ in parentheses following text that
+translates XYZ in another language. (Here XYZ stands for a specific section
+name mentioned below, such as "Acknowledgements", "Dedications",
+"Endorsements", or "History".) To "Preserve the Title" of such a section when
+you modify the Document means that it remains a section "Entitled XYZ"
+according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which states
+that this License applies to the Document. These Warranty Disclaimers are
+considered to be included by reference in this License, but only as regards
+disclaiming warranties: any other implication that these Warranty Disclaimers
+may have is void and has no effect on the meaning of this License.
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either commercially or
+noncommercially, provided that this License, the copyright notices, and the
+license notice saying this License applies to the Document are reproduced in
+all copies, and that you add no other conditions whatsoever to those of this
+License. You may not use technical measures to obstruct or control the reading
+or further copying of the copies you make or distribute. However, you may
+accept compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and you may
+publicly display copies.
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have printed
+covers) of the Document, numbering more than 100, and the Document's license
+notice requires Cover Texts, you must enclose the copies in covers that carry,
+clearly and legibly, all these Cover Texts: Front-Cover Texts on the front
+cover, and Back-Cover Texts on the back cover. Both covers must also clearly
+and legibly identify you as the publisher of these copies. The front cover must
+present the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition. Copying with
+changes limited to the covers, as long as they preserve the title of the
+Document and satisfy these conditions, can be treated as verbatim copying in
+other respects.
+
+If the required texts for either cover are too voluminous to fit legibly, you
+should put the first ones listed (as many as fit reasonably) on the actual
+cover, and continue the rest onto adjacent pages.
+
+If you publish or distribute Opaque copies of the Document numbering more than
+100, you must either include a machine-readable Transparent copy along with each
+Opaque copy, or state in or with each Opaque copy a computer-network location
+from which the general network-using public has access to download using
+public-standard network protocols a complete Transparent copy of the Document,
+free of added material. If you use the latter option, you must take reasonably
+prudent steps, when you begin distribution of Opaque copies in quantity, to
+ensure that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an Opaque
+copy (directly or through your agents or retailers) of that edition to the
+public.
+
+It is requested, but not required, that you contact the authors of the Document
+well before redistributing any large number of copies, to give them a chance to
+provide you with an updated version of the Document.
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under the
+conditions of sections 2 and 3 above, provided that you release the Modified
+Version under precisely this License, with the Modified Version filling the role
+of the Document, thus licensing distribution and modification of the Modified
+Version to whoever possesses a copy of it. In addition, you must do these things
+in the Modified Version:
+
+    A. Use in the Title Page (and on the covers, if any) a title distinct from
+       that of the Document, and from those of previous versions (which should,
+       if there were any, be listed in the History section of the Document).
+       You may use the same title as a previous version if the original
+       publisher of that version gives permission.
+    B. List on the Title Page, as authors, one or more persons or entities
+       responsible for authorship of the modifications in the Modified Version,
+       together with at least five of the principal authors of the Document
+       (all of its principal authors, if it has fewer than five), unless they
+       release you from this requirement.
+    C. State on the Title page the name of the publisher of the Modified
+       Version, as the publisher.
+    D. Preserve all the copyright notices of the Document.
+    E. Add an appropriate copyright notice for your modifications adjacent to
+       the other copyright notices.
+    F. Include, immediately after the copyright notices, a license notice
+       giving the public permission to use the Modified Version under the terms
+       of this License, in the form shown in the Addendum below.
+    G. Preserve in that license notice the full lists of Invariant Sections and
+       required Cover Texts given in the Document's license notice.
+    H. Include an unaltered copy of this License.
+    I. Preserve the section Entitled "History", Preserve its Title, and add to
+       it an item stating at least the title, year, new authors, and publisher
+       of the Modified Version as given on the Title Page. If there is no
+       section Entitled "History" in the Document, create one stating the
+       title, year, authors, and publisher of the Document as given on its
+       Title Page, then add an item describing the Modified Version as stated
+       in the previous sentence.
+    J. Preserve the network location, if any, given in the Document for public
+       access to a Transparent copy of the Document, and likewise the network
+       locations given in the Document for previous versions it was based on.
+       These may be placed in the "History" section. You may omit a network
+       location for a work that was published at least four years before the
+       Document itself, or if the original publisher of the version it refers
+       to gives permission.
+    K. For any section Entitled "Acknowledgements" or "Dedications", Preserve
+       the Title of the section, and preserve in the section all the substance
+       and tone of each of the contributor acknowledgements and/or dedications
+       given therein.
+    L. Preserve all the Invariant Sections of the Document, unaltered in their
+       text and in their titles. Section numbers or the equivalent are not
+       considered part of the section titles.
+    M. Delete any section Entitled "Endorsements". Such a section may not be
+       included in the Modified Version.
+    N. Do not retitle any existing section to be Entitled "Endorsements" or to
+       conflict in title with any Invariant Section.
+    O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or appendices that
+qualify as Secondary Sections and contain no material copied from the Document,
+you may at your option designate some or all of these sections as invariant. To
+do this, add their titles to the list of Invariant Sections in the Modified
+Version's license notice. These titles must be distinct from any other section
+titles.
+
+You may add a section Entitled "Endorsements", provided it contains nothing but
+endorsements of your Modified Version by various parties--for example,
+statements of peer review or that the text has been approved by an organization
+as the authoritative definition of a standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a passage
+of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in
+the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover
+Text may be added by (or through arrangements made by) any one entity. If the
+Document already includes a cover text for the same cover, previously added by
+you or by arrangement made by the same entity you are acting on behalf of, you
+may not add another; but you may replace the old one, on explicit permission
+from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License give
+permission to use their names for publicity for or to assert or imply
+endorsement of any Modified Version.
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this License,
+under the terms defined in section 4 above for modified versions, provided that
+you include in the combination all of the Invariant Sections of all of the
+original documents, unmodified, and list them all as Invariant Sections of your
+combined work in its license notice, and that you preserve all their Warranty
+Disclaimers.
+
+The combined work need only contain one copy of this License, and multiple
+identical Invariant Sections may be replaced with a single copy. If there are
+multiple Invariant Sections with the same name but different contents, make the
+title of each such section unique by adding at the end of it, in parentheses,
+the name of the original author or publisher of that section if known, or else
+a unique number. Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled "History" in the
+various original documents, forming one section Entitled "History"; likewise
+combine any sections Entitled "Acknowledgements", and any sections Entitled
+"Dedications". You must delete all sections Entitled "Endorsements."
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this License
+in the various documents with a single copy that is included in the collection,
+provided that you follow the rules of this License for verbatim copying of each
+of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute it
+individually under this License, provided you insert a copy of this License into
+the extracted document, and follow this License in all other respects regarding
+verbatim copying of that document.
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate and
+independent documents or works, in or on a volume of a storage or distribution
+medium, is called an "aggregate" if the copyright resulting from the compilation
+is not used to limit the legal rights of the compilation's users beyond what the
+individual works permit. When the Document is included in an aggregate, this
+License does not apply to the other works in the aggregate which are not
+themselves derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these copies of the
+Document, then if the Document is less than one half of the entire aggregate,
+the Document's Cover Texts may be placed on covers that bracket the Document
+within the aggregate, or the electronic equivalent of covers if the Document is
+in electronic form. Otherwise they must appear on printed covers that bracket
+the whole aggregate.
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may distribute
+translations of the Document under the terms of section 4. Replacing Invariant
+Sections with translations requires special permission from their copyright
+holders, but you may include translations of some or all Invariant Sections in
+addition to the original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the Document, and
+any Warranty Disclaimers, provided that you also include the original English
+version of this License and the original versions of those notices and
+disclaimers. In case of a disagreement between the translation and the original
+version of this License or a notice or disclaimer, the original version will
+prevail.
+
+If a section in the Document is Entitled "Acknowledgements", "Dedications", or
+"History", the requirement (section 4) to Preserve its Title (section 1) will
+typically require changing the actual title.
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except as
+expressly provided for under this License. Any other attempt to copy, modify,
+sublicense or distribute the Document is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions of the GNU Free
+Documentation License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns. See http://www.gnu.org/copyleft/.
+
+Each version of the License is given a distinguishing version number. If the
+Document specifies that a particular numbered version of this License "or any
+later version" applies to it, you have the option of following the terms and
+conditions either of that specified version or of any later version that has
+been published (not as a draft) by the Free Software Foundation. If the Document
+does not specify a version number of this License, you may choose any version
+ever published (not as a draft) by the Free Software Foundation.  How to use
+this License for your documents
+
+To use this License in a document you have written, include a copy of the
+License in the document and put the following copyright and license notices just
+after the title page:
+
+  Copyright (c)  YEAR  YOUR NAME.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.2
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled "GNU
+  Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace
+the "with...Texts." line with this:
+
+  with the Invariant Sections being LIST THEIR TITLES, with the
+  Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other combination of
+the three, merge those two alternatives to suit the situation.
+
+If your document contains nontrivial examples of program code, we recommend
+releasing these examples in parallel under your choice of free software license,
+such as the GNU General Public License, to permit their use in free software.
+
--- a/QTfrontend/CMakeLists.txt	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/CMakeLists.txt	Fri Oct 11 17:43:13 2013 +0200
@@ -13,6 +13,12 @@
 find_package(Qt4 REQUIRED)
 include(${QT_USE_FILE})
 
+if(APPLE AND
+   ${QTVERSION} VERSION_GREATER "4.7.0" AND
+   ${QTVERSION} VERSION_LESS "4.7.4")
+    message(FATAL_ERROR "This version of QT is known *not* to work, please update or use a lower version")
+endif()
+
 find_package(SDL REQUIRED)       #video in SDLInteraction
 find_package(SDL_mixer REQUIRED) #audio in SDLInteraction
 
--- a/QTfrontend/HWApplication.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/HWApplication.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -38,6 +38,8 @@
 HWApplication::HWApplication(int &argc, char **argv) :
     QApplication(argc, argv)
 {
+    form = 0;
+
 #if !defined(Q_OS_WIN)
     signal(SIGINT, &terminateFrontend);
 #endif
--- a/QTfrontend/drawmapscene.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/drawmapscene.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -156,7 +156,7 @@
     if(m_isCursorShown)
         return;
 
-    if(items().size())
+    if(paths.size())
     {
         removeItem(items().first());
         paths.removeFirst();
@@ -183,15 +183,18 @@
     if(!items().size())
         return;
 
+    m_specialPoints.clear();
     oldItems.clear();
 
     // do this since clear() would _destroy_ all items
-    while(items().size())
+    for(int i = paths.size() - 1; i >= 0; --i)
     {
         oldItems.push_front(items().first());
         removeItem(items().first());
     }
 
+    items().clear();
+
     oldPaths = paths;
 
     paths.clear();
@@ -211,7 +214,7 @@
 
 QByteArray DrawMapScene::encode()
 {
-    QByteArray b;
+    QByteArray b(m_specialPoints);
 
     for(int i = paths.size() - 1; i >= 0; --i)
     {
@@ -247,9 +250,12 @@
     oldPaths.clear();
     clear();
     paths.clear();
+    m_specialPoints.clear();
 
     PathParams params;
 
+    bool isSpecial = true;
+
     while(data.size() >= 5)
     {
         qint16 px = qFromBigEndian(*(qint16 *)data.data());
@@ -258,9 +264,11 @@
         data.remove(0, 2);
         quint8 flags = *(quint8 *)data.data();
         data.remove(0, 1);
-
+        qDebug() << px << py;
         if(flags & 0x80)
         {
+            isSpecial = false;
+
             if(params.points.size())
             {
                 addPath(pointsToPath(params.points), m_pen);
@@ -278,9 +286,23 @@
             else
                 m_pen.setBrush(m_brush);
             params.width = penWidth;
-        }
+        } else
+            if(isSpecial)
+            {
+                QPainterPath path;
+                path.addEllipse(QPointF(px, py), 10, 10);
+
+                addPath(path);
 
-        params.points.append(QPoint(px, py));
+                qint16 x = qToBigEndian(px);
+                qint16 y = qToBigEndian(py);
+                m_specialPoints.append((const char *)&x, 2);
+                m_specialPoints.append((const char *)&y, 2);
+                m_specialPoints.append((const char *)&flags, 1);
+            }
+
+        if(!isSpecial)
+            params.points.append(QPoint(px, py));
     }
 
     if(params.points.size())
--- a/QTfrontend/drawmapscene.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/drawmapscene.h	Fri Oct 11 17:43:13 2013 +0200
@@ -66,6 +66,7 @@
         QList<QGraphicsItem *> oldItems;
         QGraphicsEllipseItem * m_cursor;
         bool m_isCursorShown;
+        QByteArray m_specialPoints;
 
         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * mouseEvent);
         virtual void mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent);
--- a/QTfrontend/game.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/game.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -17,6 +17,7 @@
  */
 
 #include <QString>
+#include <QCheckBox>
 #include <QByteArray>
 #include <QUuid>
 #include <QColor>
@@ -88,18 +89,6 @@
     SetGameState(gsStopped);
 }
 
-void HWGame::addKeyBindings(QByteArray * buf)
-{
-    for(int i = 0; i < BINDS_NUMBER; i++)
-    {
-        QString value = config->value(QString("Binds/%1").arg(cbinds[i].action), cbinds[i].strbind).toString();
-        if (value.isEmpty() || value == "default") continue;
-
-        QString bind = QString("edbind " + value + " " + cbinds[i].action);
-        HWProto::addStringToBuffer(*buf, bind);
-    }
-}
-
 void HWGame::commonConfig()
 {
     QByteArray buf;
@@ -117,8 +106,6 @@
     }
     HWProto::addStringToBuffer(buf, gt);
 
-    addKeyBindings(&buf);
-
     buf += gamecfg->getFullConfig();
 
     if (m_pTeamSelWidget)
@@ -131,7 +118,7 @@
             HWProto::addStringToBuffer(buf, QString("eammreinf %1").arg(ammostr.mid(3 * cAmmoNumber, cAmmoNumber)));
             if(gamecfg->schemeData(15).toBool() || !gamecfg->schemeData(21).toBool()) HWProto::addStringToBuffer(buf, QString("eammstore"));
             HWProto::addStringListToBuffer(buf,
-                                           team.teamGameConfig(gamecfg->getInitHealth(), config));
+                                           team.teamGameConfig(gamecfg->getInitHealth()));
             ;
         }
     }
@@ -149,8 +136,6 @@
     QByteArray teamscfg;
     ThemeModel * themeModel = DataManager::instance().themeModel();
 
-    addKeyBindings(&teamscfg);
-
     HWProto::addStringToBuffer(teamscfg, "TL");
     HWProto::addStringToBuffer(teamscfg, QString("etheme %1")
                                .arg((themeModel->rowCount() > 0) ? themeModel->index(rand() % themeModel->rowCount()).data(ThemeModel::ActualNameRole).toString() : "steel"));
@@ -164,7 +149,7 @@
     team1.setNumHedgehogs(4);
     HWNamegen::teamRandomNames(team1,true);
     HWProto::addStringListToBuffer(teamscfg,
-                                   team1.teamGameConfig(100, config));
+                                   team1.teamGameConfig(100));
 
     HWTeam team2;
     team2.setDifficulty(4);
@@ -174,7 +159,7 @@
         HWNamegen::teamRandomNames(team2,true);
     while(!team2.name().compare(team1.name()) || !team2.hedgehog(0).Hat.compare(team1.hedgehog(0).Hat));
     HWProto::addStringListToBuffer(teamscfg,
-                                   team2.teamGameConfig(100, config));
+                                   team2.teamGameConfig(100));
 
     HWProto::addStringToBuffer(teamscfg, QString("eammloadt %1").arg(cDefaultAmmoStore->mid(0, cAmmoNumber)));
     HWProto::addStringToBuffer(teamscfg, QString("eammprob %1").arg(cDefaultAmmoStore->mid(cAmmoNumber, cAmmoNumber)));
@@ -193,8 +178,6 @@
     HWProto::addStringToBuffer(traincfg, "eseed " + QUuid::createUuid().toString());
     HWProto::addStringToBuffer(traincfg, "escript " + training);
 
-    addKeyBindings(&traincfg);
-
     RawSendIPC(traincfg);
 }
 
@@ -206,8 +189,6 @@
 
     HWProto::addStringToBuffer(campaigncfg, "escript " + campaignScript);
 
-    addKeyBindings(&campaigncfg);
-
     RawSendIPC(campaigncfg);
 }
 
@@ -415,6 +396,15 @@
         arguments << nick;
     }
 
+    if (!config->Form->ui.pageOptions->CBTeamTag->isChecked())
+        arguments << "--no-teamtag";
+    if (!config->Form->ui.pageOptions->CBHogTag->isChecked())
+        arguments << "--no-hogtag";
+    if (!config->Form->ui.pageOptions->CBHealthTag->isChecked())
+        arguments << "--no-healthtag";
+    if (config->Form->ui.pageOptions->CBTagOpacity->isChecked())
+        arguments << "--translucent-tags";
+
     return arguments;
 }
 
--- a/QTfrontend/game.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/game.h	Fri Oct 11 17:43:13 2013 +0200
@@ -113,7 +113,6 @@
         GameType gameType;
         QByteArray m_netSendBuffer;
 
-        void addKeyBindings(QByteArray * buf);
         void commonConfig();
         void SendConfig();
         void SendQuickConfig();
--- a/QTfrontend/gameuiconfig.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -139,9 +139,14 @@
     Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
     Form->ui.pageOptions->fpsedit->setValue(value("fps/limit", 27).toUInt());
 
-    Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
+    Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", true).toBool());
     Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool());
 
+    Form->ui.pageOptions->CBTeamTag->setChecked(value("misc/teamtag", true).toBool());
+    Form->ui.pageOptions->CBHogTag->setChecked(value("misc/hogtag", true).toBool());
+    Form->ui.pageOptions->CBHealthTag->setChecked(value("misc/healthtag", true).toBool());
+    Form->ui.pageOptions->CBTagOpacity->setChecked(value("misc/tagopacity", false).toBool());
+
 #ifdef SPARKLE_ENABLED
     Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool());
 #endif
@@ -280,6 +285,12 @@
     setValue("fps/limit", Form->ui.pageOptions->fpsedit->value());
 
     setValue("misc/altdamage", isAltDamageEnabled());
+
+    setValue("misc/teamtag",   Form->ui.pageOptions->CBTeamTag->isChecked());
+    setValue("misc/hogtag",    Form->ui.pageOptions->CBHogTag->isChecked());
+    setValue("misc/healthtag", Form->ui.pageOptions->CBHealthTag->isChecked());
+    setValue("misc/tagopacity",Form->ui.pageOptions->CBTagOpacity->isChecked());
+
     setValue("misc/appendTimeToRecords", appendDateTimeToRecordName());
     setValue("misc/locale", language());
 
--- a/QTfrontend/hedgewars.qrc	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/hedgewars.qrc	Fri Oct 11 17:43:13 2013 +0200
@@ -28,16 +28,16 @@
         <file>res/botlevels/net3.png</file>
         <file>res/botlevels/net4.png</file>
         <file>res/botlevels/net5.png</file>
-        <file>res/campaign/A Classic Fairytale/first_blood.png</file>
-        <file>res/campaign/A Classic Fairytale/shadow.png</file>
-        <file>res/campaign/A Classic Fairytale/journey.png</file>
-        <file>res/campaign/A Classic Fairytale/united.png</file>
-        <file>res/campaign/A Classic Fairytale/backstab.png</file>
-        <file>res/campaign/A Classic Fairytale/dragon.png</file>
-        <file>res/campaign/A Classic Fairytale/family.png</file>
-        <file>res/campaign/A Classic Fairytale/queen.png</file>
-        <file>res/campaign/A Classic Fairytale/enemy.png</file>
-        <file>res/campaign/A Classic Fairytale/epil.png</file>
+        <file>res/campaign/A_Classic_Fairytale/first_blood.png</file>
+        <file>res/campaign/A_Classic_Fairytale/shadow.png</file>
+        <file>res/campaign/A_Classic_Fairytale/journey.png</file>
+        <file>res/campaign/A_Classic_Fairytale/united.png</file>
+        <file>res/campaign/A_Classic_Fairytale/backstab.png</file>
+        <file>res/campaign/A_Classic_Fairytale/dragon.png</file>
+        <file>res/campaign/A_Classic_Fairytale/family.png</file>
+        <file>res/campaign/A_Classic_Fairytale/queen.png</file>
+        <file>res/campaign/A_Classic_Fairytale/enemy.png</file>
+        <file>res/campaign/A_Classic_Fairytale/epil.png</file>
         <file>res/bonus.png</file>
         <file>res/Hedgehog.png</file>
         <file>res/net.png</file>
@@ -113,6 +113,7 @@
         <file>res/iconMine.png</file>
         <file>res/iconDud.png</file>
         <file>res/iconRope.png</file>
+        <file>res/iconEarth.png</file>
         <file>res/dice.png</file>
         <file>res/Star.png</file>
         <file>res/inverse-corner-bl.png</file>
@@ -164,5 +165,9 @@
         <file>res/splash.png</file>
         <file>res/html/about.html</file>
         <file>res/xml/tips.xml</file>
+        <file>res/chat/hedgehogcontributor.png</file>
+        <file>res/chat/hedgehogcontributor_gray.png</file>
+        <file>res/chat/roomadmincontributor.png</file>
+        <file>res/chat/roomadmincontributor_gray.png</file>
     </qresource>
 </RCC>
--- a/QTfrontend/hwform.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/hwform.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -165,14 +165,13 @@
 #endif
 
 #ifdef __APPLE__
-    AutoUpdater* updater = NULL;
     if (config->isAutoUpdateEnabled())
     {
-#ifdef __APPLE__
+        AutoUpdater* updater = NULL;
+
 #ifdef SPARKLE_ENABLED
         updater = new SparkleAutoUpdater();
 #endif
-#endif
         if (updater)
         {
             updater->checkForUpdates();
@@ -658,7 +657,7 @@
         }
 
         QList<HWTeam> teamsList;
-        for (QStringList::iterator it = tmNames.begin(); it != tmNames.end(); it++)
+        for (QStringList::iterator it = tmNames.begin(); it != tmNames.end(); ++it)
         {
             HWTeam team(*it);
             team.loadFromFile();
@@ -704,7 +703,7 @@
 
 void HWForm::GoToPage(int id)
 {
-    bool stopAnim = false;
+    //bool stopAnim = false;
 
     int lastid = ui.Pages->currentIndex();
     PagesStack.push(ui.Pages->currentIndex());
@@ -721,7 +720,7 @@
 
 
 #if (QT_VERSION >= 0x040600)
-    if (!stopAnim)
+    //if (!stopAnim)
     {
         /**Start animation :**/
         int coeff = 1;
@@ -817,7 +816,7 @@
         stopAnim = true; */
 
     if ((!hwnet) || (!hwnet->isInRoom()))
-        if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME)
+        if (id == ID_PAGE_NETGAME)
         {
             stopAnim = true;
             GoBack();
@@ -1723,7 +1722,7 @@
     CreateGame(0, 0, 0);
 
     QComboBox *combo = ui.pageCampaign->CBMission;
-    QString camp = ui.pageCampaign->CBCampaign->currentText();
+    QString camp = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
     unsigned int mNum = combo->count() - combo->currentIndex();
     QString miss = getCampaignScript(camp, mNum);
     QString campTeam = ui.pageCampaign->CBTeam->currentText();
@@ -1888,7 +1887,7 @@
     unsigned int n = entries.count();
     for(unsigned int i = 0; i < n; i++)
     {
-        ui.pageCampaign->CBCampaign->addItem(QString(entries[i]), QString(entries[i]));
+        ui.pageCampaign->CBCampaign->addItem(QString(entries[i]).replace(QString("_"),QString(" ")), QString(entries[i]).replace(QString("_"),QString(" ")));
     }
 }
 
@@ -1900,7 +1899,7 @@
     HWTeam team(ui.pageCampaign->CBTeam->currentText());
     ui.pageCampaign->CBMission->clear();
 
-    QString campaignName = ui.pageCampaign->CBCampaign->currentText();
+    QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
     QStringList missionEntries = getCampMissionList(campaignName);
     QString tName = team.name();
     unsigned int n = missionEntries.count();
@@ -1961,7 +1960,7 @@
 void HWForm::UpdateCampaignPageMission(int index)
 {
     // update thumbnail
-    QString campaignName = ui.pageCampaign->CBCampaign->currentText();
+    QString campaignName = ui.pageCampaign->CBCampaign->currentText().replace(QString(" "),QString("_"));
     unsigned int mNum = ui.pageCampaign->CBMission->count() - ui.pageCampaign->CBMission->currentIndex();
     QString image = getCampaignImage(campaignName,mNum);
     ui.pageCampaign->btnPreview->setIcon(QIcon((":/res/campaign/"+campaignName+"/"+image)));
@@ -2009,7 +2008,11 @@
                    + (config->isShowFPSEnabled() ? " --showfps" : "")
                    + (config->isAltDamageEnabled() ? " --altdmg" : "")
                    + " --frame-interval " + QString::number(config->timerInterval())
-                   + " --raw-quality " + QString::number(config->translateQuality()));
+                   + " --raw-quality " + QString::number(config->translateQuality()))
+                   + (!config->Form->ui.pageOptions->CBTeamTag->isChecked() ? " --no-teamtag" : "")
+                   + (!config->Form->ui.pageOptions->CBHogTag->isChecked() ? " --no-hogtag" : "")
+                   + (!config->Form->ui.pageOptions->CBHealthTag->isChecked() ? " --no-healthtag" : "")
+                   + (config->Form->ui.pageOptions->CBTagOpacity->isChecked() ? " --translucent-tags" : "");
 }
 
 void HWForm::AssociateFiles()
--- a/QTfrontend/model/ammoSchemeModel.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/model/ammoSchemeModel.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -64,6 +64,7 @@
                                 << QVariant(5)             // health dec amt 38
                                 << QVariant(100)           // rope modfier   39
                                 << QVariant(100)           // get away time  40
+                                << QVariant(0)             // world edge     41
                                 ;
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -128,6 +129,7 @@
               << "healthdecrease"      // 38
               << "ropepct"             // 39
               << "getawaytime"         // 40
+              << "worldedge"           // 41
               ;
 
     QList<QVariant> proMode;
@@ -173,6 +175,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> shoppa;
@@ -218,6 +221,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> cleanslate;
@@ -263,6 +267,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> minefield;
@@ -308,6 +313,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> barrelmayhem;
@@ -353,6 +359,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> tunnelhogs;
@@ -398,6 +405,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> forts;
@@ -443,6 +451,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> timeless;
@@ -488,6 +497,7 @@
             << QVariant(0)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> thinkingportals;
@@ -533,6 +543,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
     QList<QVariant> kingmode;
@@ -578,6 +589,7 @@
             << QVariant(5)             // health dec amt 38
             << QVariant(100)           // rope modfier   39
             << QVariant(100)           // get away time  40
+            << QVariant(0)             // world edge     41
             ;
 
 
--- a/QTfrontend/model/playerslistmodel.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/model/playerslistmodel.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -11,7 +11,8 @@
 PlayersListModel::PlayersListModel(QObject *parent) :
     QAbstractListModel(parent)
 {
-
+    m_fontInRoom = QFont();
+    m_fontInRoom.setItalic(true);
 }
 
 
@@ -223,6 +224,7 @@
         << index.data(Ignore).toBool()
         << index.data(InGame).toBool()
         << index.data(RoomFilterRole).toBool()
+        << index.data(InRoom).toBool()
         ;
 
     for(int i = flags.size() - 1; i >= 0; --i)
@@ -253,16 +255,26 @@
                 else
                     painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
             }
+        } else
+        { // we're in lobby
+            if(!index.data(InRoom).toBool())
+                painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/Flake.png"));
         }
 
         QString mainIconName(":/res/chat/");
 
-        if(index.data(RoomAdmin).toBool())
-            mainIconName += "roomadmin";
-        else if(index.data(ServerAdmin).toBool())
+        if(index.data(ServerAdmin).toBool())
             mainIconName += "serveradmin";
         else
-            mainIconName += "hedgehog";
+        {
+            if(index.data(RoomAdmin).toBool())
+                mainIconName += "roomadmin";
+            else
+                mainIconName += "hedgehog";
+
+            if(index.data(Contributor).toBool())
+                mainIconName += "contributor";
+        }
 
         if(!index.data(Registered).toBool())
             mainIconName += "_gray";
--- a/QTfrontend/model/playerslistmodel.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/model/playerslistmodel.h	Fri Oct 11 17:43:13 2013 +0200
@@ -6,6 +6,7 @@
 #include <QIcon>
 #include <QModelIndex>
 #include <QSet>
+#include <QFont>
 
 class PlayersListModel : public QAbstractListModel
 {
@@ -19,7 +20,9 @@
         Registered  = Qt::UserRole + 3,
         Friend      = Qt::UserRole + 4,
         Ignore      = Qt::UserRole + 5,
-        InGame      = Qt::UserRole + 6
+        InGame      = Qt::UserRole + 6,
+        InRoom      = Qt::UserRole + 7,
+        Contributor = Qt::UserRole + 8
     };
 
     enum SpecialRoles {
@@ -61,6 +64,7 @@
     QList<DataEntry> m_data;
     QSet<QString> m_friendsSet, m_ignoredSet;
     QString m_nickname;
+    QFont m_fontInRoom;
 
     void updateIcon(const QModelIndex & index);
     void updateSortData(const QModelIndex & index);
--- a/QTfrontend/net/newnetclient.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/net/newnetclient.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -436,6 +436,16 @@
                         foreach(const QString & nick, nicks)
                             m_playersModel->setFlag(nick, PlayersListModel::Registered, setFlag);
                         break;
+                // flag indicating if a player is in room
+                case 'i':
+                        foreach(const QString & nick, nicks)
+                            m_playersModel->setFlag(nick, PlayersListModel::InRoom, setFlag);
+                        break;
+                // flag indicating if a player is contributor
+                case 'c':
+                        foreach(const QString & nick, nicks)
+                            m_playersModel->setFlag(nick, PlayersListModel::InRoom, setFlag);
+                        break;
                 // flag indicating if a player has engine running
                 case 'g':
                     if(inRoom)
Binary file QTfrontend/res/campaign/A Classic Fairytale/backstab.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/dragon.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/enemy.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/epil.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/family.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/first_blood.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/journey.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/queen.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/shadow.png has changed
Binary file QTfrontend/res/campaign/A Classic Fairytale/united.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/backstab.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/dragon.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/enemy.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/epil.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/family.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/first_blood.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/journey.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/queen.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/shadow.png has changed
Binary file QTfrontend/res/campaign/A_Classic_Fairytale/united.png has changed
Binary file QTfrontend/res/chat/hedgehogcontributor.png has changed
Binary file QTfrontend/res/chat/hedgehogcontributor_gray.png has changed
Binary file QTfrontend/res/chat/roomadmincontributor.png has changed
Binary file QTfrontend/res/chat/roomadmincontributor_gray.png has changed
--- a/QTfrontend/res/html/about.html	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/res/html/about.html	Fri Oct 11 17:43:13 2013 +0200
@@ -77,12 +77,12 @@
             German: Peter Hüwe &lt;<a href="mailto:PeterHuewe@gmx.de">PeterHuewe@gmx.de</a>&gt;, Mario Liebisch &lt;<a href="mailto:mario.liebisch@gmail.com">mario.liebisch@gmail.com</a>&gt;, Richard Karolyi &lt;<a href="mailto:sheepluva@ercatec.net">sheepluva@ercatec.net</a>&gt;<br>
             Greek: &lt;<a href="mailto:talos_kriti@yahoo.gr">talos_kriti@yahoo.gr</a>&gt;<br>
             Italian: Luca Bonora &lt;<a href="mailto:bonora.luca@gmail.com">bonora.luca@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;<br>
-            Japanese: ADAM Etienne &lt;<a href="mailto:etienne.adam@gmail.com">etienne.adam@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;, 梅津洋恵<br>
+            Japanese: ADAM Etienne &lt;<a href="mailto:etienne.adam@gmail.com">etienne.adam@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;<br>
             Korean: Anthony Bellew &lt;<a href="mailto:anthonyreflected@gmail.com">anthonyreflected@gmail.com</a>&gt;<br>
             Lithuanian: Lukas Urbonas &lt;<a href="mailto:lukasu08@gmail.com">lukasu08@gmail.com</a>&gt;<br>
             Polish: Maciej Mroziński &lt;<a href="mailto:mynick2@o2.pl">mynick2@o2.pl</a>&gt;, Wojciech Latkowski &lt;<a href="mailto:magik17l@gmail.com">magik17l@gmail.com</a>&gt;, Piotr Mitana, Maciej Górny<br>
             Portuguese: Fábio Canário &lt;<a href="mailto:inufabie@gmail.com">inufabie@gmail.com</a>&gt;<br>
-            Russian: Andrey Korotaev &lt;<a href="mailto:unC0Rr@gmail.com">unC0Rr@gmail.com</a>&gt;<br>
+            Russian: Andrey Korotaev &lt;<a href="mailto:unC0Rr@gmail.com">unC0Rr@gmail.com</a>&gt;, Vitaly Novichkov &lt;<a href="mailto:admin@wohlnet.ru">admin@wohlnet.ru</a>&gt;<br>
             Slovak: Jose Riha<br>
             Spanish: Carlos Vives &lt;<a href="mailto:mail@carlosvives.es">mail@carlosvives.es</a>&gt;<br>
             Swedish: Niklas Grahn &lt;<a href="mailto:raewolusjoon@yaoo.com">raewolusjoon@yaoo.com</a>&gt;, Henrik Rostedt &lt;<a href="mailto:henrik.rostedt@gmail.com">henrik.rostedt@gmail.com</a>&gt;<br>
Binary file QTfrontend/res/iconEarth.png has changed
--- a/QTfrontend/team.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/team.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -171,7 +171,7 @@
 
 bool HWTeam::loadFromFile()
 {
-    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(m_name), QSettings::IniFormat, 0);
+    QSettings teamfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)), QSettings::IniFormat, 0);
     teamfile.setIniCodec("UTF-8");
     m_name = teamfile.value("Team/Name", m_name).toString();
     m_grave = teamfile.value("Team/Grave", "Statue").toString();
@@ -204,7 +204,7 @@
 
 bool HWTeam::fileExists()
 {
-    QFile f(QString("physfs://Teams/%1.hwt").arg(m_name));
+    QFile f(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)));
     return f.exists();
 }
 
@@ -212,7 +212,7 @@
 {
     if(m_isNetTeam)
         return false;
-    QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(m_name));
+    QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name)));
     cfgfile.remove();
     return true;
 }
@@ -221,12 +221,12 @@
 {
     if (OldTeamName != m_name)
     {
-        QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(OldTeamName));
+        QFile cfgfile(QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(OldTeamName)));
         cfgfile.remove();
         OldTeamName = m_name;
     }
 
-    QString fileName = QString("physfs://Teams/%1.hwt").arg(m_name);
+    QString fileName = QString("physfs://Teams/%1.hwt").arg(DataManager::safeFileName(m_name));
     DataManager::ensureFileExists(fileName);
     QSettings teamfile(fileName, QSettings::IniFormat, 0);
     teamfile.setIniCodec("UTF-8");
@@ -261,7 +261,7 @@
     return true;
 }
 
-QStringList HWTeam::teamGameConfig(quint32 InitHealth, GameUIConfig * config) const
+QStringList HWTeam::teamGameConfig(quint32 InitHealth) const
 {
     QStringList sl;
     if (m_isNetTeam)
@@ -276,17 +276,6 @@
     sl.push_back(QString("evoicepack " + m_voicepack));
     sl.push_back(QString("eflag " + m_flag));
 
-    if (!m_isNetTeam)
-    {
-        for(int i = 0; i < BINDS_NUMBER; i++)
-        {
-            if(m_binds[i].strbind.isEmpty() || m_binds[i].strbind == "default")
-                sl.push_back(QString("ebind " + config->bind(i) + " " + m_binds[i].action));
-            else
-                sl.push_back(QString("ebind " + m_binds[i].strbind + " " + m_binds[i].action));
-        }
-    }
-
     for (int t = 0; t < m_numHedgehogs; t++)
     {
         sl.push_back(QString("eaddhh %1 %2 %3")
--- a/QTfrontend/team.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/team.h	Fri Oct 11 17:43:13 2013 +0200
@@ -93,7 +93,7 @@
         void incWins();
 
         // convert team info into strings for further computation
-        QStringList teamGameConfig(quint32 InitHealth, GameUIConfig * config) const;
+        QStringList teamGameConfig(quint32 InitHealth) const;
 
         // comparison operators
         bool operator == (const HWTeam& t1) const;
--- a/QTfrontend/ui/dialog/upload_video.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/dialog/upload_video.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -291,7 +291,7 @@
     QNetworkReply *reply = (QNetworkReply*)sender();
     reply->deleteLater();
 
-    location = QString::fromAscii(reply->rawHeader("Location"));
+    location = QString::fromLatin1(reply->rawHeader("Location"));
     if (location.isEmpty())
     {
         QString errorStr = QMessageBox::tr("Error while sending metadata to youtube.com:\n");
--- a/QTfrontend/ui/page/pagecampaign.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pagecampaign.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -42,7 +42,7 @@
     infoLayout->setRowStretch(1, 1);
 
     // set this as default image first time page is created, this will change in hwform.cpp
-    btnPreview = formattedButton(":/res/campaign/A Classic Fairytale/first_blood.png", true);
+    btnPreview = formattedButton(":/res/campaign/A_Classic_Fairytale/first_blood.png", true);
     infoLayout->setAlignment(btnPreview, Qt::AlignHCenter | Qt::AlignVCenter);
 
     lbldescription = new QLabel();
--- a/QTfrontend/ui/page/pageeditteam.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -203,12 +203,18 @@
 {
     initPage();
 
-    QRegExp pngSuffix("\\.png$");
+    m_playerHash = "0000000000000000000000000000000000000000";
+    m_loaded = false;
+}
 
-    m_playerHash = "0000000000000000000000000000000000000000";
+void PageEditTeam::lazyLoad()
+{
+    if(m_loaded) return;
+    m_loaded = true;
+    qDebug("[LAZYNESS] PageEditTeam::lazyLoad()");
 
+    QRegExp pngSuffix("\\.png$");
     DataManager & dataMgr = DataManager::instance();
-
     QStringList list;
 
 
@@ -236,7 +242,7 @@
             pix = pix.copy(0, 0, 32, 32);
         QIcon icon(pix);
 
-        QString grave = QString(file).remove(pngSuffix);
+        QString grave = file.remove(pngSuffix);
 
         CBGrave->addItem(icon, grave);
     }
@@ -327,6 +333,8 @@
 void PageEditTeam::createTeam(const QString & name, const QString & playerHash)
 {
     m_playerHash = playerHash;
+    lazyLoad();
+
     HWTeam newTeam(name);
     loadTeam(newTeam);
 }
@@ -334,6 +342,8 @@
 void PageEditTeam::editTeam(const QString & name, const QString & playerHash)
 {
     m_playerHash = playerHash;
+    lazyLoad();
+
     HWTeam team(name);
     team.loadFromFile();
     loadTeam(team);
--- a/QTfrontend/ui/page/pageeditteam.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pageeditteam.h	Fri Oct 11 17:43:13 2013 +0200
@@ -66,6 +66,7 @@
         HWTeam data();
         QString m_playerHash;
         KeyBinder * binder;
+        bool m_loaded;
 
         QLayout * bodyLayoutDefinition();
         QLayout * footerLayoutDefinition();
@@ -78,6 +79,8 @@
         QPushButton * btnRandomTeam;
         QPushButton * btnTestSound;
 
+        void lazyLoad();
+
     private slots:
         void saveTeam();
         void setRandomNames();
--- a/QTfrontend/ui/page/pagenetserver.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pagenetserver.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -76,7 +76,7 @@
 
     BtnShare = new QPushButton(gb);
     BtnShare->setText(QPushButton::tr("Invite your friends to your server in just 1 click!"));
-    BtnShare->setWhatsThis(QPushButton::tr("Click to copy your unique server URL in your clipboard. Send this link to your friends ands and they will be able to join you."));
+    BtnShare->setWhatsThis(QPushButton::tr("Click to copy your unique server URL to your clipboard. Send this link to your friends and they will be able to join you."));
     gbLayout->addWidget(BtnShare, 2, 1);
 
     labelURL = new QLabel(gb);
--- a/QTfrontend/ui/page/pageoptions.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pageoptions.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -279,10 +279,10 @@
             // make some min/max-consts, shared with engine?
             windowWidthEdit = new QSpinBox(groupGame);
             windowWidthEdit->setRange(640, 102400);
-            windowWidthEdit->setFixedSize(55, CBResolution->height());
+            windowWidthEdit->setFixedSize(60, CBResolution->height());
             windowHeightEdit = new QSpinBox(groupGame);
             windowHeightEdit->setRange(480, 102400);
-            windowHeightEdit->setFixedSize(55, CBResolution->height());
+            windowHeightEdit->setFixedSize(60, CBResolution->height());
 
             winResLayout->addWidget(windowWidthEdit, 0);
             winResLayout->addWidget(winLabelX, 0);
@@ -365,6 +365,39 @@
             WeaponTooltip = new QCheckBox(groupGame);
             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
             groupGame->layout()->addWidget(WeaponTooltip, 9, 0, 1, 2);
+
+            groupGame->addDivider();
+
+            lblTags = new QLabel(groupGame);
+            lblTags->setText(QLabel::tr("Displayed tags above hogs and translucent tags"));
+            groupGame->layout()->addWidget(lblTags, 11, 0, 1, 2);
+
+            tagsContainer = new QWidget();
+            QHBoxLayout * tagsLayout = new QHBoxLayout(tagsContainer);
+            tagsLayout->setSpacing(0);
+            groupGame->layout()->addWidget(tagsContainer, 12, 0, 1, 2);
+
+            CBTeamTag = new QCheckBox(groupGame);
+            CBTeamTag->setText(QCheckBox::tr("Team"));
+            CBTeamTag->setWhatsThis(QCheckBox::tr("Enable team tags by default"));
+
+            CBHogTag = new QCheckBox(groupGame);
+            CBHogTag->setText(QCheckBox::tr("Hog"));
+            CBHogTag->setWhatsThis(QCheckBox::tr("Enable hedgehog tags by default"));
+
+            CBHealthTag = new QCheckBox(groupGame);
+            CBHealthTag->setText(QCheckBox::tr("Health"));
+            CBHealthTag->setWhatsThis(QCheckBox::tr("Enable health tags by default"));
+
+            CBTagOpacity = new QCheckBox(groupGame);
+            CBTagOpacity->setText(QCheckBox::tr("Translucent"));
+            CBTagOpacity->setWhatsThis(QCheckBox::tr("Enable translucent tags by default"));
+
+            tagsLayout->addWidget(CBTeamTag, 0);
+            tagsLayout->addWidget(CBHogTag, 0);
+            tagsLayout->addWidget(CBHealthTag, 0);
+            tagsLayout->addWidget(CBTagOpacity, 0);
+            tagsLayout->addStretch(1); 
         }
 
         { // group: frontend
--- a/QTfrontend/ui/page/pageoptions.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pageoptions.h	Fri Oct 11 17:43:13 2013 +0200
@@ -90,6 +90,13 @@
         QCheckBox *CBSavePassword;
         QCheckBox *CBAltDamage;
         QCheckBox *CBNameWithDate;
+
+
+        QCheckBox *CBTeamTag;
+        QCheckBox *CBHogTag;
+        QCheckBox *CBHealthTag;
+        QCheckBox *CBTagOpacity;
+
 #ifdef __APPLE__
         QCheckBox *CBAutoUpdate;
         QPushButton *BtnUpdateNow;
@@ -165,7 +172,9 @@
 
         QLabel * lblFullScreenRes;
         QLabel * lblWinScreenRes;
+        QLabel * lblTags;
         QWidget * winResContainer;
+        QWidget * tagsContainer;
 
     private slots:
         void forceFullscreen(int index);
--- a/QTfrontend/ui/page/pagescheme.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pagescheme.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -383,6 +383,23 @@
     glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1);
 
     l = new QLabel(gbBasicSettings);
+    l->setText(QLabel::tr("World Edge"));
+    l->setWordWrap(true);
+    glBSLayout->addWidget(l,15,0,1,1);
+    l = new QLabel(gbBasicSettings);
+    l->setFixedSize(32,32);
+    l->setPixmap(QPixmap(":/res/iconEarth.png"));
+    glBSLayout->addWidget(l,15,1,1,1);
+    CB_WorldEdge = new QComboBox(gbBasicSettings);
+    CB_WorldEdge->insertItem(0, tr("None (Default)"));
+    CB_WorldEdge->insertItem(1, tr("Wrap (World wraps)"));
+    CB_WorldEdge->insertItem(2, tr("Bounce (Edges reflect)"));
+    CB_WorldEdge->insertItem(3, tr("Sea (Edges connect to sea)"));
+    /* CB_WorldEdge->insertItem(4, tr("Skybox")); */
+    glBSLayout->addWidget(CB_WorldEdge,15,2,1,1);
+
+
+    l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Scheme Name:"));
 
     LE_name = new QLineEdit(this);
@@ -471,6 +488,7 @@
     mapper->addMapping(SB_HealthDecrease, 38);
     mapper->addMapping(SB_RopeModifier, 39);
     mapper->addMapping(SB_GetAwayTime, 40);
+    mapper->addMapping(CB_WorldEdge, 41, "currentIndex");
 
     mapper->toFirst();
 }
--- a/QTfrontend/ui/page/pagescheme.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pagescheme.h	Fri Oct 11 17:43:13 2013 +0200
@@ -91,6 +91,7 @@
         QSpinBox * SB_Explosives;
         QSpinBox * SB_RopeModifier;
         QSpinBox * SB_GetAwayTime;
+        QComboBox * CB_WorldEdge;
         QLineEdit * LE_name;
 
         QGroupBox * gbGameModes;
--- a/QTfrontend/ui/page/pagevideos.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/page/pagevideos.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -845,7 +845,7 @@
     for (int i = 0; i < array.size(); i++)
         array[i] = array[i] ^ 0xC4 ^ i;
     array = array.toBase64();
-    return QString::fromAscii(array.data());
+    return QString::fromLatin1(array.data());
 }
 
 static QString unprotectPass(QString str)
--- a/QTfrontend/ui/widget/about.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/about.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -39,6 +39,15 @@
 }
 #endif
 
+
+#if defined(Q_OS_WINDOWS)
+#define sopath(x) x ".dll"
+#elif defined(Q_OS_MAC)
+#define sopath(x) "@executable_path/../Frameworks/" x ".framework/" x
+#else
+#define sopath(x) "lib" x ".so"
+#endif
+
 #include "about.h"
 
 About::About(QWidget * parent) :
@@ -90,10 +99,62 @@
     libinfo.append(QString(tr("Unknown Compiler")).arg(__VERSION__) + QString("<br>"));
 #endif
 
+    const SDL_version *sdl_ver = SDL_Linked_Version();
     libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL</a> version: %1.%2.%3<br>")
-        .arg(SDL_MAJOR_VERSION)
-        .arg(SDL_MINOR_VERSION)
-        .arg(SDL_PATCHLEVEL));
+        .arg(sdl_ver->major)
+        .arg(sdl_ver->minor)
+        .arg(sdl_ver->patch));
+
+    const SDL_version *sdlmixer_ver = Mix_Linked_Version();
+    libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_mixer</a> version: %1.%2.%3<br>")
+        .arg(sdlmixer_ver->major)
+        .arg(sdlmixer_ver->minor)
+        .arg(sdlmixer_ver->patch));
+
+    // the remaining sdl modules used only in engine, so instead of needlessly linking them here
+    // we dynamically call the function returning the linked version
+    void *sdlnet_handle = SDL_LoadObject(sopath("SDL_net"));
+    if (sdlnet_handle != NULL) {
+        SDL_version *(*sdlnet_ver_get)(void) = NULL;
+        sdlnet_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlnet_handle, "SDLNet_Linked_Version");
+        if (sdlnet_ver_get != NULL) {
+            SDL_version *sdlnet_ver = sdlnet_ver_get();
+            libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_net</a> version: %1.%2.%3<br>")
+                .arg(sdlnet_ver->major)
+                .arg(sdlnet_ver->minor)
+                .arg(sdlnet_ver->patch));
+        }
+        SDL_UnloadObject(sdlnet_handle);
+    }
+
+    void *sdlimage_handle = SDL_LoadObject(sopath("SDL_image"));
+    if (sdlimage_handle != NULL) {
+        SDL_version *(*sdlimage_ver_get)(void) = NULL;
+        sdlimage_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlimage_handle, "IMG_Linked_Version");
+        if (sdlimage_ver_get != NULL) {
+            SDL_version *sdlimage_ver = sdlimage_ver_get();
+            libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_image</a> version: %1.%2.%3<br>")
+                .arg(sdlimage_ver->major)
+                .arg(sdlimage_ver->minor)
+                .arg(sdlimage_ver->patch));
+        }
+        SDL_UnloadObject(sdlnet_handle);
+    }
+
+    void *sdlttf_handle = SDL_LoadObject(sopath("SDL_ttf"));
+    if (sdlttf_handle != NULL) {
+        SDL_version *(*sdlttf_ver_get)(void) = NULL;
+        sdlttf_ver_get = (SDL_version *(*)(void)) SDL_LoadFunction(sdlttf_handle, "TTF_Linked_Version");
+        if (sdlttf_ver_get != NULL) {
+            SDL_version *sdlttf_ver = sdlttf_ver_get();
+            libinfo.append(QString("<a href=\"http://www.libsdl.org/\">SDL_ttf</a> version: %1.%2.%3<br>")
+                .arg(sdlttf_ver->major)
+                .arg(sdlttf_ver->minor)
+                .arg(sdlttf_ver->patch));
+        }
+        SDL_UnloadObject(sdlnet_handle);
+    }
+
 
     libinfo.append(QString("<a href=\"http://qt-project.org/\">Qt</a> version: %1<br>").arg(QT_VERSION_STR));
 
@@ -109,6 +170,8 @@
         .arg(PHYSFS_VER_MINOR)
         .arg(PHYSFS_VER_PATCH));
 
+    // TODO: how to add Lua information?
+
     QLabel * lblLibInfo = new QLabel();
     lblLibInfo->setOpenExternalLinks(true);
     lblLibInfo->setText(libinfo);
--- a/QTfrontend/ui/widget/chatwidget.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -930,3 +930,17 @@
         chatText->verticalScrollBar()->setValue(m_scrollBarPos);
     }
 }
+
+void HWChatWidget::resizeEvent(QResizeEvent * event)
+{
+    Q_UNUSED(event);
+
+    afterContentAdd();
+}
+
+void HWChatWidget::showEvent(QShowEvent * event)
+{
+    Q_UNUSED(event);
+
+     afterContentAdd();
+}
--- a/QTfrontend/ui/widget/chatwidget.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/chatwidget.h	Fri Oct 11 17:43:13 2013 +0200
@@ -68,6 +68,8 @@
     protected:
         virtual void dragEnterEvent(QDragEnterEvent * event);
         virtual void dropEvent(QDropEvent * event);
+        virtual void resizeEvent(QResizeEvent * event);
+        virtual void showEvent(QShowEvent * event);
 
     private:
         static QString * s_styleSheet;
--- a/QTfrontend/ui/widget/drawmapwidget.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/drawmapwidget.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -160,6 +160,7 @@
         }
         else
             m_scene->decode(qUncompress(QByteArray::fromBase64(f.readAll())));
+            //m_scene->decode(f.readAll());
     }
 }
 
--- a/QTfrontend/ui/widget/feedbackdialog.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/feedbackdialog.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -257,27 +257,24 @@
         case QSysInfo::WV_2003: os_version += "Windows Server 2003\n"; break;
         case QSysInfo::WV_VISTA: os_version += "Windows Vista\n"; break;
         case QSysInfo::WV_WINDOWS7: os_version += "Windows 7\n"; break;
-        //case QSysInfo::WV_WINDOWS8: os_version += "Windows 8\n"; break; //QT 5+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+        case QSysInfo::WV_WINDOWS8: os_version += "Windows 8\n"; break;
+#endif
         default: os_version += "Windows (Unknown version)\n"; break;
     }
     kernel_line += "Windows kernel\n";
 #endif
-#ifdef Q_OS_X11
+#ifdef Q_OS_LINUX
     number_of_cores += QString::number(sysconf(_SC_NPROCESSORS_ONLN)) + "\n";
-    long pages = sysconf(_SC_PHYS_PAGES),
-/*
-#ifndef Q_OS_FREEBSD
-         available_pages = sysconf(_SC_AVPHYS_PAGES),
-#else
-         available_pages = 0,
-#endif*/
-    page_size = sysconf(_SC_PAGE_SIZE);
-    total_ram += QString::number(pages*page_size/1024/1024) + " MB\n";
+    quint32 pages = sysconf(_SC_PHYS_PAGES);
+    quint32 page_size = sysconf(_SC_PAGE_SIZE);
+    quint32 total = pages * page_size / 1024 / 1024;
+    total_ram += QString::number(total) + " MB\n";
     os_version += "GNU/Linux or BSD\n";
 #endif
 
     // uname -a
-#if defined(Q_OS_X11) || defined(Q_OS_MAC)
+#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
     QProcess *process = new QProcess();
     QStringList arguments = QStringList("-a");
     process->start("uname", arguments);
@@ -432,7 +429,7 @@
 
 void FeedbackDialog::finishedSlot(QNetworkReply* reply)
 {
-    if (reply && reply->error() == QNetworkReply::NoError)
+    if (reply->error() == QNetworkReply::NoError)
     {
             QMessageBox infoMsg(this);
             infoMsg.setIcon(QMessageBox::Information);
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -321,6 +321,7 @@
     bcfg << QString("e$healthdec %1").arg(schemeData(38).toInt()).toUtf8();
     bcfg << QString("e$ropepct %1").arg(schemeData(39).toInt()).toUtf8();
     bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8();
+    bcfg << QString("e$worldedge %1").arg(schemeData(41).toInt()).toUtf8();
     bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8();
     bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8();
 
--- a/QTfrontend/ui/widget/mapContainer.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -347,15 +347,16 @@
 
 void HWMapContainer::previewClicked()
 {
-    switch (m_mapInfo.type)
-    {
-        case MapModel::HandDrawnMap:
-            emit drawMapRequested();
-            break;
-        default:
-            setRandomMap();
-            break;
-    }
+    if (isMaster()) // should only perform these if master, but disabling the button when not, causes an unattractive preview.
+        switch (m_mapInfo.type)
+        {
+            case MapModel::HandDrawnMap:
+                emit drawMapRequested();
+                break;
+            default:
+                setRandomMap();
+                break;
+        }
 }
 
 QString HWMapContainer::getCurrentSeed() const
--- a/QTfrontend/util/DataManager.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/util/DataManager.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -199,6 +199,15 @@
     return m_settingsFileName;
 }
 
+QString DataManager::safeFileName(QString fileName)
+{
+    fileName.replace('\\', '_');
+    fileName.replace('/', '_');
+    fileName.replace(':', '_');
+
+    return fileName;
+}
+
 void DataManager::reload()
 {
     // removed for now (also code was a bit unclean, could lead to segfault if
--- a/QTfrontend/util/DataManager.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/util/DataManager.h	Fri Oct 11 17:43:13 2013 +0200
@@ -119,6 +119,8 @@
 
         QString settingsFileName();
 
+        static QString safeFileName(QString fileName);
+
         static bool ensureFileExists(const QString & fileName);
 
     public slots:
--- a/QTfrontend/util/FileEngine.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/util/FileEngine.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -54,7 +54,7 @@
     }
 
     if (!m_handle) {
-        qWarning(QString("[PHYSFS] Failed to open %1, reason: %2").arg(m_fileName).arg(FileEngineHandler::errorStr()).toLocal8Bit().constData());
+        qWarning("%s", QString("[PHYSFS] Failed to open %1, reason: %2").arg(m_fileName).arg(FileEngineHandler::errorStr()).toLocal8Bit().constData());
         return false;
     }
 
@@ -311,7 +311,7 @@
 {
     PHYSFS_init(argv0);
 
-    qDebug(QString("[PHYSFS] Init: %1").arg(errorStr()).toLocal8Bit().constData());
+    qDebug("%s", QString("[PHYSFS] Init: %1").arg(errorStr()).toLocal8Bit().constData());
 }
 
 FileEngineHandler::~FileEngineHandler()
@@ -330,19 +330,19 @@
 void FileEngineHandler::mount(const QString &path)
 {
     PHYSFS_mount(path.toUtf8().constData(), NULL, 0);
-    qDebug(QString("[PHYSFS] Mounting '%1' to '/': %2").arg(path).arg(errorStr()).toLocal8Bit().constData());
+    qDebug("%s", QString("[PHYSFS] Mounting '%1' to '/': %2").arg(path).arg(errorStr()).toLocal8Bit().constData());
 }
 
 void FileEngineHandler::mount(const QString & path, const QString & mountPoint)
 {
     PHYSFS_mount(path.toUtf8().constData(), mountPoint.toUtf8().constData(), 0);
-    qDebug(QString("[PHYSFS] Mounting '%1' to '%2': %3").arg(path).arg(mountPoint).arg(errorStr()).toLocal8Bit().data());
+    qDebug("%s", QString("[PHYSFS] Mounting '%1' to '%2': %3").arg(path).arg(mountPoint).arg(errorStr()).toLocal8Bit().data());
 }
 
 void FileEngineHandler::setWriteDir(const QString &path)
 {
     PHYSFS_setWriteDir(path.toUtf8().constData());
-    qDebug(QString("[PHYSFS] Setting write dir to '%1': %2").arg(path).arg(errorStr()).toLocal8Bit().data());
+    qDebug("%s", QString("[PHYSFS] Setting write dir to '%1': %2").arg(path).arg(errorStr()).toLocal8Bit().data());
 }
 
 void FileEngineHandler::mountPacks()
--- a/QTfrontend/util/LibavInteraction.cpp	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/util/LibavInteraction.cpp	Fri Oct 11 17:43:13 2013 +0200
@@ -30,6 +30,10 @@
 
 #include "HWApplication.h"
 
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 25, 0)
+#define CodecID AVCodecID
+#endif
+
 struct Codec
 {
     CodecID id;
--- a/QTfrontend/util/LibavInteraction.h	Fri Oct 11 11:55:31 2013 +0200
+++ b/QTfrontend/util/LibavInteraction.h	Fri Oct 11 17:43:13 2013 +0200
@@ -16,8 +16,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
-#ifndef LIBAV_ITERACTION
-#define LIBAV_ITERACTION
+#ifndef LIBAV_INTERACTION
+#define LIBAV_INTERACTION
 
 #include <QComboBox>
 
@@ -48,4 +48,4 @@
     QString getFileInfo(const QString & filepath);
 };
 
-#endif // LIBAV_ITERACTION
+#endif // LIBAV_INTERACTION
--- a/README	Fri Oct 11 11:55:31 2013 +0200
+++ b/README	Fri Oct 11 17:43:13 2013 +0200
@@ -1,17 +1,46 @@
 Hedgewars - a turn based strategy game.
-Distributed under the terms of the GNU GPL licence.
-Images and sounds are distributed under the terms of the GNU FDL licence.
+=======================================
+
+Copyright 2004-2013 Andrey Korotaev <unC0Rr@gmail.com> and others.
+See QTfrontend/res/html/about.html and CREDITS for a complete list of authors.
 
-Source:
-Copyright 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
-Portions copyright 2006-2008 Igor Ulyanov aka Displacer <iulyanov@gmail.com>
+Licence:
+--------
+Source code is distributed under the terms of the GNU General Public Licence
+version 2; images and sounds are distributed under the terms of the GNU Free
+Documentation Licence version 1.2. See the COPYING file for the full text of
+the licenses.
 
 Instructions:
-depending on your system, consult our wiki at:
-- http://code.google.com/p/hedgewars/wiki/BuildingOnLinux
-- http://code.google.com/p/hedgewars/wiki/BuildingOnWindows
-- http://code.google.com/p/hedgewars/wiki/BuildingOnMac
+-------------
+See our wiki at: https://code.google.com/p/hedgewars/wiki/BuildingHedgewars
+
+You can find an outline of the necessary dependencies in the INSTALL file.
+
+Source code:
+------------
+Our main repository is located at http://hedgewars.googlecode.com using
+Mercurial as DVCS. A Git repository is also available (mirrored daily)
+at https://github.com/hedgewars/hw
 
-Dependencies:
-you can find an outline of the necessary dependencies in the INSTALL file.
+Contribute:
+-----------
+If you see a bug or have any suggestion please use the official bug tracker at
+http://code.google.com/p/hedgewars/issues/list or the integrated feedback
+button.
+
+If you want to help or get to know the sources better you can do that with some
+easy tasks from http://code.google.com/p/hedgewars/wiki/TODO. We also have an
+extended API in LUA to customize your adventures in our wiki at
+http://code.google.com/p/hedgewars/wiki/LuaAPI.
 
+If you know your way through the code feel free to send a patch or open a pull
+request. The best LUA scripts get released in the official DLC page and later
+integrated in the next version.
+
+Contact:
+--------
+* IRC channel     - irc://irc.freenode.net/hedgewars
+* community forum - http://www.hedgewars.org/forum
+* mailing list    - https://mail.gna.org/listinfo/hedgewars-dev
+
--- a/cmake_modules/CMakeDeterminePascalCompiler.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/CMakeDeterminePascalCompiler.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -5,6 +5,9 @@
 # the cmake variable CMAKE_GENERATOR_PASCAL which can be defined by a generator
 # as a default compiler
 
+# NOTE: on Darwin cmake >= 2.8.11 until cmake <= 2.8.12.1 will add an incompatible
+# -F flag to <FLAGS> so you won't be able to use those versions with this script
+
 if(NOT CMAKE_Pascal_COMPILER)
     # prefer the environment variable FPC
     if($ENV{FPC} MATCHES ".+")
@@ -45,6 +48,7 @@
                     OUTPUT_VARIABLE CMAKE_Pascal_COMPILER_VERSION
                     OUTPUT_STRIP_TRAILING_WHITESPACE
                     ) # we assume no error for something so simple
+    set(CMAKE_Pascal_COMPILER_ARG1 "-l- -v0ewn")
 endif(NOT CMAKE_Pascal_COMPILER_VERSION)
 mark_as_advanced(CMAKE_Pascal_COMPILER_VERSION)
 
--- a/cmake_modules/CMakePascalInformation.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/CMakePascalInformation.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -2,13 +2,13 @@
 # It also loads the available platform file for the system-compiler
 # if it exists.
 
+# in case fpc ever becomes included in cmake
 get_filename_component(CMAKE_BASE_NAME ${CMAKE_Pascal_COMPILER} NAME_WE)
 set(CMAKE_SYSTEM_AND_Pascal_COMPILER_INFO_FILE
     ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
 include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
 
 # This section should actually be in Platform/${CMAKE_SYSTME_NAME}-fpc.cmake
-set(CMAKE_Pascal_FLAGS_INIT "-l- -v0ewn")
 set(CMAKE_Pascal_FLAGS_DEBUG_INIT "-g -gl -gp -gh")
 set(CMAKE_Pascal_FLAGS_MINSIZEREL_INIT "-Os -dNDEBUG")
 set(CMAKE_Pascal_FLAGS_RELEASE_INIT "-O3 -dNDEBUG")
@@ -33,31 +33,34 @@
 # so if these are not set just copy the flags from the c version
 
 # No flags supported during linking as a shell script takes care of it
-if(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS)
-#-dynamiclib -Wl,-headerpad_max_install_names for C
-    set(CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
-endif(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS)
+# however to avoid interferences we escape -Wl flags to the Pascal -k
+#if(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS)
+#-shared (linux) / -dynamiclib -Wl,-headerpad_max_install_names (darwin)
+#    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
+#endif(NOT CMAKE_SHARED_LIBRARY_CREATE_Pascal_FLAGS)
 
-if(NOT CMAKE_SHARED_LIBRARY_Pascal_FLAGS)
-    #another similarity, fpc: -fPIC  Same as -Cg
-    #(maybe required only for x86_64)
-    set(CMAKE_SHARED_LIBRARY_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
-endif(NOT CMAKE_SHARED_LIBRARY_Pascal_FLAGS)
+if(NOT CMAKE_SHARED_LIBRARY_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_C_FLAGS)
+#-fPIC
+    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+endif()
 
-if(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS)
-    set(CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
-endif(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS)
+if(NOT CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS AND CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
+#-rdynamic (linux) / (empty on darwin)
+    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_LIBRARY_LINK_Pascal_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
+endif()
 
-#if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG)
-#    set(CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
-#endif(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG)
+if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG)
+#-Wl,-rpath,
+    set(CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG "-k-rpath")
+endif(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG)
 
-#if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP)
-#    set(CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
-#endif(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP)
+if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP)
+    set(CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+endif(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG_SEP)
 
 if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG)
-    set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+#-Wl,-rpath-link,
+    set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG "-k-rpath-link")
 endif(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Pascal_FLAG)
 
 # for most systems a module is the same as a shared library
@@ -69,13 +72,14 @@
 endif(NOT CMAKE_MODULE_EXISTS)
 
 # repeat for modules
-if(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS)
-    set(CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
-endif(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS)
+if(NOT CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS AND CMAKE_SHARED_MODULE_CREATE_C_FLAGS)
+# ? (linux) / -bundle -Wl,-headerpad_max_install_names (darwin)
+    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_CREATE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
+endif()
 
-if(NOT CMAKE_SHARED_MODULE_Pascal_FLAGS)
-    set(CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
-endif(NOT CMAKE_SHARED_MODULE_Pascal_FLAGS)
+if(NOT CMAKE_SHARED_MODULE_Pascal_FLAGS AND CMAKE_SHARED_MODULE_C_FLAGS)
+    string(REGEX REPLACE "-Wl," "-k" CMAKE_SHARED_MODULE_Pascal_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
+endif()
 
 if(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG)
     set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG})
@@ -85,6 +89,7 @@
     set(CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP})
 endif(NOT CMAKE_SHARED_MODULE_RUNTIME_Pascal_FLAG_SEP)
 
+# now other system things
 if(NOT CMAKE_INCLUDE_FLAG_Pascal)
     #amazing, fpc: -I<x>  Add <x> to include path
     set(CMAKE_INCLUDE_FLAG_Pascal ${CMAKE_INCLUDE_FLAG_C})
@@ -94,14 +99,20 @@
     set(CMAKE_INCLUDE_FLAG_SEP_Pascal ${CMAKE_INCLUDE_FLAG_SEP_C})
 endif(NOT CMAKE_INCLUDE_FLAG_SEP_Pascal)
 
+if(NOT CMAKE_Pascal_FRAMEWORK_SEARCH_FLAG)
+    #however -F won't work, -Ff is Pascal equivalent
+    set(CMAKE_Pascal_FRAMEWORK_SEARCH_FLAG "-Ff")
+endif(NOT CMAKE_Pascal_FRAMEWORK_SEARCH_FLAG)
+
 # Copy C version of this flag which is normally determined in platform file.
 if(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG)
+#-soname (linux) / -install-name (dawin)
     set(CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
 endif(NOT CMAKE_SHARED_LIBRARY_SONAME_Pascal_FLAG)
 
 set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make.  This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
 
-set(CMAKE_Pascal_FLAGS "$ENV{FPFLAGS} ${CMAKE_Pascal_FLAGS_INIT} ${CMAKE_Pascal_FLAGS}" CACHE STRING "Flags for Pascal compiler.")
+#set(CMAKE_Pascal_FLAGS "$ENV{FPFLAGS} ${CMAKE_Pascal_FLAGS_INIT} ${CMAKE_Pascal_FLAGS}" CACHE STRING "Flags for Pascal compiler." FORCE)
 
 include(CMakeCommonLanguageInclude)
 
@@ -161,18 +172,27 @@
     if(UNIX)
         #when you have multiple ld installation make sure you get the one bundled with the system C compiler
         include(Platform/${CMAKE_SYSTEM_NAME}-GNU-C.cmake OPTIONAL)
-        if(CMAKE_C_COMPILER)
+        if(CMAKE_COMPILER_IS_GNUCC)
             get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} PATH)
             set(CMAKE_Pascal_UNIX_FLAGS "-FD${CMAKE_C_COMPILER_DIR}")
-        endif(CMAKE_C_COMPILER)
+        endif(CMAKE_COMPILER_IS_GNUCC)
         if(APPLE)
-            #add user framework directory
-            set(CMAKE_Pascal_UNIX_FLAGS "-Ff~/Library/Frameworks ${CMAKE_Pascal_UNIX_FLAGS}")
+            #TODO: take care of CMAKE_INSTALL_NAME_DIR for shared targets
+        else(APPLE)
+            if(CMAKE_INSTALL_RPATH)
+                #need to escape twice because we use a script to link
+                #\\\\ is just \\ which escapes '\' in the final script
+                #same for $$ which escapes '$' in cmake
+                string(REGEX REPLACE "\\$" "\\\\$$" CMAKE_INSTALL_RPATH_ESCAPED ${CMAKE_INSTALL_RPATH})
+                #normally this flag is found in <LINK_LIBRARIES> but that's not active here
+                set(CMAKE_Pascal_UNIX_FLAGS "${CMAKE_SHARED_LIBRARY_RUNTIME_Pascal_FLAG} -k'${CMAKE_INSTALL_RPATH_ESCAPED}' ${CMAKE_Pascal_UNIX_FLAGS}")
+            endif()
         endif(APPLE)
     endif(UNIX)
 
+    #-Cn is mandatory as it's what creates the ppas.* script
     set(CMAKE_Pascal_COMPILE_OBJECT
-        "<CMAKE_Pascal_COMPILER> -Cn -FE${EXECUTABLE_OUTPUT_PATH} -FU${CMAKE_CURRENT_BINARY_DIR}/<OBJECT_DIR> ${CMAKE_Pascal_UNIX_FLAGS} <FLAGS> <SOURCE>")
+        "<CMAKE_Pascal_COMPILER> -Cn -FE${EXECUTABLE_OUTPUT_PATH} -FU${CMAKE_CURRENT_BINARY_DIR}/<OBJECT_DIR> ${CMAKE_Pascal_UNIX_FLAGS} <FLAGS> <CMAKE_Pascal_LINK_FLAGS> <SOURCE>")
 endif(NOT CMAKE_Pascal_COMPILE_OBJECT)
 
 # link Pascal objects in a single executable
--- a/cmake_modules/FindFFMPEG.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/FindFFMPEG.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -25,18 +25,23 @@
 # use pkg-config to get the directories and then use these values
 # in the FIND_PATH() and FIND_LIBRARY() calls
 find_package(PkgConfig)
-if (PKG_CONFIG_FOUND)
-    pkg_check_modules(_FFMPEG_AVCODEC libavcodec ${VERBOSITY})
-    pkg_check_modules(_FFMPEG_AVFORMAT libavformat ${VERBOSITY})
-    pkg_check_modules(_FFMPEG_AVUTIL libavutil ${VERBOSITY})
-endif (PKG_CONFIG_FOUND)
+if(PKG_CONFIG_FOUND)
+    if(NOT LIBAVCODEC_INCLUDE_DIR OR NOT LIBAVCODEC_LIBRARY)
+        pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
+    endif()
+    if(NOT LIBAVFORMAT_LIBRARY)
+        pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
+    endif()
+    if(NOT LIBAVUTIL_LIBRARY)
+        pkg_check_modules(_FFMPEG_AVUTIL libavutil)
+    endif()
+endif(PKG_CONFIG_FOUND)
 
 find_path(LIBAVCODEC_INCLUDE_DIR
     NAMES libavcodec/avcodec.h
-    PATHS ${_AVCODEC_INCLUDE_DIRS}
-        /usr/include /usr/local/include #system level
-        /opt/local/include #macports
-        /sw/include #fink
+    PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS}    #pkg-config
+          /usr/include /usr/local/include    #system level
+          /opt/local/include /sw/include     #macports & fink
     PATH_SUFFIXES libav ffmpeg
 )
 
@@ -44,26 +49,23 @@
 
 find_library(LIBAVCODEC_LIBRARY
     NAMES avcodec
-    PATHS ${_AVCODEC_LIBRARY_DIRS}
-        /usr/lib /usr/local/lib #system level
-        /opt/local/lib #macports
-        /sw/lib #fink
+    PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS}   #pkg-config
+          /usr/lib /usr/local/lib           #system level
+          /opt/local/lib /sw/lib            #macports & fink
 )
 
 find_library(LIBAVFORMAT_LIBRARY
     NAMES avformat
-    PATHS ${_AVFORMAT_LIBRARY_DIRS}
-        /usr/lib /usr/local/lib #system level
-        /opt/local/lib #macports
-        /sw/lib #fink
+    PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS}  #pkg-config
+          /usr/lib /usr/local/lib           #system level
+          /opt/local/lib /sw/lib            #macports & fink
 )
 
 find_library(LIBAVUTIL_LIBRARY
     NAMES avutil
-    PATHS ${_AVUTIL_LIBRARY_DIRS}
-        /usr/lib /usr/local/lib #system level
-        /opt/local/lib #macports
-        /sw/lib #fink
+    PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS}    #pkg-config
+          /usr/lib /usr/local/lib           #system level
+          /opt/local/lib /sw/lib            #macports & fink
 )
 
 find_package_handle_standard_args(FFMPEG DEFAULT_MSG LIBAVCODEC_LIBRARY LIBAVCODEC_INCLUDE_DIR
--- a/cmake_modules/compilerchecks.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -8,69 +8,83 @@
 # CMAKE_SHARED_LIBRARY_<lang>_FLAGS same but for shared libraries
 
 #TODO: should there be two different checks for C and CXX?
+#TODO: can the various if(platform) be avoided in some way?
 
-#stack protection, when found it needs to go in the linker flags too
-#it is disabled on win32 because it adds a dll and messes with linker
-#(see 822312 654424 on bugzilla.redhat.com)
-check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
-if(HAVE_STACKPROTECTOR AND (NOT WIN32))
-    add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector")
-    add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector")
-    add_flag_append(CMAKE_EXE_LINKER_FLAGS "-fstack-protector-all -fstack-protector")
-    add_flag_append(CMAKE_SHARED_LIBRARY_C_FLAGS "-fstack-protector-all -fstack-protector")
-    add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fstack-protector-all -fstack-protector")
-endif()
 
-#symbol visibility, not supported on Windows
-check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY)
-if(HAVE_VISIBILITY AND (NOT WIN32))
-    add_flag_append(CMAKE_C_FLAGS "-fvisibility=hidden")
-    add_flag_append(CMAKE_CXX_FLAGS "-fvisibility=hidden")
+if(NOT (WIN32 OR (CMAKE_SYSTEM_NAME MATCHES BSD.OS) OR (CMAKE_SYSTEM_NAME MATCHES FreeBSD)))
+    #stack protection, when found it needs to go in the linker flags too
+    #it is disabled on win32 because it adds a dll and messes with linker
+    #some bsd installations reported problems too
+    #(see 822312 654424 on bugzilla.redhat.com)
+    check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
+    if(HAVE_STACKPROTECTOR)
+        add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector")
+        add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector")
+    endif()
 endif()
 
 
-#check for noexecstack on ELF, Gentoo security
-set(CMAKE_REQUIRED_FLAGS "-Wl,-z,noexecstack")
-check_c_compiler_flag("" HAVE_NOEXECSTACK)
-if(HAVE_NOEXECSTACK)
-    add_linker_flag("-znoexecstack")
-endif()
+
+if(UNIX)
+    #symbol visibility
+    check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY)
+    if(HAVE_VISIBILITY)
+        add_flag_append(CMAKE_C_FLAGS "-fvisibility=hidden")
+        add_flag_append(CMAKE_CXX_FLAGS "-fvisibility=hidden")
+    endif()
 
-#check for full relro on ELF, Debian security
-set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
-check_c_compiler_flag("" HAVE_RELROFULL)
-if(HAVE_RELROFULL)
-    add_linker_flag("-zrelro")
-    add_linker_flag("-znow")
-else()
-    #if full relro is not available, try partial relro
-    set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro")
-    check_c_compiler_flag("" HAVE_RELROPARTIAL)
-    if(HAVE_RELROPARTIAL)
-        add_linker_flag("-zrelro")
+    #check for noexecstack on ELF, Gentoo security
+    set(CMAKE_REQUIRED_FLAGS "-Wl,-znoexecstack")
+    check_c_compiler_flag("" HAVE_NOEXECSTACK)
+    if(HAVE_NOEXECSTACK)
+        add_linker_flag("-znoexecstack")
+    endif()
+
+    #check for origin on ELF, BSD $ORIGIN support
+    set(CMAKE_REQUIRED_FLAGS "-Wl,-zorigin")
+    check_c_compiler_flag("" HAVE_ORIGIN)
+    if(HAVE_ORIGIN)
+        add_linker_flag("-zorigin")
     endif()
-endif()
 
-#check for ASLR on Windows Vista or later, requires binutils >= 2.20
-set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
-check_c_compiler_flag("" HAVE_WINASLR)
-if(HAVE_WINASLR)
-    add_linker_flag("--nxcompat")
-endif()
+    #check for full relro on ELF, Debian security
+    set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
+    check_c_compiler_flag("" HAVE_RELROFULL)
+    if(HAVE_RELROFULL)
+        add_linker_flag("-zrelro")
+        add_linker_flag("-znow")
+    else()
+        #if full relro is not available, try partial relro
+        set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro")
+        check_c_compiler_flag("" HAVE_RELROPARTIAL)
+        if(HAVE_RELROPARTIAL)
+            add_linker_flag("-zrelro")
+        endif()
+    endif()
 
-#check for DEP on Windows XP SP2 or later, requires binutils >= 2.20
-set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
-check_c_compiler_flag("" HAVE_WINDEP)
-if(HAVE_WINDEP)
-    add_linker_flag("--dynamicbase")
-endif()
+    if(CMAKE_BUILD_TYPE MATCHES "RELEASE")
+        set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed")
+        check_c_compiler_flag("" HAVE_ASNEEDED)
+        if(HAVE_ASNEEDED)
+            add_linker_flag("--as-needed")
+        endif()
+    endif()
+else(UNIX)
+    #check for ASLR on Windows Vista or later, requires binutils >= 2.20
+    set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat")
+    check_c_compiler_flag("" HAVE_WINASLR)
+    if(HAVE_WINASLR)
+        add_linker_flag("--nxcompat")
+    endif()
 
-#this is actually an optimisation
-set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed")
-check_c_compiler_flag("" HAVE_ASNEEDED)
-if(HAVE_ASNEEDED)
-    add_linker_flag("--as-needed")
-endif()
+    #check for DEP on Windows XP SP2 or later, requires binutils >= 2.20
+    set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase")
+    check_c_compiler_flag("" HAVE_WINDEP)
+    if(HAVE_WINDEP)
+        add_linker_flag("--dynamicbase")
+    endif()
+endif(UNIX)
+
 
 #always unset or these flags will be spread everywhere
 unset(CMAKE_REQUIRED_FLAGS)
--- a/cmake_modules/cpackvars.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/cpackvars.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -84,12 +84,9 @@
     "cmake_uninstall\\\\.cmake$"
     "CMakeCache\\\\.txt$"
     "build_windows_.*\\\\.bat$"
-#    "^${CMAKE_CURRENT_SOURCE_DIR}/misc/libtremor"
-#    "^${CMAKE_CURRENT_SOURCE_DIR}/misc/libfreetype"
-#    "^${CMAKE_CURRENT_SOURCE_DIR}/misc/liblua"
+    "^${CMAKE_CURRENT_SOURCE_DIR}/misc/liblua"
 #    "^${CMAKE_CURRENT_SOURCE_DIR}/project_files/frontlib"
 #    "^${CMAKE_CURRENT_SOURCE_DIR}/project_files/cmdlineClient"
-    "^${CMAKE_CURRENT_SOURCE_DIR}/misc/libopenalbridge"
     "^${CMAKE_CURRENT_SOURCE_DIR}/misc/winutils/bin"
     "^${CMAKE_CURRENT_SOURCE_DIR}/project_files/promotional_art"
     "^${CMAKE_CURRENT_SOURCE_DIR}/tools/templates"
--- a/cmake_modules/paths.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/paths.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -51,6 +51,10 @@
 #it's safe to use our RPATH because it is relative
 set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
 
+#add the automatically determined parts of the RPATH
+#which point to directories outside the build tree to the install RPATH
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+
 #paths where to find libraries (final slash not optional):
 # - the first is relative to the executable
 # - the second is the same directory of the executable (so it runs in bin/)
--- a/cmake_modules/platform.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/platform.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -1,11 +1,16 @@
 
 if(APPLE)
+    if(${CMAKE_VERSION} VERSION_GREATER "2.8.10.2" AND
+       ${CMAKE_VERSION} VERSION_LESS "2.8.12.1")
+        message(FATAL_ERROR "This version of CMake is known *not* to work, please update or use a lower version")
+    endif()
+
     set(CMAKE_FIND_FRAMEWORK "FIRST")
 
-#what system are we building for
+    #what system are we building for
     set(minimum_macosx_version $ENV{MACOSX_DEPLOYMENT_TARGET})
 
-#detect on which system we are: if sw_vers cannot be found for any reason (re)use minimum_macosx_version
+    #detect on which system we are: if sw_vers cannot be found for any reason (re)use minimum_macosx_version
     find_program(sw_vers sw_vers)
     if(sw_vers)
         execute_process(COMMAND ${sw_vers} "-productVersion"
@@ -21,41 +26,62 @@
         endif()
     endif()
 
-#if nothing is set, we deploy only for the current system
+    #if nothing is set, we deploy only for the current system
     if(NOT minimum_macosx_version)
         set(minimum_macosx_version ${current_macosx_version})
     endif()
 
-#lower systems don't have enough processing power anyway
+    #lower systems don't have enough processing power anyway
     if (minimum_macosx_version VERSION_LESS "10.4")
         message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4")
     endif()
 
-#workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
+    #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
     if(current_macosx_version VERSION_EQUAL "10.4")
         find_package(SDL_mixer REQUIRED)
         set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg")
         set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
-        set(CMAKE_CX_FLAGS "${CMAKE_CX_FLAGS} ${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
-        list(APPEND pascal_flags "-k${DYLIB_SMPEG}" "-k${DYLIB_MIKMOD}")
+        add_flag_append(CMAKE_C_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
+        add_flag_append(CMAKE_CXX_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
+        add_flag_append(CMAKE_Pascal_FLAGS "-k${DYLIB_SMPEG} -k${DYLIB_MIKMOD}")
     endif()
 
-#CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_SYSROOT need to be set for universal binary and correct linking
     if(NOT CMAKE_OSX_ARCHITECTURES)
         if(current_macosx_version VERSION_LESS "10.6")
+            #SDL is only 32 bit on lower OS
             if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*")
                 set(CMAKE_OSX_ARCHITECTURES "ppc7400")
             else()
                 set(CMAKE_OSX_ARCHITECTURES "i386")
             endif()
-        else()
-            set(CMAKE_OSX_ARCHITECTURES "x86_64")
         endif()
     endif()
 
-#CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on
-#we need to provide the correct one when host and target differ
+    #parse this system variable and adjust only the powerpc syntax to be compatible with -P
+    if(CMAKE_OSX_ARCHITECTURES)
+        string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}")
+        string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}")
+        string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}")
+        if(x86_64_build)
+            add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64)
+        elseif(i386_build)
+            add_flag_prepend(CMAKE_Pascal_FLAGS -Pi386)
+        elseif(powerpc_build)
+            add_flag_prepend(CMAKE_Pascal_FLAGS -Ppowerpc)
+        else()
+            message(FATAL_ERROR "Unknown architecture present in CMAKE_OSX_ARCHITECTURES (${CMAKE_OSX_ARCHITECTURES})")
+        endif()
+        list(LENGTH CMAKE_OSX_ARCHITECTURES num_of_archs)
+        if(num_of_archs GREATER 1)
+            message(${WARNING} "Only one architecture in CMAKE_OSX_ARCHITECTURES is currently supported, picking the first one")
+        endif()
+    elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
+        #if that variable is not set check if we are on x86_64 and if so force it, else use default
+        add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64)
+    endif()
+
+    #CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on
+    #we need to provide the correct one when host and target differ
     if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version})
         if(minimum_macosx_version VERSION_EQUAL "10.4")
             set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
@@ -65,19 +91,18 @@
             string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
             set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
         endif()
+        add_flag_append(CMAKE_Pascal_FLAGS "-XR${CMAKE_OSX_SYSROOT}")
+        add_flag_append(CMAKE_Pascal_FLAGS "-k-macosx_version_min -k${minimum_macosx_version}")
     endif()
 
-#add user framework directory, other paths can be passed via FPFLAGS
-    list(APPEND pascal_flags "-Ff~/Library/Frameworks")
-#set deployment target
-    list(APPEND pascal_flags "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}")
-
+    #add user framework directory
+    add_flag_append(CMAKE_Pascal_FLAGS "-Ff~/Library/Frameworks")
 endif(APPLE)
 
 if(MINGW)
     #this flags prevents a few dll hell problems
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc ")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc ")
+    add_flag_append(CMAKE_C_FLAGS "-static-libgcc")
+    add_flag_append(CMAKE_CXX_FLAGS "-static-libgcc")
 endif(MINGW)
 
 if(WIN32)
--- a/cmake_modules/utils.cmake	Fri Oct 11 11:55:31 2013 +0200
+++ b/cmake_modules/utils.cmake	Fri Oct 11 17:43:13 2013 +0200
@@ -12,7 +12,7 @@
     find_package(${_PKG_NAME})
     string(TOUPPER ${_PKG_NAME} _PKG_NAME_UP)
     if(NOT ${_PKG_NAME_UP}_FOUND)
-        message(SEND_ERROR "Missing ${_PKG_NAME}! Rerun cmake with -D${_VAR_NAME}=1 to build without it.")
+        message(SEND_ERROR "Missing ${_PKG_NAME}! Rerun cmake with -D${_VAR_NAME}=1 to skip this error.")
     endif(NOT ${_PKG_NAME_UP}_FOUND)
 endmacro(find_package_or_disable _PKG_NAME _VAR_NAME)
 
@@ -37,10 +37,14 @@
 
 macro(add_linker_flag _FLAG)
     list(APPEND haskell_flags "-optl" "-Wl,${_FLAG}")
-    add_flag_append(CMAKE_Pascal_FLAGS "-k${_FLAG}")
-    add_flag_append(CMAKE_EXE_LINKER_FLAGS "-Wl,${_FLAG}")
+    #executables
+    add_flag_append(CMAKE_C_LINK_FLAGS "-Wl,${_FLAG}")
+    add_flag_append(CMAKE_CXX_LINK_FLAGS "-Wl,${_FLAG}")
+    add_flag_append(CMAKE_Pascal_LINK_FLAGS "-k${_FLAG}")
+    #libraries
     add_flag_append(CMAKE_SHARED_LIBRARY_C_FLAGS "-Wl,${_FLAG}")
     add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-Wl,${_FLAG}")
+    #CMAKE_SHARED_LIBRARY_Pascal_FLAGS is already set by CMAKE_Pascal_LINK_FLAGS
 endmacro(add_linker_flag _FLAG)
 
 #TODO: find_package_or_bundle
--- a/gameServer/Actions.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/Actions.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -17,7 +17,7 @@
 import Control.DeepSeq
 import Data.Unique
 import Control.Arrow
-import Control.Exception
+import Control.Exception as E
 import System.Process
 import Network.Socket
 import System.Random
@@ -346,7 +346,8 @@
         ModifyRoom (\r -> r{
                 gameInfo = liftM (\g -> g{
                     teamsInGameNumber = teamsInGameNumber g - 1
-                    , roundMsgs = rmTeamMsg : roundMsgs g
+                    , roundMsgs = (if isJust $ lastFilteredTimedMsg g then (:) (fromJust $ lastFilteredTimedMsg g) else id) 
+                      $ rmTeamMsg : roundMsgs g
                 }) $ gameInfo r
             })
         ]
@@ -420,50 +421,57 @@
 
 processAction (ProcessAccountInfo info) = do
     case info of
-        HasAccount passwd isAdmin -> do
+        HasAccount passwd isAdmin isContr -> do
             b <- isBanned
             c <- client's isChecker
-            when (not b) $ (if c then checkerLogin else playerLogin) passwd isAdmin
+            when (not b) $ (if c then checkerLogin else playerLogin) passwd isAdmin isContr
         Guest -> do
             b <- isBanned
             c <- client's isChecker
             when (not b) $
                 if c then
-                    checkerLogin "" False
+                    checkerLogin "" False False
                     else
                     processAction JoinLobby
         Admin -> do
             mapM_ processAction [ModifyClient (\cl -> cl{isAdministrator = True}), JoinLobby]
             chan <- client's sendChan
             processAction $ AnswerClients [chan] ["ADMIN_ACCESS"]
+        ReplayName fn -> processAction $ ShowReplay fn
     where
     isBanned = do
         processAction $ CheckBanned False
         liftM B.null $ client's nick
-    checkerLogin _ False = processAction $ ByeClient $ loc "No checker rights"
-    checkerLogin p True = do
+    checkerLogin _ False _ = processAction $ ByeClient $ loc "No checker rights"
+    checkerLogin p True _ = do
         wp <- client's webPassword
         processAction $
             if wp == p then ModifyClient $ \c -> c{logonPassed = True} else ByeClient $ loc "Authentication failed"
-    playerLogin p a = do
+    playerLogin p a contr = do
         chan <- client's sendChan
-        mapM_ processAction [AnswerClients [chan] ["ASKPASSWORD"], ModifyClient (\c -> c{webPassword = p, isAdministrator = a})]
+        mapM_ processAction [
+            AnswerClients [chan] ["ASKPASSWORD"]
+            , ModifyClient (\c -> c{webPassword = p, isAdministrator = a, isContributor = contr})
+            ]
 
 processAction JoinLobby = do
     chan <- client's sendChan
     clientNick <- client's nick
     isAuthenticated <- liftM (not . B.null) $ client's webPassword
     isAdmin <- client's isAdministrator
+    isContr <- client's isContributor
     loggedInClients <- liftM (Prelude.filter isVisible) $! allClientsS
     let (lobbyNicks, clientsChans) = unzip . L.map (nick &&& sendChan) $ loggedInClients
     let authenticatedNicks = L.map nick . L.filter (not . B.null . webPassword) $ loggedInClients
     let adminsNicks = L.map nick . L.filter isAdministrator $ loggedInClients
-    let clFlags = B.concat . L.concat $ [["u" | isAuthenticated], ["a" | isAdmin]]
+    let contrNicks = L.map nick . L.filter isContributor $ loggedInClients
+    let clFlags = B.concat . L.concat $ [["u" | isAuthenticated], ["a" | isAdmin], ["c" | isContr]]
     mapM_ processAction . concat $ [
         [AnswerClients clientsChans ["LOBBY:JOINED", clientNick]]
         , [AnswerClients [chan] ("LOBBY:JOINED" : clientNick : lobbyNicks)]
         , [AnswerClients [chan] ("CLIENT_FLAGS" : "+u" : authenticatedNicks) | not $ null authenticatedNicks]
         , [AnswerClients [chan] ("CLIENT_FLAGS" : "+a" : adminsNicks) | not $ null adminsNicks]
+        , [AnswerClients [chan] ("CLIENT_FLAGS" : "+c" : contrNicks) | not $ null contrNicks]
         , [AnswerClients (chan : clientsChans) ["CLIENT_FLAGS",  B.concat["+" , clFlags], clientNick] | not $ B.null clFlags]
         , [ModifyClient (\cl -> cl{logonPassed = True, isVisible = True})]
         , [SendServerMessage]
@@ -610,6 +618,7 @@
     where
           st irnc = (length $ allRooms irnc, length $ allClients irnc)
 
+
 processAction RestartServer = do
     sp <- gets (shutdownPending . serverInfo)
     when (not sp) $ do
@@ -623,6 +632,7 @@
             return ()
         processAction $ ModifyServerInfo (\s -> s{shutdownPending = True})
 
+
 processAction Stats = do
     cls <- allClientsS
     rms <- allRoomsS
@@ -650,9 +660,19 @@
     ri <- clientRoomA
     rnc <- gets roomsClients
 
-    io $ do
+    readyCheckersIds <- io $ do
         r <- room'sM rnc id ri
         saveReplay r
+        allci <- allClientsM rnc
+        filterM (client'sM rnc isReadyChecker) allci
+
+    when (not $ null readyCheckersIds) $ do
+        oldci <- gets clientIndex
+        withStateT (\s -> s{clientIndex = Just $ head readyCheckersIds})
+            $ processAction CheckRecord
+        modify (\s -> s{clientIndex = oldci})
+    where
+        isReadyChecker cl = isChecker cl && isReady cl
 
 
 processAction CheckRecord = do
@@ -662,20 +682,56 @@
     when (not . null $ l) $
         mapM_ processAction [
             AnswerClients [c] ("REPLAY" : l)
-            , ModifyClient $ \c -> c{checkInfo = cinfo}
+            , ModifyClient $ \c -> c{checkInfo = cinfo, isReady = False}
             ]
 
+
 processAction (CheckFailed msg) = do
     Just (CheckInfo fileName _) <- client's checkInfo
     io $ moveFailedRecord fileName
 
+
 processAction (CheckSuccess info) = do
-    Just (CheckInfo fileName _) <- client's checkInfo
+    Just (CheckInfo fileName teams) <- client's checkInfo
+    si <- gets serverInfo
+    io $ writeChan (dbQueries si) $ StoreAchievements (B.pack fileName) (map toPair teams) info
     io $ moveCheckedRecord fileName
+    where
+        toPair t = (teamname t, teamowner t)
+
+processAction (QueryReplay name) = do
+    (Just ci) <- gets clientIndex
+    si <- gets serverInfo
+    uid <- client's clUID
+    io $ writeChan (dbQueries si) $ GetReplayName ci (hashUnique uid) name
 
 #else
 processAction SaveReplay = return ()
 processAction CheckRecord = return ()
 processAction (CheckFailed _) = return ()
 processAction (CheckSuccess _) = return ()
+processAction (QueryReplay _) = return ()
 #endif
+
+processAction (ShowReplay name) = do
+    c <- client's sendChan
+    cl <- client's id
+
+    let fileName = B.concat ["checked/", if B.isPrefixOf "replays/" name then B.drop 8 name else name]
+
+    checkInfo <- liftIO $ E.handle (\(e :: SomeException) ->
+                    warningM "REPLAYS" (B.unpack $ B.concat ["Problems reading ", fileName, ": ", B.pack $ show e]) >> return Nothing) $ do
+            (t, p1, p2, msgs) <- liftM read $ readFile (B.unpack fileName)
+            return $ Just (t, Map.fromList p1, Map.fromList p2, reverse msgs)
+
+    let (teams, params1, params2, roundMsgs) = fromJust checkInfo
+
+    when (isJust checkInfo) $ do
+        mapM_ processAction $ concat [
+            [AnswerClients [c] ["JOINED", nick cl]]
+            , answerFullConfigParams cl params1 params2
+            , answerAllTeams cl teams
+            , [AnswerClients [c]  ["RUN_GAME"]]
+            , [AnswerClients [c] $ "EM" : roundMsgs]
+            , [AnswerClients [c] ["KICKED"]]
+            ]
--- a/gameServer/CoreTypes.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/CoreTypes.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -76,6 +76,8 @@
     | CheckFailed B.ByteString
     | CheckSuccess [B.ByteString]
     | Random [ClientChan] [B.ByteString]
+    | QueryReplay B.ByteString
+    | ShowReplay B.ByteString
 
 type ClientChan = Chan [B.ByteString]
 
@@ -106,6 +108,7 @@
         isInGame :: Bool,
         isAdministrator :: Bool,
         isChecker :: Bool,
+        isContributor :: Bool,
         isKickedFromServer :: Bool,
         isJoinedMidGame :: Bool,
         clientClan :: !(Maybe B.ByteString),
@@ -144,6 +147,7 @@
     GameInfo
     {
         roundMsgs :: [B.ByteString],
+        lastFilteredTimedMsg :: Maybe B.ByteString,
         leftTeams :: [B.ByteString],
         teamsAtStart :: [TeamInfo],
         teamsInGameNumber :: Int,
@@ -161,6 +165,7 @@
 newGameInfo =
     GameInfo
         []
+        Nothing
         []
 
 data RoomInfo =
@@ -252,15 +257,18 @@
         []
 
 data AccountInfo =
-    HasAccount B.ByteString Bool
+    HasAccount B.ByteString Bool Bool
     | Guest
     | Admin
+    | ReplayName B.ByteString
     deriving (Show, Read)
 
 data DBQuery =
     CheckAccount ClientIndex Int B.ByteString B.ByteString
     | ClearCache
     | SendStats Int Int
+    | StoreAchievements B.ByteString [(B.ByteString, B.ByteString)] [B.ByteString]
+    | GetReplayName ClientIndex Int B.ByteString
     deriving (Show, Read)
 
 data CoreMessage =
--- a/gameServer/EngineInteraction.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/EngineInteraction.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -32,17 +32,22 @@
 splitMessages = L.unfoldr (\b -> if B.null b then Nothing else Just $ B.splitAt (1 + fromIntegral (BW.head b)) b)
 
 
-checkNetCmd :: B.ByteString -> (B.ByteString, B.ByteString)
+checkNetCmd :: B.ByteString -> (B.ByteString, B.ByteString, Maybe (Maybe B.ByteString))
 checkNetCmd msg = check decoded
     where
         decoded = liftM (splitMessages . BW.pack) $ Base64.decode $ B.unpack msg
-        check Nothing = (B.empty, B.empty)
-        check (Just msgs) = let (a, b) = (filter isLegal msgs, filter isNonEmpty a) in (encode a, encode b)
+        check Nothing = (B.empty, B.empty, Nothing)
+        check (Just msgs) = let (a, b) = (filter isLegal msgs, filter isNonEmpty a) in (encode a, encode b, lft a)
         encode = B.pack . Base64.encode . BW.unpack . B.concat
         isLegal m = (B.length m > 1) && (flip Set.member legalMessages . B.head . B.tail $ m)
+        lft = foldr l Nothing
+        l m n = let m' = B.head $ B.tail m; tst = flip Set.member in 
+                      if not $ tst timedMessages m' then n
+                        else if '+' /= m' then Just Nothing else Just . Just . B.pack . Base64.encode . BW.unpack $ m
         isNonEmpty = (/=) '+' . B.head . B.tail
         legalMessages = Set.fromList $ "M#+LlRrUuDdZzAaSjJ,sNpPwtghbc12345" ++ slotMessages
         slotMessages = "\128\129\130\131\132\133\134\135\136\137\138"
+        timedMessages = Set.fromList $ "+LlRrUuDdZzAaSjJ,NpPwtgc12345" ++ slotMessages
 
 
 replayToDemo :: [TeamInfo]
@@ -50,18 +55,18 @@
         -> Map.Map B.ByteString [B.ByteString]
         -> [B.ByteString]
         -> [B.ByteString]
-replayToDemo teams mapParams params msgs = concat [
+replayToDemo ti mParams prms msgs = concat [
         [em "TD"]
         , maybeScript
         , maybeMap
-        , [eml ["etheme ", head $ params Map.! "THEME"]]
-        , [eml ["eseed ", mapParams Map.! "SEED"]]
+        , [eml ["etheme ", head $ prms Map.! "THEME"]]
+        , [eml ["eseed ", mParams Map.! "SEED"]]
         , [eml ["e$gmflags ", showB gameFlags]]
         , schemeFlags
-        , [eml ["e$template_filter ", mapParams Map.! "TEMPLATE"]]
+        , [eml ["e$template_filter ", mParams Map.! "TEMPLATE"]]
         , [eml ["e$mapgen ", mapgen]]
         , mapgenSpecific
-        , concatMap teamSetup teams
+        , concatMap teamSetup ti
         , msgs
         , [em "!"]
         ]
@@ -69,13 +74,13 @@
         em = toEngineMsg
         eml = em . B.concat
         mapGenTypes = ["+rnd+", "+maze+", "+drawn+"]
-        maybeScript = let s = head $ params Map.! "SCRIPT" in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
-        maybeMap = let m = mapParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
-        scheme = tail $ params Map.! "SCHEME"
-        mapgen = mapParams Map.! "MAPGEN"
+        maybeScript = let s = head $ prms Map.! "SCRIPT" in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
+        maybeMap = let m = mParams Map.! "MAP" in if m `elem` mapGenTypes then [] else [eml ["emap ", m]]
+        scheme = tail $ prms Map.! "SCHEME"
+        mapgen = mParams Map.! "MAPGEN"
         mapgenSpecific = case mapgen of
-            "+maze+" -> [eml ["e$maze_size ", head $ params Map.! "MAZE_SIZE"]]
-            "+drawn" -> drawnMapData . head $ params Map.! "DRAWNMAP"
+            "+maze+" -> [eml ["e$maze_size ", head $ prms Map.! "MAZE_SIZE"]]
+            "+drawn" -> drawnMapData . head $ prms Map.! "DRAWNMAP"
             _ -> []
         gameFlags :: Word32
         gameFlags = foldl (\r (b, f) -> if b == "false" then r else r .|. f) 0 $ zip scheme gameFlagConsts
@@ -83,7 +88,7 @@
             $ filter (\(_, (n, _)) -> not $ B.null n)
             $ zip (drop (length gameFlagConsts) scheme) schemeParams
         ammoStr :: B.ByteString
-        ammoStr = head . tail $ params Map.! "AMMO"
+        ammoStr = head . tail $ prms Map.! "AMMO"
         ammo = let l = B.length ammoStr `div` 4; ((a, b), (c, d)) = (B.splitAt l . fst &&& B.splitAt l . snd) . B.splitAt (l * 2) $ ammoStr in
                    (map (\(x, y) -> eml [x, " ", y]) $ zip ["eammloadt", "eammprob", "eammdelay", "eammreinf"] [a, b, c, d])
                    ++ [em "eammstore" | scheme !! 14 == "true" || scheme !! 20 == "false"]
--- a/gameServer/HWProtoChecker.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/HWProtoChecker.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -11,7 +11,7 @@
 
 handleCmd_checker :: CmdHandler
 
-handleCmd_checker ["READY"] = return [CheckRecord]
+handleCmd_checker ["READY"] = return [ModifyClient $ \c -> c{isReady = True}, CheckRecord]
 
 handleCmd_checker ["CHECKED", "FAIL", msg] = do
     isChecking <- liftM (isJust . checkInfo) thisClient
--- a/gameServer/HWProtoCore.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/HWProtoCore.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -50,6 +50,7 @@
             rnc <- liftM snd ask
             let chans = map (sendChan . client rnc) $ allClients rnc
             return [AnswerClients chans ["CHAT", "[global notice]", p] | isAdministrator cl]
+        h "WATCH" f = return [QueryReplay f]
         h c p = return [Warning $ B.concat ["Unknown cmd: /", c, p]]
 
 handleCmd cmd = do
--- a/gameServer/HWProtoInRoomState.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/HWProtoInRoomState.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -217,11 +217,15 @@
 
     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then
         return $ AnswerClients chans ["EM", legalMsgs]
-            : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = nonEmptyMsgs : roundMsgs g}) $ gameInfo r}) | not $ B.null nonEmptyMsgs]
+            : [ModifyRoom (\r -> r{gameInfo = liftM 
+                (\g -> g{
+                    roundMsgs = if B.null nonEmptyMsgs then roundMsgs g else nonEmptyMsgs : roundMsgs g
+                    , lastFilteredTimedMsg = fromMaybe (lastFilteredTimedMsg g) lastFTMsg})
+                $ gameInfo r})]
         else
         return []
     where
-        (legalMsgs, nonEmptyMsgs) = checkNetCmd msg
+        (legalMsgs, nonEmptyMsgs, lastFTMsg) = checkNetCmd msg
 
 
 handleCmd_inRoom ["ROUNDFINISHED", _] = do
@@ -283,6 +287,9 @@
         if not $ isMaster cl then
             [ProtocolError $ loc "Not room master"]
         else
+        if illegalName newName then 
+            [Warning $ loc "Illegal room name"]
+        else
         if isJust $ find (\r -> newName == name r) rs then
             [Warning $ loc "Room with such name already exists"]
         else
--- a/gameServer/HWProtoLobbyState.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/HWProtoLobbyState.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -4,6 +4,7 @@
 import Data.Maybe
 import Data.List
 import Control.Monad.Reader
+import qualified Data.ByteString.Char8 as B
 --------------------------------------
 import CoreTypes
 import Actions
@@ -13,16 +14,6 @@
 import EngineInteraction
 
 
-answerAllTeams :: ClientInfo -> [TeamInfo] -> [Action]
-answerAllTeams cl = concatMap toAnswer
-    where
-        clChan = sendChan cl
-        toAnswer team =
-            [AnswerClients [clChan] $ teamToNet team,
-            AnswerClients [clChan] ["TEAM_COLOR", teamname team, teamcolor team],
-            AnswerClients [clChan] ["HH_NUM", teamname team, showB $ hhnum team]]
-
-
 handleCmd_lobby :: CmdHandler
 
 
@@ -77,7 +68,7 @@
             [Warning $ loc "No such room"]
             else if isRestrictedJoins jRoom then
             [Warning $ loc "Joining restricted"]
-            else if isRegisteredOnly jRoom then
+            else if isRegisteredOnly jRoom && (B.null . webPassword $ cl) then
             [Warning $ loc "Registered users only"]
             else if isBanned then
             [Warning $ loc "You are banned in this room"]
@@ -114,10 +105,10 @@
         watchRound cl jRoom chans = if isNothing $ gameInfo jRoom then
                     []
                 else
-                    [AnswerClients [sendChan cl]  ["RUN_GAME"]
-                    , AnswerClients chans ["CLIENT_FLAGS", "+g", nick cl]
-                    , ModifyClient (\c -> c{isInGame = True})
-                    , AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : (reverse . roundMsgs . fromJust . gameInfo $ jRoom)]
+                    AnswerClients [sendChan cl]  ["RUN_GAME"]
+                    : AnswerClients chans ["CLIENT_FLAGS", "+g", nick cl]
+                    : ModifyClient (\c -> c{isInGame = True})
+                    : [AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : (reverse . roundMsgs . fromJust . gameInfo $ jRoom)]
 
 
 handleCmd_lobby ["JOIN_ROOM", roomName] =
--- a/gameServer/HandlerUtils.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/HandlerUtils.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -64,5 +64,5 @@
 clientByNick n = do
     (_, rnc) <- ask
     let allClientIDs = allClients rnc
-    return $ find (\clId -> n == nick (client rnc clId)) allClientIDs
+    return $ find (\clId -> let cl = client rnc clId in n == nick cl && not (isChecker cl)) allClientIDs
 
--- a/gameServer/NetRoutines.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/NetRoutines.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -45,6 +45,7 @@
                     False
                     False
                     False
+                    False
                     Nothing
                     Nothing
                     0
--- a/gameServer/OfficialServer/DBInteraction.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/OfficialServer/DBInteraction.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -77,7 +77,22 @@
                     writeChan cChan $ ClientAccountInfo clId clUid (snd $ fromJust cacheEntry)
                     return (accountsCache, req)
 
+        GetReplayName {} -> do
+            SIO.hPutStrLn hIn $ show q
+            hFlush hIn
+
+            (clId', clUid', accountInfo) <- SIO.hGetLine hOut >>= (maybeException . maybeRead)
+
+            writeChan cChan $ ClientAccountInfo clId' clUid' accountInfo
+            return (accountsCache, req)
+
         ClearCache -> return (Map.empty, req)
+        StoreAchievements {} -> (
+                (SIO.hPutStrLn hIn $ show q) >>
+                hFlush hIn >>
+                return (accountsCache, req))
+                `Exception.onException`
+                (unGetChan queries q)
         SendStats {} -> (
                 (SIO.hPutStrLn hIn $ show q) >>
                 hFlush hIn >>
--- a/gameServer/OfficialServer/checker.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/OfficialServer/checker.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -24,19 +24,25 @@
 import System.Posix
 #endif
 
+readInt_ :: (Num a) => B.ByteString -> a
+readInt_ str =
+  case B.readInt str of
+       Just (i, t) | B.null t -> fromIntegral i
+       _                      -> 0 
+
 data Message = Packet [B.ByteString]
              | CheckFailed B.ByteString
              | CheckSuccess [B.ByteString]
     deriving Show
 
 serverAddress = "netserver.hedgewars.org"
-protocolNumber = "43"
+protocolNumber = "45"
 
-getLines :: Handle -> IO [String]
+getLines :: Handle -> IO [B.ByteString]
 getLines h = g
     where
         g = do
-            l <- liftM Just (hGetLine h) `Exception.catch` (\(_ :: Exception.IOException) -> return Nothing)
+            l <- liftM Just (B.hGetLine h) `Exception.catch` (\(_ :: Exception.IOException) -> return Nothing)
             if isNothing l then
                 return []
                 else
@@ -45,38 +51,43 @@
                 return $ fromJust l : lst
 
 
-engineListener :: Chan Message -> Handle -> IO ()
-engineListener coreChan h = do
-    output <- getLines h
-    debugM "Engine" $ show output
-    if isNothing $ L.find start output then
+engineListener :: Chan Message -> Handle -> String -> IO ()
+engineListener coreChan h fileName = do
+    stats <- liftM (ps . L.dropWhile (not . start)) $ getLines h
+    debugM "Engine" $ show stats
+    if null stats then
         writeChan coreChan $ CheckFailed "No stats msg"
         else
-        writeChan coreChan $ CheckSuccess []
+        writeChan coreChan $ CheckSuccess stats
+
+    removeFile fileName
     where
         start = flip L.elem ["WINNERS", "DRAW"]
-
+        ps ("DRAW" : bs) = "DRAW" : ps bs
+        ps ("WINNERS" : n : bs) = let c = readInt_ n in "WINNERS" : n : take c bs ++ (ps $ drop c bs)
+        ps ("ACHIEVEMENT" : typ : teamname : location : value : bs) =
+            "ACHIEVEMENT" : typ : teamname : location : value : ps bs
+        ps _ = []
 
 checkReplay :: Chan Message -> [B.ByteString] -> IO ()
 checkReplay coreChan msgs = do
     tempDir <- getTemporaryDirectory
     (fileName, h) <- openBinaryTempFile tempDir "checker-demo"
-    B.hPut h . BW.pack . concat . map (fromJust . Base64.decode . B.unpack) $ msgs
+    B.hPut h . BW.pack . concat . map (fromMaybe [] . Base64.decode . B.unpack) $ msgs
     hFlush h
     hClose h
 
-    (_, Just hOut, _, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.18/bin/hwengine"
-                ["/usr/home/unC0Rr/.hedgewars"
-                , "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.18/share/hedgewars/Data"
-                , fileName
-                , "--set-audio"
-                , "0"
-                , "0"
-                , "0"
+    (_, _, Just hOut, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.19/bin/hwengine"
+                [fileName
+                , "--user-prefix", "/usr/home/unC0Rr/.hedgewars"
+                , "--prefix", "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.19/share/hedgewars/Data"
+                , "--nomusic"
+                , "--nosound"
+                , "--stats-only"
                 ])
-            {std_out = CreatePipe}
+            {std_err = CreatePipe}
     hSetBuffering hOut LineBuffering
-    void $ forkIO $ engineListener coreChan hOut
+    void $ forkIO $ engineListener coreChan hOut fileName
 
 
 takePacks :: State B.ByteString [[B.ByteString]]
@@ -154,7 +165,7 @@
 #endif
 
     updateGlobalLogger "Core" (setLevel DEBUG)
-    updateGlobalLogger "Network" (setLevel DEBUG)
+    updateGlobalLogger "Network" (setLevel WARNING)
     updateGlobalLogger "Check" (setLevel DEBUG)
     updateGlobalLogger "Engine" (setLevel DEBUG)
 
--- a/gameServer/OfficialServer/extdbinterface.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/OfficialServer/extdbinterface.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -9,16 +9,30 @@
 import Data.Maybe
 import Database.HDBC
 import Database.HDBC.MySQL
+import Data.List (lookup)
+import qualified Data.ByteString.Char8 as B
 --------------------------
 import CoreTypes
+import Utils
 
 
 dbQueryAccount =
-    "SELECT users.pass, users_roles.rid FROM users LEFT JOIN users_roles ON (users.uid = users_roles.uid AND users_roles.rid = 3) WHERE users.name = ?"
+    "SELECT users.pass, \ 
+    \ (SELECT COUNT(users_roles.rid) FROM users_roles WHERE users.uid = users_roles.uid AND users_roles.rid = 3), \
+    \ (SELECT COUNT(users_roles.rid) FROM users_roles WHERE users.uid = users_roles.uid AND users_roles.rid = 13) \
+    \ FROM users WHERE users.name = ?"
 
 dbQueryStats =
     "INSERT INTO gameserver_stats (players, rooms, last_update) VALUES (?, ?, UNIX_TIMESTAMP())"
 
+dbQueryAchievement =
+    "INSERT INTO achievements (time, typeid, userid, value, filename, location) \
+    \ VALUES (?, (SELECT id FROM achievement_types WHERE name = ?), (SELECT uid FROM users WHERE name = ?), \
+    \ ?, ?, ?)"
+
+dbQueryReplayFilename = "SELECT filename FROM achievements WHERE id = ?"
+
+
 dbInteractionLoop dbConn = forever $ do
     q <- liftM read getLine
     hPutStrLn stderr $ show q
@@ -27,24 +41,58 @@
         CheckAccount clId clUid clNick _ -> do
                 statement <- prepare dbConn dbQueryAccount
                 execute statement [SqlByteString clNick]
-                passAndRole <- fetchRow statement
+                result <- fetchRow statement
                 finish statement
                 let response =
-                        if isJust passAndRole then
+                        if isJust result then let [pass, adm, contr] = fromJust result in
                         (
                             clId,
                             clUid,
                             HasAccount
-                                (fromSql . head . fromJust $ passAndRole)
-                                (fromSql (last . fromJust $ passAndRole) == Just (3 :: Int))
+                                (fromSql pass)
+                                (fromSql adm == Just (1 :: Int))
+                                (fromSql contr == Just (1 :: Int))
                         )
                         else
                         (clId, clUid, Guest)
                 print response
                 hFlush stdout
 
+        GetReplayName clId clUid fileId -> do
+                statement <- prepare dbConn dbQueryReplayFilename
+                execute statement [SqlByteString fileId]
+                result <- fetchRow statement
+                finish statement
+                let fn = if (isJust result) then fromJust . fromSql . head . fromJust $ result else ""
+                print (clId, clUid, ReplayName fn)
+                hFlush stdout
+
         SendStats clients rooms ->
                 run dbConn dbQueryStats [SqlInt32 $ fromIntegral clients, SqlInt32 $ fromIntegral rooms] >> return ()
+--StoreAchievements (B.pack fileName) (map toPair teams) info
+        StoreAchievements fileName teams info -> 
+            mapM_ (run dbConn dbQueryAchievement) $ (parseStats fileName teams) info
+
+
+readTime = read . B.unpack . B.take 19 . B.drop 8
+
+
+parseStats :: B.ByteString -> [(B.ByteString, B.ByteString)] -> [B.ByteString] -> [[SqlValue]]
+parseStats fileName teams = ps
+    where
+    time = readTime fileName
+    ps [] = []
+    ps ("DRAW" : bs) = ps bs
+    ps ("WINNERS" : n : bs) = ps $ drop (readInt_ n) bs
+    ps ("ACHIEVEMENT" : typ : teamname : location : value : bs) =
+        [ SqlUTCTime time
+        , SqlByteString typ
+        , SqlByteString $ fromMaybe "" (lookup teamname teams)
+        , SqlInt32 (readInt_ value)
+        , SqlByteString fileName
+        , SqlByteString location
+        ] : ps bs
+    ps (b:bs) = ps bs
 
 
 dbConnectionLoop mySQLConnectionInfo =
--- a/gameServer/Utils.hs	Fri Oct 11 11:55:31 2013 +0200
+++ b/gameServer/Utils.hs	Fri Oct 11 17:43:13 2013 +0200
@@ -157,5 +157,15 @@
         toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
 
 
+answerAllTeams :: ClientInfo -> [TeamInfo] -> [Action]
+answerAllTeams cl = concatMap toAnswer
+    where
+        clChan = sendChan cl
+        toAnswer team =
+            [AnswerClients [clChan] $ teamToNet team,
+            AnswerClients [clChan] ["TEAM_COLOR", teamname team, teamcolor team],
+            AnswerClients [clChan] ["HH_NUM", teamname team, showB $ hhnum team]]
+
+
 loc :: B.ByteString -> B.ByteString
 loc = id
--- a/hedgewars/ArgParsers.inc	Fri Oct 11 11:55:31 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,351 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@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; version 2 of the License
- *
- * 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
- *)
-
-procedure GciEasterEgg;
-begin
-    WriteLn(stdout, '                                                                ');
-    WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');
-    WriteLn(stdout, '     /\\\//////////      /\\\////////  \/////\\\///             ');
-    WriteLn(stdout, '     /\\\               /\\\/               \/\\\               ');
-    WriteLn(stdout, '     \/\\\    /\\\\\\\  /\\\                 \/\\\              ');
-    WriteLn(stdout, '      \/\\\   \/////\\\ \/\\\                 \/\\\             ');
-    WriteLn(stdout, '       \/\\\       \/\\\ \//\\\                \/\\\            ');
-    WriteLn(stdout, '        \/\\\       \/\\\  \///\\\              \/\\\           ');
-    WriteLn(stdout, '         \/\\\\\\\\\\\\\/     \////\\\\\\\\\  /\\\\\\\\\\\      ');
-    WriteLn(stdout, '          \/////////////          \/////////  \///////////      ');
-    WriteLn(stdout, '                                                                ');
-    WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student ');
-    WriteLn(stdout, '             ASCII Art easter egg idea by @sheepluva            ');
-    WriteLn(stdout, '                                                                ');
-end;
-
-procedure DisplayUsage;
-begin
-    WriteLn(stdout, 'Usage: hwengine <path to replay file> [options]');
-    WriteLn(stdout, '');
-    WriteLn(stdout, 'where [options] can be any of the following:');
-    WriteLn(stdout, ' --prefix [path to folder]');
-    WriteLn(stdout, ' --user-prefix [path to folder]');
-    WriteLn(stdout, ' --locale [name of language file]');
-    WriteLn(stdout, ' --nick [string]');
-    WriteLn(stdout, ' --fullscreen-width [fullscreen width in pixels]');
-    WriteLn(stdout, ' --fullscreen-height [fullscreen height in pixels]');
-    WriteLn(stdout, ' --width [window width in pixels]');
-    WriteLn(stdout, ' --height [window height in pixels]');
-    WriteLn(stdout, ' --volume [sound level]');
-    WriteLn(stdout, ' --frame-interval [milliseconds]');
-    Writeln(stdout, ' --stereo [value]');
-    WriteLn(stdout, ' --raw-quality [flags]');
-    WriteLn(stdout, ' --low-quality');
-    WriteLn(stdout, ' --nomusic');
-    WriteLn(stdout, ' --nosound');
-    WriteLn(stdout, ' --fullscreen');
-    WriteLn(stdout, ' --showfps');
-    WriteLn(stdout, ' --altdmg');
-    WriteLn(stdout, ' --stats-only');
-    WriteLn(stdout, ' --help');
-    WriteLn(stdout, '');
-    WriteLn(stdout, 'For more detailed help and examples go to:');
-    WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions');
-    GameType:= gmtSyntax;
-end;
-
-procedure setDepth(var paramIndex: LongInt);
-begin
-    WriteLn(stdout, 'WARNING: --depth is a deprecated command, which could be removed in a future version!');
-    WriteLn(stdout, '         This option no longer does anything, please consider removing it');
-    WriteLn(stdout, '');
-   inc(ParamIndex);
-end;
-
-procedure statsOnlyGame;
-begin
-    cOnlyStats:= true;
-    cReducedQuality:= $FFFFFFFF xor rqLowRes;
-    SetSound(false);
-    SetMusic(false);
-    SetVolume(0);
-end;
-
-procedure setIpcPort(port: LongInt; var wrongParameter:Boolean);
-begin
-    if isInternal then
-        ipcPort := port
-    else
-        begin
-        WriteLn(stderr, 'ERROR: use of --port is not allowed');
-        wrongParameter := true;
-        end
-end;
-
-function parseNick(nick: shortstring): shortstring;
-begin
-    if isInternal then
-        parseNick:= DecodeBase64(nick)
-    else
-        parseNick:= nick;
-end;
-
-procedure setStereoMode(tmp: LongInt);
-begin
-    GrayScale:= false;
-{$IFDEF USE_S3D_RENDERING}
-    if (tmp > 6) and (tmp < 13) then
-        begin
-        // set the gray anaglyph rendering
-        GrayScale:= true;
-        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)))
-        end
-    else if tmp <= 6 then
-        // set the fullcolor anaglyph
-        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)))
-    else
-        // any other mode
-        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)));
-{$ELSE}
-    tmp:= tmp;
-    cStereoMode:= smNone;
-{$ENDIF}
-end;
-
-procedure startVideoRecording(var paramIndex: LongInt);
-begin
-    // Silence the hint that appears when USE_VIDEO_RECORDING is not defined
-    paramIndex:= paramIndex;
-{$IFDEF USE_VIDEO_RECORDING}
-    GameType:= gmtRecord;
-    inc(paramIndex);
-    cVideoFramerateNum:= StrToInt(ParamStr(paramIndex)); inc(paramIndex);
-    cVideoFramerateDen:= StrToInt(ParamStr(paramIndex)); inc(paramIndex);
-    RecPrefix:= ParamStr(paramIndex);                    inc(paramIndex);
-    cAVFormat:= ParamStr(paramIndex);                    inc(paramIndex);
-    cVideoCodec:= ParamStr(paramIndex);                  inc(paramIndex);
-    cVideoQuality:= StrToInt(ParamStr(paramIndex));      inc(paramIndex);
-    cAudioCodec:= ParamStr(paramIndex);                  inc(paramIndex);
-{$ENDIF}
-end;
-
-function getLongIntParameter(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt;
-var tmpInt, c: LongInt;
-begin
-    inc(paramIndex);
-{$IFDEF PAS2C}
-    val(str, tmpInt);
-{$ELSE}
-    val(str, tmpInt, c);
-    wrongParameter:= c <> 0;
-    if wrongParameter then
-        WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"');
-{$ENDIF}
-    getLongIntParameter:= tmpInt;
-end;
-
-function getStringParameter(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean): shortstring;
-begin
-    inc(paramIndex);
-    wrongParameter:= (str='') or (Copy(str,1,2) = '--');
-    if wrongParameter then
-         WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"');
-    getStringParameter:= str;
-end;
-
-procedure parseClassicParameter(cmdarray: array of shortstring; size:LongInt; var paramIndex:LongInt); forward;
-
-function parseParameter(cmd:shortstring; arg:shortstring; var paramIndex:LongInt): Boolean;
-const videoarray: array [0..4] of shortstring = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth');
-      audioarray: array [0..2] of shortstring = ('--volume','--nomusic','--nosound');
-      otherarray: array [0..2] of shortstring = ('--locale','--fullscreen','--showfps');
-      mediaarray: array [0..9] of shortstring = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen');
-      allarray: array [0..13] of shortstring = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality');
-      reallyAll: array[0..30] of shortstring = (
-                '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width',
-                '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
-                '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
-  {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
-  {internal}    '--internal', '--port', '--recorder', '--landpreview',
-  {misc}        '--stats-only', '--gci', '--help');
-var cmdIndex: byte;
-begin
-    parseParameter:= false;
-    cmdIndex:= 0;
-
-    //NOTE: Any update to the list of parameters must be reflected in the case statement below, the reallyAll array above,
-    //      the the DisplayUsage() procedure, the HWForm::getDemoArguments() function, and the online wiki
-
-    while (cmdIndex <= High(reallyAll)) and (cmd <> reallyAll[cmdIndex]) do inc(cmdIndex);
-    case cmdIndex of
-        {--prefix}               0 : PathPrefix        := getStringParameter (arg, paramIndex, parseParameter);
-        {--user-prefix}          1 : UserPathPrefix    := getStringParameter (arg, paramIndex, parseParameter);
-        {--locale}               2 : cLocaleFName      := getStringParameter (arg, paramIndex, parseParameter);
-        {--fullscreen-width}     3 : cFullscreenWidth  := max(getLongIntParameter(arg, paramIndex, parseParameter), cMinScreenWidth);
-        {--fullscreen-height}    4 : cFullscreenHeight := max(getLongIntParameter(arg, paramIndex, parseParameter), cMinScreenHeight);
-        {--width}                5 : cWindowedWidth    := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenWidth);
-        {--height}               6 : cWindowedHeight   := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenHeight);
-        {--frame-interval}       7 : cTimerInterval    := getLongIntParameter(arg, paramIndex, parseParameter);
-        {--volume}               8 : SetVolume          ( max(getLongIntParameter(arg, paramIndex, parseParameter), 0) );
-        {--nomusic}              9 : SetMusic           ( false );
-        {--nosound}             10 : SetSound           ( false );
-        {--fullscreen}          11 : cFullScreen       := true;
-        {--showfps}             12 : cShowFPS          := true;
-        {--altdmg}              13 : cAltDamage        := true;
-        {--low-quality}         14 : cReducedQuality   := $FFFFFFFF xor rqLowRes;
-        {--raw-quality}         15 : cReducedQuality   := getLongIntParameter(arg, paramIndex, parseParameter);
-        {--stereo}              16 : setStereoMode      ( getLongIntParameter(arg, paramIndex, parseParameter) );
-        {--nick}                17 : UserNick          := parseNick( getStringParameter(arg, paramIndex, parseParameter) );
-        {deprecated options}
-        {--depth}               18 : setDepth(paramIndex);
-        {--set-video}           19 : parseClassicParameter(videoarray,5,paramIndex);
-        {--set-audio}           20 : parseClassicParameter(audioarray,3,paramIndex);
-        {--set-other}           21 : parseClassicParameter(otherarray,3,paramIndex);
-        {--set-multimedia}      22 : parseClassicParameter(mediaarray,10,paramIndex);
-        {--set-everything}      23 : parseClassicParameter(allarray,14,paramIndex);
-        {"internal" options}
-        {--internal}            24 : {$IFDEF HWLIBRARY}isInternal:= true{$ENDIF};
-        {--port}                25 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter );
-        {--recorder}            26 : startVideoRecording(paramIndex);
-        {--landpreview}         27 : GameType := gmtLandPreview;
-        {anything else}
-        {--stats-only}          28 : statsOnlyGame();
-        {--gci}                 29 : GciEasterEgg();
-        {--help}                30 : DisplayUsage();
-    else
-        begin
-        //Asusme the first "non parameter" is the replay file, anything else is invalid
-        if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then
-            recordFileName := cmd
-        else
-            begin
-            WriteLn(stderr, '"'+cmd+'" is not a valid option');
-            parseParameter:= true;
-            end;
-        end;
-    end;
-end;
-
-procedure parseClassicParameter(cmdarray: array of shortstring; size:LongInt; var paramIndex:LongInt);
-var index, tmpInt: LongInt;
-    isBool, isValid: Boolean;
-    cmd, arg, newSyntax: shortstring;
-begin
-    WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!');
-    WriteLn(stdout, '         Consider updating to the latest syntax, which is much more flexible!');
-    WriteLn(stdout, '         Run `hwegine --help` to learn it!');
-    WriteLn(stdout, '');
-
-    index:= 0;
-    tmpInt:= 1;
-    while (index < size) do
-        begin
-        newSyntax:= '';
-        inc(paramIndex);
-        cmd:= cmdarray[index];
-        arg:= ParamStr(paramIndex);
-        isValid:= (cmd<>'--depth');
-
-        // check if the parameter is a boolean one
-        isBool:= (cmd = '--nomusic') or (cmd = '--nosound') or (cmd = '--fullscreen') or (cmd = '--showfps') or (cmd = '--altdmg');
-        if isBool and (arg='0') then
-            isValid:= false;
-        if (cmd='--nomusic') or (cmd='--nosound') then
-            isValid:= not isValid;
-
-        if isValid then
-            begin
-            parseParameter(cmd, arg, tmpInt);
-            newSyntax:= newSyntax + cmd + ' ';
-            if not isBool then
-                newSyntax:= newSyntax + arg + ' ';
-            end;
-        inc(index);
-        end;
-
-    WriteLn(stdout, 'Attempted to automatically convert to the new syntax:');
-    WriteLn(stdout, newSyntax);
-    WriteLn(stdout, '');
-end;
-
-procedure parseCommandLine{$IFDEF HWLIBRARY}(argc: LongInt; argv: PPChar){$ENDIF};
-var paramIndex: LongInt;
-    paramTotal: LongInt;
-    index, nextIndex: LongInt;
-    wrongParameter: boolean;
-//var tmpInt: LongInt;
-begin
-    paramIndex:= {$IFDEF HWLIBRARY}0{$ELSE}1{$ENDIF};
-    paramTotal:= {$IFDEF HWLIBRARY}argc-1{$ELSE}ParamCount{$ENDIF}; //-1 because pascal enumeration is inclusive
-    (*
-    WriteLn(stdout, 'total parameters: ' + inttostr(paramTotal));
-    tmpInt:= 0;
-    while (tmpInt <= paramTotal) do
-        begin
-        WriteLn(stdout, inttostr(tmpInt) + ': ' + {$IFDEF HWLIBRARY}argv[tmpInt]{$ELSE}paramCount(tmpInt){$ENDIF});
-        inc(tmpInt);
-        end;
-    *)
-    wrongParameter:= false;
-    while (paramIndex <= paramTotal) do
-        begin
-        // avoid going past the number of paramTotal (esp. w/ library)
-        index:= paramIndex;
-        if index = paramTotal then nextIndex:= index
-        else nextIndex:= index+1;
-        {$IFDEF HWLIBRARY}
-        wrongParameter:= parseParameter( argv[index], argv[nextIndex], paramIndex);
-        {$ELSE}
-        wrongParameter:= parseParameter( ParamStr(index), ParamStr(nextIndex), paramIndex);
-        {$ENDIF}
-        inc(paramIndex);
-        end;
-    if wrongParameter = true then
-        GameType:= gmtSyntax;
-end;
-
-{$IFNDEF HWLIBRARY}
-procedure GetParams;
-begin
-    isInternal:= (ParamStr(1) = '--internal');
-
-    UserPathPrefix := _S'.';
-    PathPrefix     := cDefaultPathPrefix;
-    recordFileName := '';
-    parseCommandLine();
-
-    if (isInternal) and (ParamCount<=1) then
-        begin
-        WriteLn(stderr, '--internal should not be manually used');
-        GameType := gmtSyntax;
-        end;
-
-    if (not isInternal) and (recordFileName = '') then
-        begin
-        WriteLn(stderr, 'You must specify a replay file');
-        GameType := gmtSyntax;
-        end
-    else if (recordFileName <> '') then
-        WriteLn(stdout, 'Attempting to play demo file "' + recordFilename + '"');
-
-    if (GameType = gmtSyntax) then
-        WriteLn(stderr, 'Please use --help to see possible arguments and their usage');
-
-    (*
-    WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
-    WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
-    *)
-end;
-{$ENDIF}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/ArgParsers.pas	Fri Oct 11 17:43:13 2013 +0200
@@ -0,0 +1,376 @@
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@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; version 2 of the License
+ *
+ * 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
+ *)
+ 
+{$INCLUDE "options.inc"}
+
+unit ArgParsers;
+interface
+
+{$IFNDEF HWLIBRARY}
+procedure GetParams;
+{$ELSE}
+procedure parseCommandLine(argc: LongInt; argv: PPChar);
+{$ENDIF}
+
+implementation
+uses uVariables, uTypes, uUtils, uSound, uConsts;
+var isInternal: Boolean {$IFDEF HWLIBRARY} = true{$ENDIF};
+
+procedure GciEasterEgg;
+begin
+    WriteLn(stdout, '                                                                ');
+    WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');
+    WriteLn(stdout, '     /\\\//////////      /\\\////////  \/////\\\///             ');
+    WriteLn(stdout, '     /\\\               /\\\/               \/\\\               ');
+    WriteLn(stdout, '     \/\\\    /\\\\\\\  /\\\                 \/\\\              ');
+    WriteLn(stdout, '      \/\\\   \/////\\\ \/\\\                 \/\\\             ');
+    WriteLn(stdout, '       \/\\\       \/\\\ \//\\\                \/\\\            ');
+    WriteLn(stdout, '        \/\\\       \/\\\  \///\\\              \/\\\           ');
+    WriteLn(stdout, '         \/\\\\\\\\\\\\\/     \////\\\\\\\\\  /\\\\\\\\\\\      ');
+    WriteLn(stdout, '          \/////////////          \/////////  \///////////      ');
+    WriteLn(stdout, '                                                                ');
+    WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student ');
+    WriteLn(stdout, '             ASCII Art easter egg idea by @sheepluva            ');
+    WriteLn(stdout, '                                                                ');
+end;
+
+procedure DisplayUsage;
+begin
+    WriteLn(stdout, 'Usage: hwengine <path to replay file> [options]');
+    WriteLn(stdout, '');
+    WriteLn(stdout, 'where [options] can be any of the following:');
+    WriteLn(stdout, ' --prefix [path to folder]');
+    WriteLn(stdout, ' --user-prefix [path to folder]');
+    WriteLn(stdout, ' --locale [name of language file]');
+    WriteLn(stdout, ' --nick [string]');
+    WriteLn(stdout, ' --fullscreen-width [fullscreen width in pixels]');
+    WriteLn(stdout, ' --fullscreen-height [fullscreen height in pixels]');
+    WriteLn(stdout, ' --width [window width in pixels]');
+    WriteLn(stdout, ' --height [window height in pixels]');
+    WriteLn(stdout, ' --volume [sound level]');
+    WriteLn(stdout, ' --frame-interval [milliseconds]');
+    Writeln(stdout, ' --stereo [value]');
+    WriteLn(stdout, ' --raw-quality [flags]');
+    WriteLn(stdout, ' --low-quality');
+    WriteLn(stdout, ' --nomusic');
+    WriteLn(stdout, ' --nosound');
+    WriteLn(stdout, ' --fullscreen');
+    WriteLn(stdout, ' --showfps');
+    WriteLn(stdout, ' --altdmg');
+    WriteLn(stdout, ' --no-teamtag');
+    WriteLn(stdout, ' --no-hogtag');
+    WriteLn(stdout, ' --no-healthtag');
+    WriteLn(stdout, ' --translucent-tags');
+    WriteLn(stdout, ' --stats-only');
+    WriteLn(stdout, ' --help');
+    WriteLn(stdout, '');
+    WriteLn(stdout, 'For more detailed help and examples go to:');
+    WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions');
+    GameType:= gmtSyntax;
+end;
+
+procedure setDepth(var paramIndex: LongInt);
+begin
+    WriteLn(stdout, 'WARNING: --depth is a deprecated command, which could be removed in a future version!');
+    WriteLn(stdout, '         This option no longer does anything, please consider removing it');
+    WriteLn(stdout, '');
+   inc(ParamIndex);
+end;
+
+procedure statsOnlyGame;
+begin
+    cOnlyStats:= true;
+    cReducedQuality:= $FFFFFFFF xor rqLowRes;
+    SetSound(false);
+    SetMusic(false);
+    SetVolume(0);
+end;
+
+procedure setIpcPort(port: LongInt; var wrongParameter:Boolean);
+begin
+    if isInternal then
+        ipcPort := port
+    else
+        begin
+        WriteLn(stderr, 'ERROR: use of --port is not allowed');
+        wrongParameter := true;
+        end
+end;
+
+function parseNick(nick: shortstring): shortstring;
+begin
+    if isInternal then
+        parseNick:= DecodeBase64(nick)
+    else
+        parseNick:= nick;
+end;
+
+procedure setStereoMode(tmp: LongInt);
+begin
+    GrayScale:= false;
+{$IFDEF USE_S3D_RENDERING}
+    if (tmp > 6) and (tmp < 13) then
+        begin
+        // set the gray anaglyph rendering
+        GrayScale:= true;
+        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)))
+        end
+    else if tmp <= 6 then
+        // set the fullcolor anaglyph
+        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)))
+    else
+        // any other mode
+        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)));
+{$ELSE}
+    tmp:= tmp;
+    cStereoMode:= smNone;
+{$ENDIF}
+end;
+
+procedure startVideoRecording(var paramIndex: LongInt);
+begin
+    // Silence the hint that appears when USE_VIDEO_RECORDING is not defined
+    paramIndex:= paramIndex;
+{$IFDEF USE_VIDEO_RECORDING}
+    GameType:= gmtRecord;
+    inc(paramIndex);
+    cVideoFramerateNum:= StrToInt(ParamStr(paramIndex)); inc(paramIndex);
+    cVideoFramerateDen:= StrToInt(ParamStr(paramIndex)); inc(paramIndex);
+    RecPrefix:= ParamStr(paramIndex);                    inc(paramIndex);
+    cAVFormat:= ParamStr(paramIndex);                    inc(paramIndex);
+    cVideoCodec:= ParamStr(paramIndex);                  inc(paramIndex);
+    cVideoQuality:= StrToInt(ParamStr(paramIndex));      inc(paramIndex);
+    cAudioCodec:= ParamStr(paramIndex);                  inc(paramIndex);
+{$ENDIF}
+end;
+
+function getLongIntParameter(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt;
+var tmpInt, c: LongInt;
+begin
+    inc(paramIndex);
+{$IFDEF PAS2C}
+    val(str, tmpInt);
+{$ELSE}
+    val(str, tmpInt, c);
+    wrongParameter:= c <> 0;
+    if wrongParameter then
+        WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"');
+{$ENDIF}
+    getLongIntParameter:= tmpInt;
+end;
+
+function getStringParameter(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean): shortstring;
+begin
+    inc(paramIndex);
+    wrongParameter:= (str='') or (Copy(str,1,2) = '--');
+    if wrongParameter then
+         WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"');
+    getStringParameter:= str;
+end;
+
+procedure parseClassicParameter(cmdArray: array of String; size:LongInt; var paramIndex:LongInt); forward;
+
+function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean;
+const videoArray: array [0..4] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth');
+      audioArray: array [0..2] of String = ('--volume','--nomusic','--nosound');
+      otherArray: array [0..2] of String = ('--locale','--fullscreen','--showfps');
+      mediaArray: array [0..9] of String = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen');
+      allArray:   array [0..17] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags');
+      reallyAll:  array [0..34] of shortstring = (
+                '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width',
+                '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
+                '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
+  {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
+  {internal}    '--internal', '--port', '--recorder', '--landpreview',
+  {misc}        '--stats-only', '--gci', '--help','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags');
+var cmdIndex: byte;
+begin
+    parseParameter:= false;
+    cmdIndex:= 0;
+
+    //NOTE: Any update to the list of parameters must be reflected in the case statement below, the reallyAll array above,
+    //      the the DisplayUsage() procedure, the HWForm::getDemoArguments() function, and the online wiki
+
+    while (cmdIndex <= High(reallyAll)) and (cmd <> reallyAll[cmdIndex]) do inc(cmdIndex);
+    case cmdIndex of
+        {--prefix}               0 : PathPrefix        := getStringParameter (arg, paramIndex, parseParameter);
+        {--user-prefix}          1 : UserPathPrefix    := getStringParameter (arg, paramIndex, parseParameter);
+        {--locale}               2 : cLocaleFName      := getStringParameter (arg, paramIndex, parseParameter);
+        {--fullscreen-width}     3 : cFullscreenWidth  := max(getLongIntParameter(arg, paramIndex, parseParameter), cMinScreenWidth);
+        {--fullscreen-height}    4 : cFullscreenHeight := max(getLongIntParameter(arg, paramIndex, parseParameter), cMinScreenHeight);
+        {--width}                5 : cWindowedWidth    := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenWidth);
+        {--height}               6 : cWindowedHeight   := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenHeight);
+        {--frame-interval}       7 : cTimerInterval    := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--volume}               8 : SetVolume          ( max(getLongIntParameter(arg, paramIndex, parseParameter), 0) );
+        {--nomusic}              9 : SetMusic           ( false );
+        {--nosound}             10 : SetSound           ( false );
+        {--fullscreen}          11 : cFullScreen       := true;
+        {--showfps}             12 : cShowFPS          := true;
+        {--altdmg}              13 : cAltDamage        := true;
+        {--low-quality}         14 : cReducedQuality   := $FFFFFFFF xor rqLowRes;
+        {--raw-quality}         15 : cReducedQuality   := getLongIntParameter(arg, paramIndex, parseParameter);
+        {--stereo}              16 : setStereoMode      ( getLongIntParameter(arg, paramIndex, parseParameter) );
+        {--nick}                17 : UserNick          := parseNick( getStringParameter(arg, paramIndex, parseParameter) );
+        {deprecated options}
+        {--depth}               18 : setDepth(paramIndex);
+        {--set-video}           19 : parseClassicParameter(videoArray,5,paramIndex);
+        {--set-audio}           20 : parseClassicParameter(audioArray,3,paramIndex);
+        {--set-other}           21 : parseClassicParameter(otherArray,3,paramIndex);
+        {--set-multimedia}      22 : parseClassicParameter(mediaArray,10,paramIndex);
+        {--set-everything}      23 : parseClassicParameter(allArray,14,paramIndex);
+        {"internal" options}
+        {--internal}            24 : {$IFDEF HWLIBRARY}isInternal:= true{$ENDIF};
+        {--port}                25 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter );
+        {--recorder}            26 : startVideoRecording(paramIndex);
+        {--landpreview}         27 : GameType := gmtLandPreview;
+        {anything else}
+        {--stats-only}          28 : statsOnlyGame();
+        {--gci}                 29 : GciEasterEgg();
+        {--help}                30 : DisplayUsage();
+        {--no-teamtag}          31 : cTagsMask := cTagsMask and (not htTeamName);
+        {--no-hogtag}           32 : cTagsMask := cTagsMask and (not htName);
+        {--no-healthtag}        33 : cTagsMask := cTagsMask and (not htHealth);
+        {--translucent-tags}    34 : cTagsMask := cTagsMask or htTransparent
+    else
+        begin
+        //Asusme the first "non parameter" is the replay file, anything else is invalid
+        if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then
+            recordFileName := cmd
+        else
+            begin
+            WriteLn(stderr, '"'+cmd+'" is not a valid option');
+            parseParameter:= true;
+            end;
+        end;
+    end;
+end;
+
+procedure parseClassicParameter(cmdArray: array of String; size:LongInt; var paramIndex:LongInt);
+var index, tmpInt: LongInt;
+    isBool, isValid: Boolean;
+    cmd, arg, newSyntax: String;
+begin
+    WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!');
+    WriteLn(stdout, '         Consider updating to the latest syntax, which is much more flexible!');
+    WriteLn(stdout, '         Run `hwegine --help` to learn it!');
+    WriteLn(stdout, '');
+
+    index:= 0;
+    tmpInt:= 1;
+    while (index < size) do
+        begin
+        newSyntax:= '';
+        inc(paramIndex);
+        cmd:= cmdArray[index];
+        arg:= ParamStr(paramIndex);
+        isValid:= (cmd<>'--depth');
+
+        // check if the parameter is a boolean one
+        isBool:= (cmd = '--nomusic') or (cmd = '--nosound') or (cmd = '--fullscreen') or (cmd = '--showfps') or (cmd = '--altdmg') or (cmd = '--no-teamtag') or (cmd = '--no-hogtag') or (cmd = '--no-healthtag') or (cmd = '--translucent-tags');
+        if isBool and (arg='0') then
+            isValid:= false;
+        if (cmd='--nomusic') or (cmd='--nosound') then
+            isValid:= not isValid;
+
+        if isValid then
+            begin
+            parseParameter(cmd, arg, tmpInt);
+            newSyntax:= newSyntax + cmd + ' ';
+            if not isBool then
+                newSyntax:= newSyntax + arg + ' ';
+            end;
+        inc(index);
+        end;
+
+    WriteLn(stdout, 'Attempted to automatically convert to the new syntax:');
+    WriteLn(stdout, newSyntax);
+    WriteLn(stdout, '');
+end;
+
+procedure parseCommandLine{$IFDEF HWLIBRARY}(argc: LongInt; argv: PPChar){$ENDIF};
+var paramIndex: LongInt;
+    paramTotal: LongInt;
+    index, nextIndex: LongInt;
+    wrongParameter: boolean;
+//var tmpInt: LongInt;
+begin
+    paramIndex:= {$IFDEF HWLIBRARY}0{$ELSE}1{$ENDIF};
+    paramTotal:= {$IFDEF HWLIBRARY}argc-1{$ELSE}ParamCount{$ENDIF}; //-1 because pascal enumeration is inclusive
+    (*
+    WriteLn(stdout, 'total parameters: ' + inttostr(paramTotal));
+    tmpInt:= 0;
+    while (tmpInt <= paramTotal) do
+        begin
+        WriteLn(stdout, inttostr(tmpInt) + ': ' + {$IFDEF HWLIBRARY}argv[tmpInt]{$ELSE}paramCount(tmpInt){$ENDIF});
+        inc(tmpInt);
+        end;
+    *)
+    wrongParameter:= false;
+    while (paramIndex <= paramTotal) do
+        begin
+        // avoid going past the number of paramTotal (esp. w/ library)
+        index:= paramIndex;
+        if index = paramTotal then nextIndex:= index
+        else nextIndex:= index+1;
+        {$IFDEF HWLIBRARY}
+        wrongParameter:= parseParameter( argv[index], argv[nextIndex], paramIndex);
+        {$ELSE}
+        wrongParameter:= parseParameter( ParamStr(index), ParamStr(nextIndex), paramIndex);
+        {$ENDIF}
+        inc(paramIndex);
+        end;
+    if wrongParameter = true then
+        GameType:= gmtSyntax;
+end;
+
+{$IFNDEF HWLIBRARY}
+procedure GetParams;
+begin
+    isInternal:= (ParamStr(1) = '--internal');
+
+    UserPathPrefix := _S'.';
+    PathPrefix     := cDefaultPathPrefix;
+    recordFileName := '';
+    parseCommandLine();
+
+    if (isInternal) and (ParamCount<=1) then
+        begin
+        WriteLn(stderr, '--internal should not be manually used');
+        GameType := gmtSyntax;
+        end;
+
+    if (not isInternal) and (recordFileName = '') then
+        begin
+        WriteLn(stderr, 'You must specify a replay file');
+        GameType := gmtSyntax;
+        end
+    else if (recordFileName <> '') then
+        WriteLn(stdout, 'Attempting to play demo file "' + recordFilename + '"');
+
+    if (GameType = gmtSyntax) then
+        WriteLn(stderr, 'Please use --help to see possible arguments and their usage');
+
+    (*
+    WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
+    WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
+    *)
+end;
+{$ENDIF}
+
+end.
+
--- a/hedgewars/CMakeLists.txt	Fri Oct 11 11:55:31 2013 +0200
+++ b/hedgewars/CMakeLists.txt	Fri Oct 11 17:43:13 2013 +0200
@@ -12,31 +12,30 @@
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 
+#set the sources with the correct order of dependencies so that cmake won't be confused
 set(engine_sources
     SDLh.pas
     uSinTable.pas
     uFloat.pas
     uConsts.pas
     LuaPas.pas
-    PNGh.pas
     uTypes.pas
+    uVariables.pas
     uUtils.pas
-    uVariables.pas
     uMisc.pas
     uConsole.pas
+    uCommands.pas
     uDebug.pas
-    uCommands.pas
     uInputHandler.pas
     uTextures.pas
     uRenderUtils.pas
     uRender.pas
     uCaptions.pas
-    uLandTexture.pas
     uIO.pas
     uChat.pas
     uPhysFSLayer.pas
-    uStore.pas
     uSound.pas
+    ArgParsers.pas
     uRandom.pas
     uLocale.pas
     uStats.pas
@@ -45,38 +44,44 @@
     uAILandMarks.pas
     adler32.pas
     uLandTemplates.pas
+    uLandTexture.pas
     uLandGraphics.pas
     uLandPainted.pas
     uLandOutline.pas
     uLandGenMaze.pas
+
+    #this is where dependency tracking becomes hard
+    uStore.pas
+    uAmmos.pas
     uLandObjects.pas
     uLand.pas
-    uAmmos.pas
-
+    uGearsList.pas
+    uCollisions.pas
     uAIMisc.pas
     uAIActions.pas
+    uAIAmmoTests.pas
     uAI.pas
     uWorld.pas
+    uVisualGearsList.pas
+    uVisualGearsHandlers.pas
     uVisualGears.pas
-    uTeams.pas
 
-    uGearsList.pas
-    uCollisions.pas
-    uAIAmmoTests.pas
     uGears.pas
     uGame.pas
     uCommandHandlers.pas
+    uGearsRender.pas
+    uGearsHedgehog.pas
     uGearsHandlers.pas
     uGearsHandlersRope.pas
-    uGearsHedgehog.pas
-    uGearsRender.pas
+    uGearsHandlersMess.pas
     uGearsUtils.pas
+    uTeams.pas
+
+    #these interact with everything, so compile last
     uScript.pas
     hwengine.pas
 
-    GSHandlers.inc
-    VGSHandlers.inc
-    ArgParsers.inc
+    #we also have uTouch.pas
     options.inc
     ${CMAKE_CURRENT_BINARY_DIR}/config.inc
     )
@@ -99,51 +104,25 @@
 
 
 #DEPENDECIES AND EXECUTABLES SECTION
-if(APPLE)
-    if(CMAKE_OSX_ARCHITECTURES)
-        #parse this system variable and adjust only the powerpc syntax to be compatible with -P
-        string(REGEX MATCH "[pP][pP][cC]+" powerpc_build "${CMAKE_OSX_ARCHITECTURES}")
-        string(REGEX MATCH "[iI]386+" i386_build "${CMAKE_OSX_ARCHITECTURES}")
-        string(REGEX MATCH "[xX]86_64+" x86_64_build "${CMAKE_OSX_ARCHITECTURES}")
-        if(x86_64_build)
-            add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64)
-        elseif(i386_build)
-            add_flag_prepend(CMAKE_Pascal_FLAGS -Pi386)
-        elseif(powerpc_build)
-            add_flag_prepend(CMAKE_Pascal_FLAGS -Ppowerpc)
-        else()
-            message(FATAL_ERROR "Unknown architecture present in CMAKE_OSX_ARCHITECTURES (${CMAKE_OSX_ARCHITECTURES})")
-        endif()
-        list(LENGTH CMAKE_OSX_ARCHITECTURES num_of_archs)
-        if(num_of_archs GREATER 1)
-            message("*** Only one architecture in CMAKE_OSX_ARCHITECTURES is currently supported, picking the first one ***")
-        endif()
-    elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
-        #if that variable is not set check if we are on x86_64 and if so force it, else use default
-        add_flag_prepend(CMAKE_Pascal_FLAGS -Px86_64)
-    endif()
-
+if(NOT ${BUILD_ENGINE_LIBRARY} AND APPLE)
     #on OSX we need to provide the SDL_main() function when building as executable
-    if(NOT BUILD_ENGINE_LIBRARY)
-        list(APPEND HW_LINK_LIBS SDLmain)
-        add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
-    endif()
-
-    #when sysroot is set, make sure that fpc picks it
-    if(CMAKE_OSX_SYSROOT)
-        set(add_flag_append "-XD${CMAKE_OSX_SYSROOT}")
-    endif(CMAKE_OSX_SYSROOT)
-endif(APPLE)
+    add_subdirectory(sdlmain)
+    list(APPEND HW_LINK_LIBS SDLmain)
+    add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
+endif()
 
 if(FFMPEG_FOUND)
     add_subdirectory(avwrapper)
     list(APPEND HW_LINK_LIBS avwrapper)
     add_definitions(-dUSE_VIDEO_RECORDING)
     add_flag_append(CMAKE_Pascal_FLAGS -Fl${LIBRARY_OUTPUT_PATH})
+    #only for SDL < 2, linking carried out by fpc
+    find_package_or_disable_msg(GLUT NOVIDEOREC "Video recording will not be built")
 endif()
 
 find_package_or_disable_msg(PNG NOPNG "Screenshots will be saved in BMP")
 if(PNG_FOUND)
+    list(INSERT engine_sources 0 PNGh.pas)
     list(REMOVE_AT PNG_LIBRARIES 1) #removing the zlib library path
     get_filename_component(PNG_LIBRARY_DIR ${PNG_LIBRARIES} PATH)
     add_flag_append(CMAKE_Pascal_FLAGS -Fl${PNG_LIBRARY_DIR})
@@ -189,7 +168,7 @@
 
 #SOURCE AND PROGRAMS SECTION
 if(BUILD_ENGINE_LIBRARY)
-    message(${WARNING} "Engine will be built as library (experimental)")
+    message("***Engine will be built as library (experimental)***")
     if(APPLE AND current_macosx_version VERSION_GREATER "10.5")
         # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
         add_flag_prepend(CMAKE_Pascal_FLAGS "-k-no_order_inits")
--- a/hedgewars/GSHandlers.inc	Fri Oct 11 11:55:31 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5646 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@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; version 2 of the License
- *
- * 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
- *)
-
-(*
- * This file contains the step handlers for gears.
- *
- * Important: Since gears change the course of the game, calculations that
- *            lead to different results for different clients/players/machines
- *            should NOT occur!
- *            Use safe functions and data types! (e.g. GetRandom() and hwFloat)
- *)
-
-procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean);
-var
-    dX, dY, sX, sY: hwFloat;
-    i, steps: LongWord;
-    caller: TGearStepProcedure;
-begin
-    dX:= Gear^.dX;
-    dY:= Gear^.dY;
-    steps:= max(abs(hwRound(Gear^.X+dX)-hwRound(Gear^.X)), abs(hwRound(Gear^.Y+dY)-hwRound(Gear^.Y)));
-
-    // Gear is still on the same Pixel it was before
-    if steps < 1 then
-        begin
-        if onlyCheckIfChanged then
-            begin
-            Gear^.X := Gear^.X + dX;
-            Gear^.Y := Gear^.Y + dY;
-            EXIT;
-            end
-        else
-            steps := 1;
-        end;
-
-    if steps > 1 then
-        begin
-        sX:= dX / steps;
-        sY:= dY / steps;
-        end
-
-    else
-        begin
-        sX:= dX;
-        sY:= dY;
-        end;
-
-    caller:= Gear^.doStep;
-
-    for i:= 1 to steps do
-        begin
-        Gear^.X := Gear^.X + sX;
-        Gear^.Y := Gear^.Y + sY;
-        step(Gear);
-        if (Gear^.doStep <> caller)
-        or ((Gear^.State and gstCollision) <> 0)
-        or ((Gear^.State and gstMoving) = 0) then
-            break;
-        end;
-end;
-
-procedure makeHogsWorry(x, y: hwFloat; r: LongInt);
-var
-    gi: PGear;
-    d: LongInt;
-begin
-    gi := GearsList;
-    while gi <> nil do
-        begin
-        if (gi^.Kind = gtHedgehog) then
-            begin
-            d := r - hwRound(Distance(gi^.X - x, gi^.Y - y));
-            if (d > 1) and (not gi^.Invulnerable) and (GetRandom(2) = 0) then
-                begin
-                if (CurrentHedgehog^.Gear = gi) then
-                    PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack)
-
-                else
-                    begin
-                    if ((gi^.State and gstMoving) = 0) and (gi^.Hedgehog^.Effects[heFrozen] = 0) then
-                        begin
-                        gi^.dX.isNegative:= X<gi^.X;
-                        gi^.State := gi^.State or gstLoser;
-                        end;
-
-                    if d > r div 2 then
-                        PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack)
-                    else
-                        PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack);
-                    end;
-                end;
-            end;
-
-        gi := gi^.NextGear
-        end;
-end;
-
-procedure HideHog(HH: PHedgehog);
-begin
-    ScriptCall('onHogHide', HH^.Gear^.Uid);
-    DeleteCI(HH^.Gear);
-    if FollowGear = HH^.Gear then
-        FollowGear:= nil;
-
-    if lastGearByUID = HH^.Gear then
-        lastGearByUID := nil;
-
-    HH^.Gear^.Message:= HH^.Gear^.Message or gmRemoveFromList;
-    with HH^.Gear^ do
-        begin
-        Z := cHHZ;
-        HH^.Gear^.Active:= false;
-        State:= State and (not (gstHHDriven or gstAttacking or gstAttacked));
-        Message := Message and (not gmAttack);
-    end;
-    HH^.GearHidden:= HH^.Gear;
-    HH^.Gear:= nil
-end;
-
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepDrowningGear(Gear: PGear);
-    begin
-    AllInactive := false;
-    Gear^.Y := Gear^.Y + cDrownSpeed;
-    Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed;
-    // Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
-    if (((not SuddenDeathDmg) and (WaterOpacity < $FF))
-    or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
-        if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
-            AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble)
-    else if Random(12) = 0 then
-             AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble);
-    if ((not SuddenDeathDmg) and (WaterOpacity > $FE))
-    or (SuddenDeathDmg and (SDWaterOpacity > $FE))
-    or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
-        DeleteGear(Gear);
-    end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepFallingGear(Gear: PGear);
-var
-    isFalling: boolean;
-    //tmp: QWord;
-    tdX, tdY: hwFloat;
-    collV, collH: LongInt;
-    land: word;
-begin
-    // clip velocity at 2 - over 1 per pixel, but really shouldn't cause many actual problems.
-{$IFNDEF WEBGL}
-    if Gear^.dX.Round > 2 then
-        Gear^.dX.QWordValue:= 8589934592;
-    if Gear^.dY.Round > 2 then
-        Gear^.dY.QWordValue:= 8589934592;
-{$ELSE}
-    if Gear^.dX.Round > 2 then
-        begin
-        Gear^.dX.Round:= 2;
-        Gear^.dX.Frac:= 0
-        end;
-    if Gear^.dY.QWordValue > 2 then
-        begin
-        Gear^.dY.Round:= 2;
-        Gear^.dY.Frac:= 0
-        end;
-{$ENDIF}
-    Gear^.State := Gear^.State and (not gstCollision);
-    collV := 0;
-    collH := 0;
-    tdX := Gear^.dX;
-    tdY := Gear^.dY;
-
-
-
-// might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips)
-    if (hwRound(Gear^.X) < min(LAND_WIDTH div -2, -2048))
-    or (hwRound(Gear^.X) > max(LAND_WIDTH * 3 div 2, 6144)) then
-        Gear^.State := Gear^.State or gstCollision;
-
-    if Gear^.dY.isNegative then
-        begin
-        isFalling := true;
-        land:= TestCollisionYwithGear(Gear, -1);
-        if land <> 0 then
-            begin
-            collV := -1;
-            if land and lfIce <> 0 then
-                Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1)
-            else
-                Gear^.dX := Gear^.dX * Gear^.Friction;
-
-            Gear^.dY := - Gear^.dY * Gear^.Elasticity;
-            Gear^.State := Gear^.State or gstCollision
-            end
-        else if (Gear^.AdvBounce=1) and (TestCollisionYwithGear(Gear, 1) <> 0) then
-            collV := 1;
-        end
-    else
-        begin // Gear^.dY.isNegative is false
-        land:= TestCollisionYwithGear(Gear, 1);
-        if land <> 0 then
-            begin
-            collV := 1;
-            isFalling := false;
-            if land and lfIce <> 0 then
-                Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1)
-            else
-                Gear^.dX := Gear^.dX * Gear^.Friction;
-
-            Gear^.dY := - Gear^.dY * Gear^.Elasticity;
-            Gear^.State := Gear^.State or gstCollision
-            end
-        else
-            begin
-            isFalling := true;
-            if (Gear^.AdvBounce=1) and (TestCollisionYwithGear(Gear, -1) <> 0) then
-                collV := -1
-            end
-        end;
-
-
-    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
-        begin
-        collH := hwSign(Gear^.dX);
-        Gear^.dX := - Gear^.dX * Gear^.Elasticity;
-        Gear^.dY :=   Gear^.dY * Gear^.Elasticity;
-        Gear^.State := Gear^.State or gstCollision
-        end
-    else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then
-        collH := -hwSign(Gear^.dX);
-    //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then
-    if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((collV=-1)
-    or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)) then
-        begin
-        Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction;
-        Gear^.dY := tdX*Gear^.Elasticity;
-        //*Gear^.Friction;
-        Gear^.dY.isNegative := (not tdY.isNegative);
-        isFalling := false;
-        Gear^.AdvBounce := 10;
-        end;
-
-    if Gear^.AdvBounce > 1 then
-        dec(Gear^.AdvBounce);
-
-    if isFalling then
-        begin
-        Gear^.dY := Gear^.dY + cGravity;
-        if (GameFlags and gfMoreWind) <> 0 then
-            Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
-            end;
-
-    Gear^.X := Gear^.X + Gear^.dX;
-    Gear^.Y := Gear^.Y + Gear^.dY;
-    if Gear^.Kind <> gtBee then
-        CheckGearDrowning(Gear);
-    //if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and
-    if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then
-        Gear^.State := Gear^.State and (not gstMoving)
-    else
-        Gear^.State := Gear^.State or gstMoving;
-
-    if (Gear^.nImpactSounds > 0) and
-        (Gear^.State and gstCollision <> 0) and
-        (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and
-        (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or
-            ((Gear^.Radius >= 3) and
-                ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then
-        PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true);
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepBomb(Gear: PGear);
-var
-    i, x, y: LongInt;
-    dX, dY, gdX: hwFloat;
-    vg: PVisualGear;
-begin
-    AllInactive := false;
-
-    doStepFallingGear(Gear);
-
-    dec(Gear^.Timer);
-    if Gear^.Timer = 1000 then // might need adjustments
-        case Gear^.Kind of
-            gtGrenade: makeHogsWorry(Gear^.X, Gear^.Y, 50);
-            gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20);
-            gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75);
-            gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, 90);
-            gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50);
-        end;
-
-    if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then
-        begin
-        CheckCollision(Gear);
-        if (Gear^.State and gstCollision) <> 0 then
-            doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx);
-        end;
-
-    if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then
-        begin
-        vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
-        if vg <> nil then
-            vg^.Tint:= $FFC0C000;
-        end;
-
-    if Gear^.Timer = 0 then
-        begin
-        case Gear^.Kind of
-            gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
-            gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, Gear^.Hedgehog, EXPLAutoSound);
-            gtClusterBomb:
-                begin
-                x := hwRound(Gear^.X);
-                y := hwRound(Gear^.Y);
-                gdX:= Gear^.dX;
-                doMakeExplosion(x, y, 20, Gear^.Hedgehog, EXPLAutoSound);
-                for i:= 0 to 4 do
-                    begin
-                    dX := rndSign(GetRandomf * _0_1) + gdX / 5;
-                    dY := (GetRandomf - _3) * _0_08;
-                    FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25)
-                    end
-                end;
-            gtWatermelon:
-                begin
-                x := hwRound(Gear^.X);
-                y := hwRound(Gear^.Y);
-                gdX:= Gear^.dX;
-                doMakeExplosion(x, y, 75, Gear^.Hedgehog, EXPLAutoSound);
-                for i:= 0 to 5 do
-                    begin
-                    dX := rndSign(GetRandomf * _0_1) + gdX / 5;
-                    dY := (GetRandomf - _1_5) * _0_3;
-                    FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75);
-                    FollowGear^.DirAngle := i * 60
-                    end
-                end;
-            gtHellishBomb:
-                begin
-                x := hwRound(Gear^.X);
-                y := hwRound(Gear^.Y);
-                doMakeExplosion(x, y, 90, Gear^.Hedgehog, EXPLAutoSound);
-
-                for i:= 0 to 127 do
-                    begin
-                    dX := AngleCos(i * 16) * _0_5 * (GetRandomf + _1);
-                    dY := AngleSin(i * 16) * _0_5 * (GetRandomf + _1);
-                    if i mod 2 = 0 then
-                        begin
-                        AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0);
-                        AddGear(x, y, gtFlame, 0, dX, -dY, 0)
-                        end
-                    else
-                        begin
-                        AddGear(x, y, gtFlame, 0, dX, dY, 0);
-                        AddGear(x, y, gtFlame, gstTmpFlag, dX, -dY, 0)
-                        end;
-                    end
-                end;
-            gtGasBomb:
-                begin
-                doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, Gear^.Hedgehog, EXPLAutoSound);
-                for i:= 0 to 2 do
-                    begin
-                    x:= GetRandom(60);
-                    y:= GetRandom(40);
-                    FollowGear:= AddGear(hwRound(Gear^.X) - 30 + x, hwRound(Gear^.Y) - 20 + y, gtPoisonCloud, 0, _0, _0, 0);
-                    end
-                end;
-            end;
-        DeleteGear(Gear);
-        exit
-        end;
-
-    CalcRotationDirAngle(Gear);
-
-    if Gear^.Kind = gtHellishBomb then
-        begin
-
-        if Gear^.Timer = 3000 then
-            begin
-            Gear^.nImpactSounds := 0;
-            PlaySound(sndHellish);
-            end;
-
-        if (GameTicks and $3F) = 0 then
-            if (Gear^.State and gstCollision) = 0 then
-                AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace);
-        end;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepMolotov(Gear: PGear);
-var
-    s: Longword;
-    i, gX, gY: LongInt;
-    dX, dY: hwFloat;
-    smoke, glass: PVisualGear;
-begin
-    AllInactive := false;
-
-    doStepFallingGear(Gear);
-    CalcRotationDirAngle(Gear);
-
-    // let's add some smoke depending on speed
-    s:= max(32,152 - round((abs(hwFloat2FLoat(Gear^.dX))+abs(hwFloat2Float(Gear^.dY)))*120))+random(10);
-    if (GameTicks mod s) = 0 then
-        begin
-        // adjust angle to match the texture
-        if Gear^.dX.isNegative then
-             i:= 130
-        else i:= 50;
-
-        smoke:= AddVisualGear(hwRound(Gear^.X)-round(cos((Gear^.DirAngle+i) * pi / 180)*20), hwRound(Gear^.Y)-round(sin((Gear^.DirAngle+i) * pi / 180)*20), vgtSmoke);
-        if smoke <> nil then
-            smoke^.Scale:= 0.75;
-        end;
-
-    if (Gear^.State and gstCollision) <> 0 then
-        begin
-        PlaySound(sndMolotov);
-        gX := hwRound(Gear^.X);
-        gY := hwRound(Gear^.Y);
-        for i:= 0 to 4 do
-            begin
-            (*glass:= AddVisualGear(gx+random(7)-3, gy+random(5)-2, vgtEgg);
-            if glass <> nil then
-                begin
-                glass^.Frame:= 2;
-                glass^.Tint:= $41B83ED0 - i * $10081000;
-                glass^.dX:= 1/(10*(random(11)-5));
-                glass^.dY:= -1/(random(4)+5);
-                end;*)
-            glass:= AddVisualGear(gx+random(7)-3, gy+random(7)-3, vgtStraightShot);
-            if glass <> nil then
-                with glass^ do
-                    begin
-                    Frame:= 2;
-                    Tint:= $41B83ED0 - i * $10081000;
-                    Angle:= random(360);
-                    dx:= 0.0000001;
-                    dy:= 0;
-                    if random(2) = 0 then
-                        dx := -dx;
-                    FrameTicks:= 750;
-                    State:= ord(sprEgg)
-                    end;
-            end;
-        for i:= 0 to 24 do
-            begin
-            dX := AngleCos(i * 2) * ((_0_15*(i div 5))) * (GetRandomf + _1);
-            dY := AngleSin(i * 8) * _0_5 * (GetRandomf + _1);
-            AddGear(gX, gY, gtFlame, gstTmpFlag, dX, dY, 0);
-            AddGear(gX, gY, gtFlame, gstTmpFlag, dX,-dY, 0);
-            AddGear(gX, gY, gtFlame, gstTmpFlag,-dX, dY, 0);
-            AddGear(gX, gY, gtFlame, gstTmpFlag,-dX,-dY, 0);
-            end;
-        DeleteGear(Gear);
-        exit
-        end;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-
-procedure doStepCluster(Gear: PGear);
-begin
-    AllInactive := false;
-    doStepFallingGear(Gear);
-    if (Gear^.State and gstCollision) <> 0 then
-        begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, Gear^.Hedgehog, EXPLAutoSound);
-        DeleteGear(Gear);
-        exit
-    end;
-
-    if (Gear^.Kind = gtMelonPiece)
-    or (Gear^.Kind = gtBall) then
-        CalcRotationDirAngle(Gear)
-    else if (GameTicks and $1F) = 0 then
-        begin
-        if hwRound(Gear^.Y) > cWaterLine then
-             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble)
-        else AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace)
-        end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepShell(Gear: PGear);
-begin
-    AllInactive := false;
-    if (GameFlags and gfMoreWind) = 0 then
-        Gear^.dX := Gear^.dX + cWindSpeed;
-    doStepFallingGear(Gear);
-    if (Gear^.State and gstCollision) <> 0 then
-        begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
-        DeleteGear(Gear);
-        exit
-        end;
-    if (GameTicks and $3F) = 0 then
-        begin
-        if hwRound(Gear^.Y) > cWaterLine then
-             AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble)
-        else AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace)
-        end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepSnowball(Gear: PGear);
-var kick, i: LongInt;
-    particle: PVisualGear;
-    gdX, gdY: hwFloat;
-begin
-    AllInactive := false;
-    if (GameFlags and gfMoreWind) = 0 then
-        Gear^.dX := Gear^.dX + cWindSpeed;
-    gdX := Gear^.dX;
-    gdY := Gear^.dY;
-    doStepFallingGear(Gear);
-    CalcRotationDirAngle(Gear);
-    if (Gear^.State and gstCollision) <> 0 then
-        begin
-        kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * _20);
-        Gear^.dX:= gdX;
-        Gear^.dY:= gdY;
-        AmmoShove(Gear, 0, kick);
-        for i:= 15 + kick div 10 downto 0 do
-            begin
-            particle := AddVisualGear(hwRound(Gear^.X) + Random(25), hwRound(Gear^.Y) + Random(25), vgtDust);
-            if particle <> nil then
-                particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
-            end;
-        DeleteGear(Gear);
-        exit
-        end;
-    if ((GameTicks and $1F) = 0) and (Random(3) = 0) then
-        begin
-        particle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust);
-        if particle <> nil then
-            particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
-        end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepSnowflake(Gear: PGear);
-var xx, yy, px, py, rx, ry, lx, ly: LongInt;
-    move, draw, allpx, gun: Boolean;
-    s: PSDL_Surface;
-    p: PLongwordArray;
-    lf: LongWord;
-begin
-inc(Gear^.Pos);
-gun:= (Gear^.State and gstTmpFlag) <> 0;
-move:= false;
-draw:= false;
-if gun then
-    begin
-    Gear^.State:= Gear^.State and (not gstInvisible);
-    doStepFallingGear(Gear);
-    CheckCollision(Gear);
-    if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then
-        draw:= true;
-    xx:= hwRound(Gear^.X);
-    yy:= hwRound(Gear^.Y);
-    end
-else if GameTicks and $7 = 0 then
-    begin
-    with Gear^ do
-        begin
-        State:= State and (not gstInvisible);
-        X:= X + cWindSpeed * 3200 + dX;
-        Y:= Y + dY + cGravity * vobFallSpeed * 8;  // using same value as flakes to try and get similar results
-        xx:= hwRound(X);
-        yy:= hwRound(Y);
-        if vobVelocity <> 0 then
-            begin
-            DirAngle := DirAngle + (Damage / 1000);
-            if DirAngle < 0 then
-                DirAngle := DirAngle + 360
-            else if 360 < DirAngle then
-                DirAngle := DirAngle - 360;
-            end;
-(*
-We aren't using frametick right now, so just a waste of cycles.
-        inc(Health, 8);
-        if longword(Health) > vobFrameTicks then
-            begin
-            dec(Health, vobFrameTicks);
-            inc(Timer);
-            if Timer = vobFramesCount then
-                Timer:= 0
-            end;
-*)
-    // move back to cloud layer
-        if yy > cWaterLine then
-            move:= true
-        else if (xx > snowRight) or (xx < snowLeft) then
-            move:=true
-        // Solid pixel encountered
-        else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then
-            begin
-            lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible);
-            if lf = 0 then lf:= lfObject;
-            // If there's room below keep falling
-            if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then
-                begin
-                X:= X - cWindSpeed * 1600 - dX;
-                end
-            // If there's room below, on the sides, fill the gaps
-            else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx-(1*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx-(1*hwSign(cWindSpeed)))] = 0) then
-                begin
-                X:= X - _0_8 * hwSign(cWindSpeed);
-                Y:= Y - dY - cGravity * vobFallSpeed * 8;
-                end
-            else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx-(2*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx-(2*hwSign(cWindSpeed)))] = 0) then
-                begin
-                X:= X - _0_8 * 2 * hwSign(cWindSpeed);
-                Y:= Y - dY - cGravity * vobFallSpeed * 8;
-                end
-            else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx+(1*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx+(1*hwSign(cWindSpeed)))] = 0) then
-                begin
-                X:= X + _0_8 * hwSign(cWindSpeed);
-                Y:= Y - dY - cGravity * vobFallSpeed * 8;
-                end
-            else if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (((xx+(2*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy-1, (xx+(2*hwSign(cWindSpeed)))] = 0) then
-                begin
-                X:= X + _0_8 * 2 * hwSign(cWindSpeed);
-                Y:= Y - dY - cGravity * vobFallSpeed * 8;
-                end
-            // if there's an hog/object below do nothing
-            else if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((Land[yy+1, xx] and $FF) <> 0))
-                then move:=true
-            else draw:= true
-            end
-        end
-    end;
-if draw then
-    with Gear^ do
-        begin
-        // we've collided with land. draw some stuff and get back into the clouds
-        move:= true;
-        if (Pos > 20) and ((CurAmmoGear = nil)
-        or (CurAmmoGear^.Kind <> gtRope)) then
-            begin
-////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
-            if not gun then
-                begin
-                dec(yy,3);
-                dec(xx,1)
-                end;
-            s:= SpritesData[sprSnow].Surface;
-            p:= s^.pixels;
-            allpx:= true;
-            for py:= 0 to Pred(s^.h) do
-                begin
-                for px:= 0 to Pred(s^.w) do
-                    begin
-                    lx:=xx + px; ly:=yy + py;
-                    if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then
-                        begin
-                        rx:= lx;
-                        ry:= ly;
-                        if cReducedQuality and rqBlurryLand <> 0 then
-                            begin
-                            rx:= rx div 2;ry:= ry div 2;
-                            end;
-                        if Land[yy + py, xx + px] <= lfAllObjMask then
-                            if gun then
-                                begin
-                                LandDirty[yy div 32, xx div 32]:= 1;
-                                if LandPixels[ry, rx] = 0 then
-                                    Land[ly, lx]:=  lfDamaged or lfObject
-                                else Land[ly, lx]:=  lfDamaged or lfBasic
-                                end
-                            else Land[ly, lx]:= lf;
-                        if gun then
-                            LandPixels[ry, rx]:= (ExplosionBorderColor and (not AMask)) or (p^[px] and AMask)
-                        else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]);
-                        end
-                    else allpx:= false
-                    end;
-                p:= @(p^[s^.pitch shr 2])
-                end;
-
-            // Why is this here.  For one thing, there's no test on +1 being safe.
-            //Land[py, px+1]:= lfBasic;
-
-            if allpx then
-                UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w), true)
-            else
-                begin
-                UpdateLandTexture(
-                    max(0, min(LAND_WIDTH, xx)),
-                    min(LAND_WIDTH - xx, Pred(s^.w)),
-                    max(0, min(LAND_WIDTH, yy)),
-                    min(LAND_HEIGHT - yy, Pred(s^.h)), false // could this be true without unnecessarily creating blanks?
-                );
-                end;
-////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
-            end
-        end;
-
-if move then
-    begin
-    if gun then
-        begin
-        DeleteGear(Gear);
-        exit
-        end;
-    Gear^.Pos:= 0;
-    Gear^.X:= int2hwFloat(LongInt(GetRandom(snowRight - snowLeft)) + snowLeft);
-    Gear^.Y:= int2hwFloat(LAND_HEIGHT + LongInt(GetRandom(50)) - 1325);
-    Gear^.State:= Gear^.State or gstInvisible;
-    end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepGrave(Gear: PGear);
-begin
-    if (Gear^.Message and gmDestroy) <> 0 then
-        begin
-        DeleteGear(Gear);
-        exit
-        end;
-
-    AllInactive := false;
-
-    if Gear^.dY.isNegative then
-        if TestCollisionY(Gear, -1) then
-            Gear^.dY := _0;
-
-    if (not Gear^.dY.isNegative) then
-        if TestCollisionY(Gear, 1) then
-        begin
-            Gear^.dY := - Gear^.dY * Gear^.Elasticity;
-            if Gear^.dY > - _1div1024 then
-            begin
-                Gear^.Active := false;
-                exit
-            end
-            else if Gear^.dY < - _0_03 then
-                PlaySound(Gear^.ImpactSound)
-        end;
-
-    Gear^.Y := Gear^.Y + Gear^.dY;
-    CheckGearDrowning(Gear);
-    Gear^.dY := Gear^.dY + cGravity
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepBeeWork(Gear: PGear);
-var
-    t: hwFloat;
-    gX,gY,i: LongInt;
-    uw, nuw: boolean;
-    flower: PVisualGear;
-
-begin
-    AllInactive := false;
-    gX := hwRound(Gear^.X);
-    gY := hwRound(Gear^.Y);
-    uw := (Gear^.Tag <> 0); // was bee underwater last tick?
-    nuw := (cWaterLine < gy + Gear^.Radius); // is bee underwater now?
-
-    // if water entered or left
-    if nuw <> uw then
-        begin
-        AddVisualGear(gX, cWaterLine, vgtSplash);
-        AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet);
-        AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet);
-        AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet);
-        AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet);
-        StopSoundChan(Gear^.SoundChannel);
-        if nuw then
-            begin
-            Gear^.SoundChannel := LoopSound(sndBeeWater);
-            Gear^.Tag := 1;
-        end
-        else
-            begin
-            Gear^.SoundChannel := LoopSound(sndBee);
-            Gear^.Tag := 0;
-            end;
-        end;
-
-
-    if Gear^.Timer = 0 then
-        Gear^.RenderTimer:= false
-    else
-        begin
-        if (GameTicks and $F) = 0 then
-            begin
-            if (GameTicks and $30) = 0 then
-                AddVisualGear(gX, gY, vgtBeeTrace);
-            Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000064 * (Gear^.Target.X - gX));
-            Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000064 * (Gear^.Target.Y - gY));
-            // make sure new speed isn't higher than original one (which we stored in Friction variable)
-            t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY);
-            Gear^.dX := Gear^.dX * t;
-            Gear^.dY := Gear^.dY * t;
-            end;
-
-        Gear^.X := Gear^.X + Gear^.dX;
-        Gear^.Y := Gear^.Y + Gear^.dY;
-
-        end;
-
-
-    CheckCollision(Gear);
-    if ((Gear^.State and gstCollision) <> 0) then
-        begin
-        StopSoundChan(Gear^.SoundChannel);
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
-        for i:= 0 to 31 do
-            begin
-            flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
-            if flower <> nil then
-                with flower^ do
-                    begin
-                    Scale:= 0.75;
-                    dx:= 0.001 * (random(200));
-                    dy:= 0.001 * (random(200));
-                    if random(2) = 0 then
-                        dx := -dx;
-                    if random(2) = 0 then
-                        dy := -dy;
-                    FrameTicks:= random(250) + 250;
-                    State:= ord(sprTargetBee);
-                    end;
-            end;
-        DeleteGear(Gear);
-    end;
-
-    if (Gear^.Timer > 0) then
-        dec(Gear^.Timer)
-    else
-        begin
-        if nuw then
-           begin
-            StopSoundChan(Gear^.SoundChannel);
-            CheckGearDrowning(Gear);
-            end
-        else
-            doStepFallingGear(Gear);
-        end;
-end;
-
-procedure doStepBee(Gear: PGear);
-begin
-    AllInactive := false;
-    Gear^.X := Gear^.X + Gear^.dX;
-    Gear^.Y := Gear^.Y + Gear^.dY;
-    Gear^.dY := Gear^.dY + cGravity;
-    CheckCollision(Gear);
-    if (Gear^.State and gstCollision) <> 0 then
-        begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
-        DeleteGear(Gear);
-        exit
-    end;
-    dec(Gear^.Timer);
-    if Gear^.Timer = 0 then
-        begin
-        Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and (not gmAttack);
-        Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and (not gstAttacking);
-        AttackBar:= 0;
-
-        Gear^.SoundChannel := LoopSound(sndBee);
-        Gear^.Timer := 5000;
-        // save initial speed in otherwise unused Friction variable
-        Gear^.Friction := Distance(Gear^.dX, Gear^.dY);
-        Gear^.doStep := @doStepBeeWork
-        end;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepShotIdle(Gear: PGear);
-begin
-    AllInactive := false;
-    inc(Gear^.Timer);
-    if Gear^.Timer > 75 then
-        begin
-        DeleteGear(Gear);
-        AfterAttack
-        end
-end;
-
-procedure doStepShotgunShot(Gear: PGear);
-var
-    i: LongWord;
-    shell: PVisualGear;
-begin
-    AllInactive := false;
-
-    if ((Gear^.State and gstAnimation) = 0) then
-        begin
-        dec(Gear^.Timer);
-        if Gear^.Timer = 0 then
-            begin
-            PlaySound(sndShotgunFire);
-            shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell);
-            if shell <> nil then
-                begin
-                shell^.dX := gear^.dX.QWordValue / -17179869184;
-                shell^.dY := gear^.dY.QWordValue / -17179869184;
-                shell^.Frame := 0
-                end;
-            Gear^.State := Gear^.State or gstAnimation
-            end;
-            exit
-        end else
-        if(Gear^.Hedgehog^.Gear = nil) or ((Gear^.Hedgehog^.Gear^.State and gstMoving) <> 0) then
-            begin
-            DeleteGear(Gear);
-            AfterAttack;
-            exit
-            end
-    else
-        inc(Gear^.Timer);
-
-        i := 200;
-    repeat
-        Gear^.X := Gear^.X + Gear^.dX;
-        Gear^.Y := Gear^.Y + Gear^.dY;
-        CheckCollision(Gear);
-        if (Gear^.State and gstCollision) <> 0 then
-            begin
-            Gear^.X := Gear^.X + Gear^.dX * 8;
-            Gear^.Y := Gear^.Y + Gear^.dY * 8;
-            ShotgunShot(Gear);
-            Gear^.doStep := @doStepShotIdle;
-            exit
-            end;
-
-        CheckGearDrowning(Gear);
-        if (Gear^.State and gstDrowning) <> 0 then
-            begin
-            Gear^.doStep := @doStepShotIdle;
-            exit
-            end;
-        dec(i)
-    until i = 0;
-    if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
-        Gear^.doStep := @doStepShotIdle
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure spawnBulletTrail(Bullet: PGear);
-var oX, oY: hwFloat;
-    VGear: PVisualGear;
-begin
-    if Bullet^.PortalCounter = 0 then
-        begin
-        ox:= CurrentHedgehog^.Gear^.X + Int2hwFloat(GetLaunchX(CurrentHedgehog^.CurAmmoType, hwSign(CurrentHedgehog^.Gear^.dX), CurrentHedgehog^.Gear^.Angle));
-        oy:= CurrentHedgehog^.Gear^.Y + Int2hwFloat(GetLaunchY(CurrentHedgehog^.CurAmmoType, CurrentHedgehog^.Gear^.Angle));
-        end
-    else
-        begin
-        ox:= Bullet^.Elasticity;
-        oy:= Bullet^.Friction;
-        end;
-
-        // Bullet trail
-        VGear := AddVisualGear(hwRound(ox), hwRound(oy), vgtLineTrail);
-
-        if VGear <> nil then
-            begin
-            VGear^.X:= hwFloat2Float(ox);
-            VGear^.Y:= hwFloat2Float(oy);
-            VGear^.dX:= hwFloat2Float(Bullet^.X);
-            VGear^.dY:= hwFloat2Float(Bullet^.Y);
-
-            // reached edge of land. assume infinite beam. Extend it way out past camera
-            if (hwRound(Bullet^.X) and LAND_WIDTH_MASK <> 0)
-            or (hwRound(Bullet^.Y) and LAND_HEIGHT_MASK <> 0) then
-                    // only extend if not under water
-                    if hwRound(Bullet^.Y) < cWaterLine then
-                        begin
-                        VGear^.dX := VGear^.dX + max(LAND_WIDTH,4096) * (VGear^.dX - VGear^.X);
-                        VGear^.dY := VGear^.dY + max(LAND_WIDTH,4096) * (VGear^.dY - VGear^.Y);
-                        end;
-
-            VGear^.Timer := 200;
-            end;
-end;
-
-procedure doStepBulletWork(Gear: PGear);
-var
-    i: LongInt;
-    x, y: LongWord;
-    oX, oY: hwFloat;
-    VGear: PVisualGear;
-begin
-    AllInactive := false;
-    inc(Gear^.Timer);
-    i := 80;
-    oX := Gear^.X;
-    oY := Gear^.Y;
-    repeat
-        Gear^.X := Gear^.X + Gear^.dX;
-        Gear^.Y := Gear^.Y + Gear^.dY;
-        x := hwRound(Gear^.X);
-        y := hwRound(Gear^.Y);
-
-        if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] <> 0) then
-            inc(Gear^.Damage);
-        // let's interrupt before a collision to give portals a chance to catch the bullet
-        if (Gear^.Damage = 1) and (Gear^.Tag = 0) and (not(CheckLandValue(x, y, lfLandMask))) then
-            begin
-            Gear^.Tag := 1;
-            Gear^.Damage := 0;
-            Gear^.X := Gear^.X - Gear^.dX;
-            Gear^.Y := Gear^.Y - Gear^.dY;
-            CheckGearDrowning(Gear);
-            break;
-            end
-        else
-            Gear^.Tag := 0;
-
-        if Gear^.Damage > 5 then
-            if Gear^.AmmoType = amDEagle then
-                AmmoShove(Gear, 7, 20)
-        else
-            AmmoShove(Gear, Gear^.Timer, 20);
-        CheckGearDrowning(Gear);
-        dec(i)
-    until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0);
-
-    if Gear^.Damage > 0 then
-        begin
-        DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1);
-        dec(Gear^.Health, Gear^.Damage);
-        Gear^.Damage := 0
-        end;
-    if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and (((not SuddenDeathDmg) and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF))) then
-        begin
-        for i:=(Gear^.Health - Gear^.Damage) * 4 downto 0 do
-            begin
-            if Random(6) = 0 then
-                AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble);
-            Gear^.X := Gear^.X + Gear^.dX;
-            Gear^.Y := Gear^.Y + Gear^.dY;
-            end;
-        end;
-
-    if (Gear^.Health <= 0)
-        or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0)
-        or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
-            begin
-            if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then
-                cLaserSighting := false;
-            if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and ((GameFlags and gfArtillery) = 0) then
-                cArtillery := false;
-
-        // Bullet Hit
-            if (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then
-                begin
-                VGear := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBulletHit);
-                if VGear <> nil then
-                    begin
-                    VGear^.Angle := DxDy2Angle(-Gear^.dX, Gear^.dY);
-                    end;
-                end;
-
-            spawnBulletTrail(Gear);
-            Gear^.doStep := @doStepShotIdle
-            end;
-end;
-
-procedure doStepDEagleShot(Gear: PGear);
-begin
-    PlaySound(sndGun);
-    // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just plain old weird angles
-    Gear^.X := Gear^.X + Gear^.dX * 3;
-    Gear^.Y := Gear^.Y + Gear^.dY * 3;
-    Gear^.doStep := @doStepBulletWork
-end;
-
-procedure doStepSniperRifleShot(Gear: PGear);
-var
-    HHGear: PGear;
-    shell: PVisualGear;
-begin
-    cArtillery := true;
-    HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.State := HHGear^.State or gstNotKickable;
-    HedgehogChAngle(HHGear);
-    if not cLaserSighting then
-        // game does not have default laser sight. turn it on and give them a chance to aim
-        begin
-        cLaserSighting := true;
-        HHGear^.Message := 0;
-        if (HHGear^.Angle >= 32) then
-            dec(HHGear^.Angle,32)
-        end;
-
-    if (HHGear^.Message and gmAttack) <> 0 then
-        begin
-        shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell);
-        if shell <> nil then
-            begin
-            shell^.dX := gear^.dX.QWordValue / -8589934592;
-            shell^.dY := gear^.dY.QWordValue / -8589934592;
-            shell^.Frame := 1
-            end;
-        Gear^.State := Gear^.State or gstAnimation;
-        Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5;
-        Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5;
-        PlaySound(sndGun);
-        // add 3 initial steps to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths, and also just weird angles
-        Gear^.X := Gear^.X + Gear^.dX * 3;
-        Gear^.Y := Gear^.Y + Gear^.dY * 3;
-        Gear^.doStep := @doStepBulletWork;
-        end
-    else
-        if (GameTicks mod 32) = 0 then
-            if (GameTicks mod 4096) < 2048 then
-                begin
-                if (HHGear^.Angle + 1 <= cMaxAngle) then
-                    inc(HHGear^.Angle)
-                end
-    else
-        if (HHGear^.Angle >= 1) then
-            dec(HHGear^.Angle);
-
-    if (TurnTimeLeft > 0) then
-        dec(TurnTimeLeft)
-    else
-        begin
-        DeleteGear(Gear);
-        AfterAttack
-        end;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepActionTimer(Gear: PGear);
-begin
-dec(Gear^.Timer);
-case Gear^.Kind of
-    gtATStartGame:
-        begin
-        AllInactive := false;
-        if Gear^.Timer = 0 then
-            begin
-            AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState);
-            end
-        end;
-    gtATFinishGame:
-        begin
-        AllInactive := false;
-        if Gear^.Timer = 1000 then
-            begin
-            ScreenFade := sfToBlack;
-            ScreenFadeValue := 0;
-            ScreenFadeSpeed := 1;
-            end;
-        if Gear^.Timer = 0 then
-            begin
-            SendIPC(_S'N');
-            SendIPC(_S'q');
-            GameState := gsExit
-            end
-        end;
-    end;
-if Gear^.Timer = 0 then
-    DeleteGear(Gear)
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepPickHammerWork(Gear: PGear);
-var
-    i, ei, x, y: LongInt;
-    HHGear: PGear;
-begin
-    AllInactive := false;
-    HHGear := Gear^.Hedgehog^.Gear;
-    dec(Gear^.Timer);
-    if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then
-        dec(TurnTimeLeft);
-    if (TurnTimeLeft = 0) or (Gear^.Timer = 0)
-    or((Gear^.Message and gmDestroy) <> 0)
-    or((HHGear^.State and gstHHDriven) =0) then
-        begin
-        StopSoundChan(Gear^.SoundChannel);
-        DeleteGear(Gear);
-        AfterAttack;
-        doStepHedgehogMoving(HHGear);  // for gfInfAttack
-        exit
-        end;
-
-    x:= hwRound(Gear^.X);
-    y:= hwRound(Gear^.Y);
-    if (Gear^.Timer mod 33) = 0 then
-        begin
-        HHGear^.State := HHGear^.State or gstNoDamage;
-        doMakeExplosion(x, y + 7, 6, Gear^.Hedgehog, EXPLDontDraw);
-        HHGear^.State := HHGear^.State and (not gstNoDamage)
-        end;
-
-    if (Gear^.Timer mod 47) = 0 then
-        begin
-        // ok. this was an attempt to turn off dust if not actually drilling land.  I have no idea why it isn't working as expected
-        if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then
-            for i:= 0 to 1 do
-                AddVisualGear(x - 5 + Random(10), y + 12, vgtDust);
-
-        i := x - Gear^.Radius - LongInt(GetRandom(2));
-        ei := x + Gear^.Radius + LongInt(GetRandom(2));
-        while i <= ei do
-            begin
-            DrawExplosion(i, y + 3, 3);
-            inc(i, 1)
-            end;
-
-        if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9), lfIndestructible) then
-            begin
-            Gear^.X := Gear^.X + Gear^.dX;
-            Gear^.Y := Gear^.Y + _1_9;
-            end;
-        SetAllHHToActive(true);
-        end;
-    if TestCollisionYwithGear(Gear, 1) <> 0 then
-        begin
-        Gear^.dY := _0;
-        SetLittle(HHGear^.dX);
-        HHGear^.dY := _0;
-        end
-    else
-        begin
-        if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y + Gear^.dY + cGravity), lfLandMask) then
-            begin
-            Gear^.dY := Gear^.dY + cGravity;
-            Gear^.Y := Gear^.Y + Gear^.dY
-            end;
-        if hwRound(Gear^.Y) > cWaterLine then
-            Gear^.Timer := 1
-        end;
-
-    Gear^.X := Gear^.X + HHGear^.dX;
-    if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)-cHHRadius, lfLandMask) then
-        begin
-        HHGear^.X := Gear^.X;
-        HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius)
-        end;
-
-    if (Gear^.Message and gmAttack) <> 0 then
-        if (Gear^.State and gsttmpFlag) <> 0 then
-            Gear^.Timer := 1
-    else //there would be a mistake.
-    else
-        if (Gear^.State and gsttmpFlag) = 0 then
-            Gear^.State := Gear^.State or gsttmpFlag;
-    if ((Gear^.Message and gmLeft) <> 0) then
-        Gear^.dX := - _0_3
-    else
-        if ((Gear^.Message and gmRight) <> 0) then
-            Gear^.dX := _0_3
-    else Gear^.dX := _0;
-end;
-
-procedure doStepPickHammer(Gear: PGear);
-var
-    i, y: LongInt;
-    ar: TRangeArray;
-    HHGear: PGear;
-begin
-    i := 0;
-    HHGear := Gear^.Hedgehog^.Gear;
-
-    y := hwRound(Gear^.Y) - cHHRadius * 2;
-    while y < hwRound(Gear^.Y) do
-        begin
-        ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2));
-        ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2));
-        inc(y, 2);
-        inc(i)
-        end;
-
-    DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i));
-    Gear^.dY := HHGear^.dY;
-    DeleteCI(HHGear);
-
-    Gear^.SoundChannel := LoopSound(sndPickhammer);
-    doStepPickHammerWork(Gear);
-    Gear^.doStep := @doStepPickHammerWork
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-var
-    BTPrevAngle, BTSteps: LongInt;
-
-procedure doStepBlowTorchWork(Gear: PGear);
-var
-    HHGear: PGear;
-    b: boolean;
-    prevX: LongInt;
-begin
-    AllInactive := false;
-    dec(Gear^.Timer);
-    if ((GameFlags and gfInfAttack) <> 0) and (TurnTimeLeft > 0) then
-        dec(TurnTimeLeft);
-
-    HHGear := Gear^.Hedgehog^.Gear;
-
-    HedgehogChAngle(HHGear);
-
-    b := false;
-
-    if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7  then
-        begin
-        Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX);
-        Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5);
-        BTPrevAngle := HHGear^.Angle;
-        b := true
-        end;
-
-    if ((HHGear^.State and gstMoving) <> 0) then
-        begin
-        doStepHedgehogMoving(HHGear);
-        if (HHGear^.State and gstHHDriven) = 0 then
-            Gear^.Timer := 0
-        end;
-
-    if Gear^.Timer mod cHHStepTicks = 0 then
-        begin
-        b := true;
-        if Gear^.dX.isNegative then
-            HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmLeft
-        else
-            HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight;
-
-        if ((HHGear^.State and gstMoving) = 0) then
-            begin
-            HHGear^.State := HHGear^.State and (not gstAttacking);
-            prevX := hwRound(HHGear^.X);
-
-            // why the call to HedgehogStep then a further increment of X?
-            if (prevX = hwRound(HHGear^.X)) and
-               CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),
-               lfIndestructible) then HedgehogStep(HHGear);
-
-            if (prevX = hwRound(HHGear^.X)) and
-               CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y),
-               lfIndestructible) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX);
-            HHGear^.State := HHGear^.State or gstAttacking
-            end;
-
-        inc(BTSteps);
-        if BTSteps = 7 then
-            begin
-            BTSteps := 0;
-            if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then
-                begin
-                Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC);
-                Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC);
-                end;
-            HHGear^.State := HHGear^.State or gstNoDamage;
-            AmmoShove(Gear, 2, 15);
-            HHGear^.State := HHGear^.State and (not gstNoDamage)
-            end;
-        end;
-
-    if b then
-    begin
-        DrawTunnel(HHGear^.X + Gear^.dX * cHHRadius,
-        HHGear^.Y + Gear^.dY * cHHRadius - _1 -
-        ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7),
-        Gear^.dX, Gear^.dY,
-        cHHStepTicks, cHHRadius * 2 + 7);
-    end;
-
-    if (TurnTimeLeft = 0) or (Gear^.Timer = 0)
-    or ((HHGear^.Message and gmAttack) <> 0) then
-        begin
-        HHGear^.Message := 0;
-        HHGear^.State := HHGear^.State and (not gstNotKickable);
-        DeleteGear(Gear);
-        AfterAttack
-        end
-end;
-
-procedure doStepBlowTorch(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    BTPrevAngle := High(LongInt);
-    BTSteps := 0;
-    HHGear := Gear^.Hedgehog^.Gear;
-    HedgehogChAngle(HHGear);
-    Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX);
-    Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5);
-    DrawTunnel(HHGear^.X,
-        HHGear^.Y + Gear^.dY * cHHRadius - _1 -
-        ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7),
-        Gear^.dX, Gear^.dY,
-        cHHStepTicks, cHHRadius * 2 + 7);
-    HHGear^.Message := 0;
-    HHGear^.State := HHGear^.State or gstNotKickable;
-    Gear^.doStep := @doStepBlowTorchWork
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepMine(Gear: PGear);
-var vg: PVisualGear;
-    dxdy: hwFloat;
-begin
-    if Gear^.Health = 0 then dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY);
-    if (Gear^.State and gstMoving) <> 0 then
-        begin
-        DeleteCI(Gear);
-        doStepFallingGear(Gear);
-        if (Gear^.State and gstMoving) = 0 then
-            begin
-            AddGearCI(Gear);
-            Gear^.dX := _0;
-            Gear^.dY := _0
-            end;
-        CalcRotationDirAngle(Gear);
-        AllInactive := false
-        end
-    else if (GameTicks and $3F) = 25 then
-        doStepFallingGear(Gear);
-    if (Gear^.Health = 0) then
-        begin
-        if (dxdy > _0_4) and (Gear^.State and gstCollision <> 0) then
-            inc(Gear^.Damage, hwRound(dxdy * _50));
-
-        if ((GameTicks and $FF) = 0) and (Gear^.Damage > random(30)) then
-            begin
-            vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
-            if vg <> nil then
-                vg^.Scale:= 0.5
-            end;
-
-        if (Gear^.Damage > 35) then
-            begin
-            doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
-            DeleteGear(Gear);
-            exit
-            end
-        end;
-
-    if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
-        if ((Gear^.State and gstAttacking) = 0) then
-            begin
-            if ((GameTicks and $1F) = 0) then
-                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
-                    Gear^.State := Gear^.State or gstAttacking
-            end
-        else // gstAttacking <> 0
-            begin
-            AllInactive := false;
-            if (Gear^.Timer and $FF) = 0 then
-                PlaySound(sndMineTick);
-            if Gear^.Timer = 0 then
-                begin
-                if ((Gear^.State and gstWait) <> 0)
-                or (cMineDudPercent = 0)
-                or (getRandom(100) > cMineDudPercent) then
-                    begin
-                    doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, Gear^.Hedgehog, EXPLAutoSound);
-                    DeleteGear(Gear)
-                    end
-                else
-                    begin
-                    vg:= AddVisualGear(hwRound(Gear^.X) - 4  + Random(8), hwRound(Gear^.Y) - 4 - Random(4), vgtSmoke);
-                    if vg <> nil then
-                        vg^.Scale:= 0.5;
-                    PlaySound(sndVaporize);
-                    Gear^.Health := 0;
-                    Gear^.Damage := 0;
-                    Gear^.State := Gear^.State and (not gstAttacking)
-                    end;
-                exit
-                end;
-            dec(Gear^.Timer);
-            end
-    else // gsttmpFlag = 0
-        if (TurnTimeLeft = 0)
-        or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime))
-        or (Gear^.Hedgehog^.Gear = nil) then
-            Gear^.State := Gear^.State or gsttmpFlag;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepSMine(Gear: PGear);
-begin
-    // TODO: do real calculation?
-    if TestCollisionXwithGear(Gear, 2)
-    or (TestCollisionYwithGear(Gear, -2) <> 0)
-    or TestCollisionXwithGear(Gear, -2)
-    or (TestCollisionYwithGear(Gear, 2) <> 0) then
-        begin
-        if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then
-            begin
-            PlaySound(sndRopeAttach);
-            Gear^.dX:= _0;
-            Gear^.dY:= _0;
-            AddGearCI(Gear);
-            end;
-        end
-    else
-        begin
-        DeleteCI(Gear);
-        doStepFallingGear(Gear);
-        AllInactive := false;
-        CalcRotationDirAngle(Gear);
-        end;
-
-    if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
-        begin
-        if ((Gear^.State and gstAttacking) = 0) then
-            begin
-            if ((GameTicks and $1F) = 0) then
-                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
-                    Gear^.State := Gear^.State or gstAttacking
-            end
-        else // gstAttacking <> 0
-        begin
-            AllInactive := false;
-            if Gear^.Timer = 0 then
-                begin
-                doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
-                DeleteGear(Gear);
-                exit
-            end else
-                if (Gear^.Timer and $FF) = 0 then
-                    PlaySound(sndMineTick);
-
-            dec(Gear^.Timer);
-                end
-        end
-    else // gsttmpFlag = 0
-        if (TurnTimeLeft = 0)
-        or ((GameFlags and gfInfAttack <> 0) and (GameTicks > Gear^.FlightTime))
-        or (Gear^.Hedgehog^.Gear = nil) then
-            Gear^.State := Gear^.State or gsttmpFlag;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepDynamite(Gear: PGear);
-begin
-    doStepFallingGear(Gear);
-    AllInactive := false;
-    if Gear^.Timer mod 166 = 0 then
-        inc(Gear^.Tag);
-    if Gear^.Timer = 1000 then // might need better timing
-        makeHogsWorry(Gear^.X, Gear^.Y, 75);
-    if Gear^.Timer = 0 then
-        begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, Gear^.Hedgehog, EXPLAutoSound);
-        DeleteGear(Gear);
-        exit
-        end;
-    dec(Gear^.Timer);
-end;
-
-///////////////////////////////////////////////////////////////////////////////
-
-procedure doStepRollingBarrel(Gear: PGear);
-var
-    i: LongInt;
-    particle: PVisualGear;
-    dxdy: hwFloat;
-begin
-    if (Gear^.dY.QWordValue = 0) and (Gear^.dY.QWordValue = 0) and (TestCollisionYwithGear(Gear, 1) = 0) then
-        SetLittle(Gear^.dY);
-    Gear^.State := Gear^.State or gstAnimation;
-    if Gear^.Health < cBarrelHealth then Gear^.State:= Gear^.State and (not gstFrozen);
-
-    if ((Gear^.dX.QWordValue <> 0)
-    or (Gear^.dY.QWordValue <> 0))  then
-        begin
-        DeleteCI(Gear);
-        AllInactive := false;
-        dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY);
-        doStepFallingGear(Gear);
-        if (Gear^.State and gstCollision <> 0) and(dxdy > _0_4) then
-            begin
-            if (TestCollisionYwithGear(Gear, 1) <> 0) then
-                begin
-                Gear^.State := Gear^.State or gsttmpFlag;
-                for i:= min(12, hwRound(dxdy*_10)) downto 0 do
-                    begin
-                    particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12,vgtDust);
-                    if particle <> nil then
-                        particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
-                    end
-                end;
-            inc(Gear^.Damage, hwRound(dxdy * _50))
-            end;
-        CalcRotationDirAngle(Gear);
-        //CheckGearDrowning(Gear)
-        end
-    else
-        begin
-        Gear^.State := Gear^.State or gsttmpFlag;
-        AddGearCI(Gear)
-        end;
-
-(*
-Attempt to make a barrel knock itself over an edge.  Would need more checks to avoid issues like burn damage
-    begin
-    x:= hwRound(Gear^.X);
-    y:= hwRound(Gear^.Y);
-    if (((y+1) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then
-        if (Land[y+1, x] = 0) then
-            begin
-            if (((y+1) and LAND_HEIGHT_MASK) = 0) and (((x+Gear^.Radius-2) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x+Gear^.Radius-2] = 0) then
-                Gear^.dX:= -_0_08
-            else if (((y+1 and LAND_HEIGHT_MASK)) = 0) and (((x-(Gear^.Radius-2)) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x-(Gear^.Radius-2)] = 0) then
-                Gear^.dX:= _0_08;
-            end;
-    if Gear^.dX.QWordValue = 0 then AddGearCI(Gear)
-    end; *)
-
-    if (not Gear^.dY.isNegative) and (Gear^.dY < _0_001) and (TestCollisionYwithGear(Gear, 1) <> 0) then
-        Gear^.dY := _0;
-    if hwAbs(Gear^.dX) < _0_001 then
-        Gear^.dX := _0;
-
-    if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
-        if (cBarrelHealth div Gear^.Health) > 2 then
-            AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)
-    else
-        AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
-    dec(Gear^.Health, Gear^.Damage);
-    Gear^.Damage := 0;
-    if Gear^.Health <= 0 then
-        doStepCase(Gear);
-end;
-
-procedure doStepCase(Gear: PGear);
-var
-    i, x, y: LongInt;
-    k: TGearType;
-    dX, dY: HWFloat;
-    hog: PHedgehog;
-    sparkles: PVisualGear;
-    gi: PGear;
-begin
-    k := Gear^.Kind;
-
-    if (Gear^.Message and gmDestroy) > 0 then
-        begin
-        DeleteGear(Gear);
-        FreeActionsList;
-        SetAllToActive;
-        // something (hh, mine, etc...) could be on top of the case
-        with CurrentHedgehog^ do
-            if Gear <> nil then
-                Gear^.Message := Gear^.Message and (not (gmLJump or gmHJump));
-        exit
-        end;
-    if (k = gtExplosives) and (Gear^.Health < cBarrelHealth) then Gear^.State:= Gear^.State and (not gstFrozen);
-
-    if ((k <> gtExplosives) and (Gear^.Damage > 0)) or ((k = gtExplosives) and (Gear^.Health<=0)) then
-        begin
-        x := hwRound(Gear^.X);
-        y := hwRound(Gear^.Y);
-        hog:= Gear^.Hedgehog;
-
-        DeleteGear(Gear);
-        // <-- delete gear!
-
-        if k = gtCase then
-            begin
-            doMakeExplosion(x, y, 25, hog, EXPLAutoSound);
-            for i:= 0 to 63 do
-                AddGear(x, y, gtFlame, 0, _0, _0, 0);
-            end
-        else if k = gtExplosives then
-                begin
-                doMakeExplosion(x, y, 75, hog, EXPLAutoSound);
-                for i:= 0 to 31 do
-                    begin
-                    dX := AngleCos(i * 64) * _0_5 * (getrandomf + _1);
-                    dY := AngleSin(i * 64) * _0_5 * (getrandomf + _1);
-                    AddGear(x, y, gtFlame, 0, dX, dY, 0);
-                    AddGear(x, y, gtFlame, gstTmpFlag, -dX, -dY, 0);
-                    end
-                end;
-            exit
-        end;
-
-    if k = gtExplosives then
-        begin
-        //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
-        if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02)) then
-            begin
-            Gear^.doStep := @doStepRollingBarrel;
-            exit;
-            end
-        else Gear^.dX:= _0;
-
-        if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
-            if (cBarrelHealth div Gear^.Health) > 2 then
-                AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)
-            else
-                AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
-        dec(Gear^.Health, Gear^.Damage);
-        Gear^.Damage := 0;
-        end
-    else
-        begin
-        if (Gear^.Pos <> posCaseHealth) and (GameTicks and $1FFF = 0) then // stir 'em up periodically
-            begin
-            gi := GearsList;
-            while gi <> nil do
-                begin
-                if gi^.Kind = gtGenericFaller then
-                    begin
-                    gi^.Active:= true;
-                    gi^.X:=  int2hwFloat(GetRandom(rightX-leftX)+leftX);
-                    gi^.Y:=  int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
-                    gi^.dX:= _90-(GetRandomf*_360);
-                    gi^.dY:= _90-(GetRandomf*_360)
-                    end;
-                gi := gi^.NextGear
-                end
-            end;
-
-        if Gear^.Timer = 500 then
-            begin
-(* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up
-   voices. Reinforcements voices is heard for active team, not team-to-be.  Either that or change crate spawn from end of turn to start, although that
-   has its own complexities. *)
-            // Abuse a couple of gear values to track origin
-            Gear^.Angle:= hwRound(Gear^.Y);
-            Gear^.Tag:= random(2);
-            inc(Gear^.Timer)
-            end;
-        if Gear^.Timer < 1833 then inc(Gear^.Timer);
-        if Gear^.Timer = 1000 then
-            begin
-            sparkles:= AddVisualGear(hwRound(Gear^.X), Gear^.Angle, vgtDust, 1);
-            if sparkles <> nil then
-                begin
-                sparkles^.dX:= 0;
-                sparkles^.dY:= 0;
-                sparkles^.Angle:= 270;
-                if Gear^.Tag = 1 then
-                    sparkles^.Tint:= $3744D7FF
-                else sparkles^.Tint:= $FAB22CFF
-                end;
-            end;
-        if Gear^.Timer < 1000 then
-            begin
-            AllInactive:= false;
-            exit
-            end
-        end;
-
-
-    if (Gear^.dY.QWordValue <> 0)
-    or (TestCollisionYwithGear(Gear, 1) = 0) then
-        begin
-        AllInactive := false;
-
-        Gear^.dY := Gear^.dY + cGravity;
-
-        if (Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, -1) <> 0) then
-            Gear^.dY := _0;
-
-        Gear^.Y := Gear^.Y + Gear^.dY;
-
-        if (not Gear^.dY.isNegative) and (Gear^.dY > _0_001) then
-            SetAllHHToActive(false);
-
-        if (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) <> 0) then
-            begin
-            if (Gear^.dY > _0_2) and (k = gtExplosives) then
-                inc(Gear^.Damage, hwRound(Gear^.dY * _70));
-
-            if Gear^.dY > _0_2 then
-                for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do
-                    AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
-
-            Gear^.dY := - Gear^.dY * Gear^.Elasticity;
-            if Gear^.dY > - _0_001 then
-                Gear^.dY := _0
-            else if Gear^.dY < - _0_03 then
-                PlaySound(Gear^.ImpactSound);
-            end;
-        //if Gear^.dY > - _0_001 then Gear^.dY:= _0
-        CheckGearDrowning(Gear);
-        end;
-
-    if (Gear^.dY.QWordValue = 0) then
-        AddGearCI(Gear)
-    else if (Gear^.dY.QWordValue <> 0) then
-        DeleteCI(Gear)
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-
-procedure doStepTarget(Gear: PGear);
-begin
-    if (Gear^.Timer = 0) and (Gear^.Tag = 0) then
-        PlaySound(sndWarp);
-
-    if (Gear^.Tag = 0) and (Gear^.Timer < 1000) then
-        inc(Gear^.Timer)
-    else if Gear^.Tag = 1 then
-        Gear^.Tag := 2
-    else if Gear^.Tag = 2 then
-            if Gear^.Timer > 0 then
-                dec(Gear^.Timer)
-    else
-        begin
-        DeleteGear(Gear);
-        exit;
-        end;
-
-    doStepCase(Gear)
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepIdle(Gear: PGear);
-begin
-    AllInactive := false;
-    dec(Gear^.Timer);
-    if Gear^.Timer = 0 then
-        begin
-        DeleteGear(Gear);
-        AfterAttack
-        end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepShover(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.State := HHGear^.State or gstNoDamage;
-    DeleteCI(HHGear);
-
-    AmmoShove(Gear, 30, 115);
-
-    HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
-    Gear^.Timer := 250;
-    Gear^.doStep := @doStepIdle
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepWhip(Gear: PGear);
-var
-    HHGear: PGear;
-    i: LongInt;
-begin
-    HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.State := HHGear^.State or gstNoDamage;
-    DeleteCI(HHGear);
-
-    for i:= 0 to 3 do
-        begin
-        AmmoShove(Gear, 30, 25);
-        Gear^.X := Gear^.X + Gear^.dX * 5
-        end;
-
-    HHGear^.State := (HHGear^.State and (not gstNoDamage)) or gstMoving;
-
-    Gear^.Timer := 250;
-    Gear^.doStep := @doStepIdle
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepFlame(Gear: PGear);
-var
-    gX,gY,i: LongInt;
-    sticky: Boolean;
-    vgt: PVisualGear;
-    tdX,tdY: HWFloat;
-begin
-    sticky:= (Gear^.State and gsttmpFlag) <> 0;
-    if (not sticky) then AllInactive := false;
-
-    if TestCollisionYwithGear(Gear, 1) = 0 then
-        begin
-        AllInactive := false;
-
-        if ((GameTicks mod 100) = 0) then
-            begin
-            vgt:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire, gstTmpFlag);
-            if vgt <> nil then
-                begin
-                vgt^.dx:= 0;
-                vgt^.dy:= 0;
-                vgt^.FrameTicks:= 1800 div (Gear^.Tag mod 3 + 2);
-                end;
-            end;
-
-
-        if Gear^.dX.QWordValue > _0_01.QWordValue then
-            Gear^.dX := Gear^.dX * _0_995;
-
-        Gear^.dY := Gear^.dY + cGravity;
-        // if sticky then Gear^.dY := Gear^.dY + cGravity;
-
-        if Gear^.dY.QWordValue > _0_2.QWordValue then
-            Gear^.dY := Gear^.dY * _0_995;
-
-        //if sticky then Gear^.X := Gear^.X + Gear^.dX else
-        Gear^.X := Gear^.X + Gear^.dX + cWindSpeed * 640;
-        Gear^.Y := Gear^.Y + Gear^.dY;
-
-        if (hwRound(Gear^.Y) > cWaterLine) then
-            begin
-            gX := hwRound(Gear^.X);
-            for i:= 0 to 3 do
-                AddVisualGear(gX - 16 + Random(32), cWaterLine - 16 + Random(16), vgtSteam);
-            PlaySound(sndVaporize);
-            DeleteGear(Gear);
-            exit
-            end
-        end
-    else
-        begin
-        if sticky then
-            begin
-            Gear^.Radius := 7;
-            tdX:= Gear^.dX;
-            tdY:= Gear^.dY;
-            Gear^.dX.QWordValue:= 214748365;
-            Gear^.dY.QWordValue:= 429496730;
-            Gear^.dX.isNegative:= getrandom(2)<>1;
-            Gear^.dY.isNegative:= true;
-            AmmoShove(Gear, 2, 125);
-            Gear^.dX:= tdX;
-            Gear^.dY:= tdY;
-            Gear^.Radius := 1
-            end;
-        if Gear^.Timer > 0 then
-            begin
-            dec(Gear^.Timer);
-            inc(Gear^.Damage)
-            end
-        else
-            begin
-            gX := hwRound(Gear^.X);
-            gY := hwRound(Gear^.Y);
-            // Standard fire
-            if (not sticky) then
-                begin
-                if ((GameTicks and $1) = 0) then
-                    begin
-                    Gear^.Radius := 7;
-                    tdX:= Gear^.dX;
-                    tdY:= Gear^.dY;
-                    Gear^.dX.QWordValue:= 214748365;
-                    Gear^.dY.QWordValue:= 429496730;
-                    Gear^.dX.isNegative:= getrandom(2)<>1;
-                    Gear^.dY.isNegative:= true;
-                    AmmoShove(Gear, 6, 100);
-                    Gear^.dX:= tdX;
-                    Gear^.dY:= tdY;
-                    Gear^.Radius := 1;
-                    end
-                else if ((GameTicks and $3) = 3) then
-                    doMakeExplosion(gX, gY, 8, Gear^.Hedgehog, 0);//, EXPLNoDamage);
-                //DrawExplosion(gX, gY, 4);
-
-                if ((GameTicks and $7) = 0) and (Random(2) = 0) then
-                    for i:= Random(2) downto 0 do
-                        AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
-
-                if Gear^.Health > 0 then
-                    dec(Gear^.Health);
-                Gear^.Timer := 450 - Gear^.Tag * 8
-                end
-            else
-                begin
-                // Modified fire
-                if ((GameTicks and $7FF) = 0) and ((GameFlags and gfSolidLand) = 0) then
-                    begin
-                    DrawExplosion(gX, gY, 4);
-
-                    for i:= Random(3) downto 0 do
-                        AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
-                    end;
-
-// This one is interesting.  I think I understand the purpose, but I wonder if a bit more fuzzy of kicking could be done with getrandom.
-                Gear^.Timer := 100 - Gear^.Tag * 3;
-                if (Gear^.Damage > 3000+Gear^.Tag*1500) then
-                    Gear^.Health := 0
-                end
-            end
-        end;
-    if Gear^.Health = 0 then
-        begin
-        gX := hwRound(Gear^.X);
-        gY := hwRound(Gear^.Y);
-        if (not sticky) then
-            begin
-            if ((GameTicks and $3) = 0) and (Random(1) = 0) then
-                for i:= Random(2) downto 0 do
-                    AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
-            end
-        else
-            for i:= Random(3) downto 0 do
-                AddVisualGear(gX - 3 + Random(6), gY - 2, vgtSmoke);
-
-        DeleteGear(Gear)
-        end;
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepFirePunchWork(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    AllInactive := false;
-    if ((Gear^.Message and gmDestroy) <> 0) then
-        begin
-        DeleteGear(Gear);
-        AfterAttack;
-        exit
-        end;
-
-    HHGear := Gear^.Hedgehog^.Gear;
-    if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then
-        begin
-        Gear^.Tag := hwRound(HHGear^.Y);
-        DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4, 2);
-        HHGear^.State := HHGear^.State or gstNoDamage;
-        Gear^.Y := HHGear^.Y;
-        AmmoShove(Gear, 30, 40);
-        HHGear^.State := HHGear^.State and (not gstNoDamage)
-        end;
-
-    HHGear^.dY := HHGear^.dY + cGravity;
-    if (not HHGear^.dY.isNegative) then
-        begin
-        HHGear^.State := HHGear^.State or gstMoving;
-        DeleteGear(Gear);
-        AfterAttack;
-        exit
-        end;
-
-    if CheckLandValue(hwRound(HHGear^.X), hwRound(HHGear^.Y + HHGear^.dY + SignAs(_6,Gear^.dY)),
-        lfIndestructible) then
-            HHGear^.Y := HHGear^.Y + HHGear^.dY
-end;
-
-procedure doStepFirePunch(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    AllInactive := false;
-    HHGear := Gear^.Hedgehog^.Gear;
-    DeleteCI(HHGear);
-    //HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5; WTF?
-    HHGear^.dX := SignAs(cLittle, Gear^.dX);
-
-    HHGear^.dY := - _0_3;
-
-    Gear^.X := HHGear^.X;
-    Gear^.dX := SignAs(_0_45, Gear^.dX);
-    Gear^.dY := - _0_9;
-    Gear^.doStep := @doStepFirePunchWork;
-    DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5);
-
-    PlaySoundV(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.voicepack)
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-
-procedure doStepParachuteWork(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    HHGear := Gear^.Hedgehog^.Gear;
-
-    inc(Gear^.Timer);
-
-    if (TestCollisionYwithGear(HHGear, 1) <> 0)
-    or ((HHGear^.State and gstHHDriven) = 0)
-    or CheckGearDrowning(HHGear)
-    or ((Gear^.Message and gmAttack) <> 0) then
-        begin
-        with HHGear^ do
-            begin
-            Message := 0;
-            SetLittle(dX);
-            dY := _0;
-            State := State or gstMoving;
-            end;
-        DeleteGear(Gear);
-        isCursorVisible := false;
-        ApplyAmmoChanges(HHGear^.Hedgehog^);
-        exit
-        end;
-
-    HHGear^.X := HHGear^.X + cWindSpeed * 200;
-
-    if (Gear^.Message and gmLeft) <> 0 then
-        HHGear^.X := HHGear^.X - cMaxWindSpeed * 80
-
-    else if (Gear^.Message and gmRight) <> 0 then
-        HHGear^.X := HHGear^.X + cMaxWindSpeed * 80;
-
-    if (Gear^.Message and gmUp) <> 0 then
-        HHGear^.Y := HHGear^.Y - cGravity * 40
-
-    else if (Gear^.Message and gmDown) <> 0 then
-        HHGear^.Y := HHGear^.Y + cGravity * 40;
-
-    // don't drift into obstacles
-    if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
-        HHGear^.X := HHGear^.X - int2hwFloat(hwSign(HHGear^.dX));
-    HHGear^.Y := HHGear^.Y + cGravity * 100;
-    Gear^.X := HHGear^.X;
-    Gear^.Y := HHGear^.Y
-end;
-
-procedure doStepParachute(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    HHGear := Gear^.Hedgehog^.Gear;
-
-    DeleteCI(HHGear);
-
-    AfterAttack;
-
-    HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked or gstMoving));
-    HHGear^.Message := HHGear^.Message and (not gmAttack);
-
-    Gear^.doStep := @doStepParachuteWork;
-
-    Gear^.Message := HHGear^.Message;
-    doStepParachuteWork(Gear)
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepAirAttackWork(Gear: PGear);
-begin
-    AllInactive := false;
-    Gear^.X := Gear^.X + cAirPlaneSpeed * Gear^.Tag;
-
-    if (Gear^.Health > 0) and (not (Gear^.X < Gear^.dX)) and (Gear^.X < Gear^.dX + cAirPlaneSpeed) then
-        begin
-        dec(Gear^.Health);
-            case Gear^.State of
-                0: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
-                1: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, cBombsSpeed * Gear^.Tag, _0, 0);
-                2: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtNapalmBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
-                3: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtDrill, gsttmpFlag, cBombsSpeed * Gear^.Tag, _0, Gear^.Timer + 1);
-            //4: FollowGear := AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtWaterMelon, 0, cBombsSpeed *
-            //                 Gear^.Tag, _0, 5000);
-            end;
-        Gear^.dX := Gear^.dX + int2hwFloat(30 * Gear^.Tag);
-        StopSoundChan(Gear^.SoundChannel, 4000);
-        end;
-
-    if (GameTicks and $3F) = 0 then
-        AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
-
-    if (hwRound(Gear^.X) > (max(LAND_WIDTH,4096)+2048)) or (hwRound(Gear^.X) < -2048) then
-        begin
-        // avoid to play forever (is this necessary?)
-        StopSoundChan(Gear^.SoundChannel);
-        DeleteGear(Gear)
-        end;
-end;
-
-procedure doStepAirAttack(Gear: PGear);
-begin
-    AllInactive := false;
-
-    if Gear^.X.QWordValue = 0 then
-        begin
-        Gear^.Tag :=  1;
-        Gear^.X := -_2048;
-        end
-    else
-        begin
-        Gear^.Tag := -1;
-        Gear^.X := int2hwFloat(max(LAND_WIDTH,4096) + 2048);
-        end;
-
-    Gear^.Y := int2hwFloat(topY-300);
-    Gear^.dX := int2hwFloat(Gear^.Target.X - 5 * Gear^.Tag * 15);
-
-    // calcs for Napalm Strike, so that it will hit the target (without wind at least :P)
-    if (Gear^.State = 2) then
-        Gear^.dX := Gear^.dX - cBombsSpeed * Gear^.Tag * 900
-    // calcs for regular falling gears
-    else if (int2hwFloat(Gear^.Target.Y) - Gear^.Y > _0) then
-            Gear^.dX := Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(Gear^.Target.Y) - Gear^.Y) * 2 /
-                cGravity) * Gear^.Tag;
-
-    Gear^.Health := 6;
-    Gear^.doStep := @doStepAirAttackWork;
-    Gear^.SoundChannel := LoopSound(sndPlane, 4000);
-
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-
-procedure doStepAirBomb(Gear: PGear);
-begin
-    AllInactive := false;
-    doStepFallingGear(Gear);
-    if (Gear^.State and gstCollision) <> 0 then
-        begin
-        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, Gear^.Hedgehog, EXPLAutoSound);
-        DeleteGear(Gear);
-        {$IFNDEF PAS2C}
-        with mobileRecord do
-            if (performRumble <> nil) and (not fastUntilLag) then
-                performRumble(kSystemSoundID_Vibrate);
-        {$ENDIF}
-        exit
-        end;
-    if (GameTicks and $3F) = 0 then
-        AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace)
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-
-procedure doStepGirder(Gear: PGear);
-var
-    HHGear: PGear;
-    x, y, tx, ty: hwFloat;
-begin
-    AllInactive := false;
-
-    HHGear := Gear^.Hedgehog^.Gear;
-    tx := int2hwFloat(Gear^.Target.X);
-    ty := int2hwFloat(Gear^.Target.Y);
-    x := HHGear^.X;
-    y := HHGear^.Y;
-
-    if (Distance(tx - x, ty - y) > _256)
-    or (not (TryPlaceOnLand(Gear^.Target.X - SpritesData[sprAmGirder].Width div 2, Gear^.Target.Y - SpritesData[sprAmGirder].Height div 2, sprAmGirder, Gear^.State, true, false))) then
-        begin
-        PlaySound(sndDenied);
-        HHGear^.Message := HHGear^.Message and (not gmAttack);
-        HHGear^.State := HHGear^.State and (not gstAttacking);
-        HHGear^.State := HHGear^.State or gstHHChooseTarget;
-        isCursorVisible := true;
-        DeleteGear(Gear)
-        end
-    else
-        begin
-        PlaySound(sndPlaced);
-        DeleteGear(Gear);
-        AfterAttack;
-        end;
-
-    HHGear^.State := HHGear^.State and (not (gstAttacking or gstAttacked));
-    HHGear^.Message := HHGear^.Message and (not gmAttack);
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepTeleportAfter(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    HHGear := Gear^.Hedgehog^.Gear;
-    doStepHedgehogMoving(HHGear);
-    // if not infattack mode wait for hedgehog finish falling to collect cases
-    if ((GameFlags and gfInfAttack) <> 0)
-    or ((HHGear^.State and gstMoving) = 0)
-    or (Gear^.Hedgehog^.Gear^.Damage > 0)
-    or ((HHGear^.State and gstDrowning) = 1) then
-        begin
-        DeleteGear(Gear);
-        AfterAttack
-        end
-end;
-
-procedure doStepTeleportAnim(Gear: PGear);
-begin
-    if (Gear^.Hedgehog^.Gear^.Damage > 0) then
-        begin
-        DeleteGear(Gear);
-        AfterAttack;
-        end;
-    inc(Gear^.Timer);
-    if Gear^.Timer = 65 then
-        begin
-        Gear^.Timer := 0;
-        inc(Gear^.Pos);
-        if Gear^.Pos = 11 then
-            Gear^.doStep := @doStepTeleportAfter
-        end;
-end;
-
-procedure doStepTeleport(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    AllInactive := false;
-
-    HHGear := Gear^.Hedgehog^.Gear;
-    if (not (TryPlaceOnLand(Gear^.Target.X - SpritesData[sprHHTelepMask].Width div 2,
-        Gear^.Target.Y - SpritesData[sprHHTelepMask].Height div 2,
-        sprHHTelepMask, 0, false, false))) then
-        begin
-        HHGear^.Message := HHGear^.Message and (not gmAttack);
-        HHGear^.State := HHGear^.State and (not gstAttacking);
-        HHGear^.State := HHGear^.State or gstHHChooseTarget;
-        DeleteGear(Gear);
-        isCursorVisible := true;
-        PlaySound(sndDenied)
-        end
-    else
-        begin
-        DeleteCI(HHGear);
-        SetAllHHToActive(true);
-        Gear^.doStep := @doStepTeleportAnim;
-
-  // copy old HH position and direction to Gear (because we need them for drawing the vanishing hog)
-        Gear^.dX := HHGear^.dX;
-        // retrieve the cursor direction (it was previously copied to X so it doesn't get lost)
-        HHGear^.dX.isNegative := (Gear^.X.QWordValue <> 0);
-        Gear^.X := HHGear^.X;
-        Gear^.Y := HHGear^.Y;
-        HHGear^.X := int2hwFloat(Gear^.Target.X);
-        HHGear^.Y := int2hwFloat(Gear^.Target.Y);
-        HHGear^.State := HHGear^.State or gstMoving;
-        Gear^.Hedgehog^.Unplaced := false;
-        isCursorVisible := false;
-        playSound(sndWarp)
-        end;
-    Gear^.Target.X:= NoPointX
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepSwitcherWork(Gear: PGear);
-var
-    HHGear: PGear;
-    hedgehog: PHedgehog;
-    State: Longword;
-begin
-    AllInactive := false;
-
-    if ((Gear^.Message and (not gmSwitch)) <> 0) or (TurnTimeLeft = 0) then
-        begin
-        hedgehog := Gear^.Hedgehog;
-        //Msg := Gear^.Message and (not gmSwitch);
-        DeleteGear(Gear);
-        ApplyAmmoChanges(hedgehog^);
-
-        HHGear := CurrentHedgehog^.Gear;
-        ApplyAmmoChanges(HHGear^.Hedgehog^);
-        //HHGear^.Message := Msg;
-        exit
-        end;
-
-    if (Gear^.Message and gmSwitch) <> 0 then
-        begin
-        HHGear := CurrentHedgehog^.Gear;
-        HHGear^.Message := HHGear^.Message and (not gmSwitch);
-        Gear^.Message := Gear^.Message and (not gmSwitch);
-        State := HHGear^.State;
-        HHGear^.State := 0;
-        HHGear^.Z := cHHZ;
-        HHGear^.Active := false;
-        HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList;
-
-        PlaySound(sndSwitchHog);
-
-        repeat
-            CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber);
-        until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and
-              (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0) and
-              (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen]=0);
-
-        SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
-        AmmoMenuInvalidated:= true;
-
-        HHGear := CurrentHedgehog^.Gear;
-        HHGear^.State := State;
-        HHGear^.Active := true;
-        FollowGear := HHGear;
-        HHGear^.Z := cCurrHHZ;
-        HHGear^.Message:= HHGear^.Message or gmRemoveFromList or gmAddToList;
-        Gear^.X := HHGear^.X;
-        Gear^.Y := HHGear^.Y
-        end;
-end;
-
-procedure doStepSwitcher(Gear: PGear);
-var
-    HHGear: PGear;
-begin
-    Gear^.doStep := @doStepSwitcherWork;
-
-    HHGear := Gear^.Hedgehog^.Gear;
-    OnUsedAmmo(HHGear^.Hedgehog^);
-    with HHGear^ do
-        begin
-        State := State and (not gstAttacking);
-        Message := Message and (not gmAttack)
-        end
-end;
-
-////////////////////////////////////////////////////////////////////////////////
-procedure doStepMortar(Gear: PGear);
-var
-    dX, dY, gdX, gdY: hwFloat;
-    i: LongInt;
-begin
-    AllInactive := false;
-    gdX := Gear^.dX;
-    gdY := Gear^.dY;