merge
authorStepan777 <stepik-777@mail.ru>
Sun, 24 Jun 2012 20:31:26 +0400
changeset 7278 000e4543f204
parent 7238 313b2ecc4441 (current diff)
parent 7276 e570bc0df33c (diff)
child 7280 fd707afbc3a2
merge
QTfrontend/CMakeLists.txt
QTfrontend/game.cpp
QTfrontend/main.cpp
hedgewars/CMakeLists.txt
hedgewars/SDLh.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uTeams.pas
hedgewars/uTypes.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Scripts/plist/Balanced Random Weapon.plist
share/hedgewars/Data/Scripts/plist/Capture the Flag.plist
share/hedgewars/Data/Scripts/plist/Highlander.plist
share/hedgewars/Data/Scripts/plist/No Jumping.plist
share/hedgewars/Data/Scripts/plist/Normal.plist
share/hedgewars/Data/Scripts/plist/Racer.plist
share/hedgewars/Data/Scripts/plist/Random Weapon.plist
share/hedgewars/Data/Scripts/plist/Space Invasion.plist
share/hedgewars/Data/Scripts/plist/The Specialists.plist
share/hedgewars/Data/Scripts/plist/Tumbler.plist
--- a/CMakeLists.txt	Tue Jun 12 17:20:27 2012 +0400
+++ b/CMakeLists.txt	Sun Jun 24 20:31:26 2012 +0400
@@ -52,17 +52,19 @@
 ENDIF(NOT BUILD_ENGINE_LIBRARY)
 set(target_dir "bin")
 
-
 #bundle .app setup
-if(APPLE)
-    set(CMAKE_FIND_FRAMEWORK "FIRST")
-
+if(APPLE OR CROSSAPPLE)
     #paths for creating the bundle
     set(bundle_name Hedgewars.app)
     set(frameworks_dir ${bundle_name}/Contents/Frameworks/)
     set(CMAKE_INSTALL_PREFIX ${bundle_name}/Contents/MacOS/)
     set(DATA_INSTALL_DIR "../Resources/")
     set(target_dir ".")
+    set(minimum_macosx_version "10.6")
+endif()
+
+if(APPLE)
+    set(CMAKE_FIND_FRAMEWORK "FIRST")
 
     #what system are we building for
     set(minimum_macosx_version $ENV{MACOSX_DEPLOYMENT_TARGET})
@@ -200,13 +202,17 @@
 endif()
 
 find_package(Lua)
-if(${LUA_FOUND})
+if(LUA_FOUND)
     message(STATUS "Lua library is present on your system (${LUA_DEFAULT})")
 else()
     message(STATUS "Lua library not found, building bundled dependency")
     add_subdirectory(misc/liblua)
     #linking with liblua.a requires system readline -- this works everywhere, right?
-    set(pascal_flags "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_flags})
+    if(WIN32)
+        set(pascal_flags "-k${CMAKE_BINARY_DIR}/bin/liblua.dll.a" "-k-lreadline" ${pascal_flags})
+    else()
+        set(pascal_flags "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_flags})
+    endif()
 endif()
 
 add_subdirectory(hedgewars)
--- a/QTfrontend/CMakeLists.txt	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/CMakeLists.txt	Sun Jun 24 20:31:26 2012 +0400
@@ -11,7 +11,9 @@
 set(QT_USE_QTMAIN TRUE)
 
 find_package(Qt4 REQUIRED)
-include(${QT_USE_FILE})
+if (NOT CROSSAPPLE)
+    include(${QT_USE_FILE})
+endif()
 
 # Check if we need zlib
 check_library_exists("${QT_QTCORE_LIBRARY}" inflateInit2_ ${QT_LIBRARY_DIR} QT_PROVIDES_ZLIB_FUNCTIONS)
@@ -140,7 +142,7 @@
 qt4_wrap_cpp(hwfr_moc_srcs ${hwfr_moc_hdrs})
 
 
-if(APPLE)
+if(APPLE OR CROSSAPPLE)
     set(hwfr_src ${hwfr_src} InstallController.cpp CocoaInitializer.mm M3Panel.mm M3InstallController.m NSWorkspace_RBAdditions.m)
     set(HW_LINK_LIBS IOKit ${HW_LINK_LIBS})
 
@@ -192,7 +194,11 @@
 endif()
 
 
-target_link_libraries(hedgewars ${HW_LINK_LIBS})
+if (CROSSAPPLE)
+    add_dependencies(hedgewars quazip)
+else()
+    target_link_libraries(hedgewars ${HW_LINK_LIBS})
+endif()
 
 
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hedgewars${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
--- a/QTfrontend/game.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/game.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -21,6 +21,7 @@
 #include <QUuid>
 #include <QColor>
 #include <QStringListModel>
+#include <QTextStream>
 
 #include "game.h"
 #include "hwconsts.h"
@@ -29,8 +30,7 @@
 #include "teamselect.h"
 #include "KB.h"
 #include "proto.h"
-
-#include <QTextStream>
+#include "ThemeModel.h"
 
 QString training, campaign; // TODO: Cleaner solution?
 
--- a/QTfrontend/hwconsts.cpp.in	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/hwconsts.cpp.in	Sun Jun 24 20:31:26 2012 +0400
@@ -72,19 +72,3 @@
 
 int season = SEASON_NONE;
 int years_since_foundation = 0;
-
-QStandardItemModel * colorsModel;
-
-void hwConstsInit()
-{
-    colorsModel = new QStandardItemModel();
-
-    int i = 0;
-    while(colors[i])
-    {
-        QStandardItem * item = new QStandardItem();
-        item->setData(QColor(colors[i]));
-        colorsModel->appendRow(item);
-        ++i;
-    }
-}
--- a/QTfrontend/hwconsts.h	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/hwconsts.h	Sun Jun 24 20:31:26 2012 +0400
@@ -44,8 +44,7 @@
 extern int cAmmoNumber;
 extern QList< QPair<QString, QString> > cDefaultAmmos;
 
-//extern unsigned int colors[];
-extern QStandardItemModel * colorsModel;
+extern unsigned int colors[];
 
 extern QString * netHost;
 extern quint16 netPort;
@@ -60,8 +59,6 @@
 //Could be used to implement a text/graphic like "This is the xxth birthday of hedgewars" or similar
 extern int years_since_foundation;
 
-void hwConstsInit();
-
 #endif
 
 #define HEDGEHOGS_PER_TEAM           8
--- a/QTfrontend/main.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/main.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -104,8 +104,6 @@
 {
     HWApplication app(argc, argv);
 
-    hwConstsInit();
-
     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
 
     QStringList arguments = app.arguments();
--- a/QTfrontend/model/GameStyleModel.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/model/GameStyleModel.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -21,6 +21,8 @@
  * @brief GameStyleModel class implementation
  */
 
+#include <QTextStream>
+
 #include "GameStyleModel.h"
 
 
--- a/QTfrontend/model/roomslistmodel.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/model/roomslistmodel.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -21,12 +21,13 @@
  * @brief RoomsListModel class implementation
  */
 
-#include "roomslistmodel.h"
-
 #include <QBrush>
 #include <QColor>
 #include <QIcon>
 
+#include "roomslistmodel.h"
+#include "MapModel.h"
+
 RoomsListModel::RoomsListModel(QObject *parent) :
     QAbstractTableModel(parent),
     c_nColumns(8)
--- a/QTfrontend/team.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/team.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -26,6 +26,7 @@
 
 #include "team.h"
 #include "hwform.h"
+#include "DataManager.h"
 
 HWTeam::HWTeam(const QString & teamname) :
     QObject(0)
@@ -150,9 +151,9 @@
         m_fort = other.m_fort;
         m_flag = other.m_flag;
         m_voicepack = other.m_voicepack;
-//        m_hedgehogs = other.m_hedgehogs;
+        m_hedgehogs = other.m_hedgehogs;
         m_difficulty = other.m_difficulty;
-//        m_binds = other.m_binds;
+        m_binds = other.m_binds;
         m_numHedgehogs = other.m_numHedgehogs;
         m_color = other.m_color;
         m_isNetTeam = other.m_isNetTeam;
@@ -351,12 +352,12 @@
 
 QColor HWTeam::qcolor() const
 {
-    return colorsModel->item(m_color)->data().value<QColor>();
+    return DataManager::instance().colorsModel()->item(m_color)->data().value<QColor>();
 }
 
 void HWTeam::setColor(int color)
 {
-    m_color = color % colorsModel->rowCount();
+    m_color = color % DataManager::instance().colorsModel()->rowCount();
 }
 
 
--- a/QTfrontend/ui/page/pageeditteam.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -26,12 +26,13 @@
 #include <QGroupBox>
 #include <QToolBox>
 #include <QMessageBox>
-
-#include "sdlkeys.h"
+#include <QStandardItemModel>
+#include <QDebug>
 #include "SquareLabel.h"
 #include "HWApplication.h"
 
 #include "DataManager.h"
+#include "HatModel.h"
 
 #include "pageeditteam.h"
 
@@ -196,9 +197,9 @@
         l->setText(HWApplication::translate("binds", cbinds[i].name));
         l->setAlignment(Qt::AlignRight);
         pagelayout->addWidget(l, num, 0);
+
         CBBind[i] = new QComboBox(curW);
-        for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
-            CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]);
+        CBBind[i]->setModel(DataManager::instance().bindsModel());
         pagelayout->addWidget(CBBind[i++], num++, 1);
     }
 
@@ -422,9 +423,15 @@
     CBFort->setCurrentIndex(CBFort->findText(team.fort()));
     CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack()));
 
+    QStandardItemModel * binds = DataManager::instance().bindsModel();
     for(int i = 0; i < BINDS_NUMBER; i++)
     {
-        CBBind[i]->setCurrentIndex(CBBind[i]->findData(team.keyBind(i)));
+        QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, team.keyBind(i), 1, Qt::MatchExactly);
+
+        if(mdl.size() == 1)
+            CBBind[i]->setCurrentIndex(mdl[0].row());
+        else
+            qDebug() << "Binds: cannot find" << team.keyBind(i);
     }
 }
 
@@ -450,9 +457,10 @@
     team.setVoicepack(CBVoicepack->currentText());
     team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString());
 
+    QStandardItemModel * binds = DataManager::instance().bindsModel();
     for(int i = 0; i < BINDS_NUMBER; i++)
     {
-        team.bindKey(i,CBBind[i]->itemData(CBBind[i]->currentIndex()).toString());
+        team.bindKey(i, binds->index(CBBind[i]->currentIndex(), 0).data(Qt::UserRole + 1).toString());
     }
 
     return team;
--- a/QTfrontend/ui/widget/frameTeam.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/ui/widget/frameTeam.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -25,6 +25,7 @@
 #include "frameTeam.h"
 #include "teamselhelper.h"
 #include "hwconsts.h"
+#include "DataManager.h"
 
 FrameTeams::FrameTeams(QWidget* parent) :
     QFrame(parent), maxHedgehogsPerGame(48), overallHedgehogs(0), mainLayout(this), nonInteractive(false)
@@ -54,12 +55,12 @@
 
 void FrameTeams::resetColors()
 {
-    currentColor = colorsModel->rowCount() - 1; // ensure next color is the first one
+    currentColor = DataManager::instance().colorsModel()->rowCount() - 1; // ensure next color is the first one
 }
 
 int FrameTeams::getNextColor()
 {
-    currentColor = (currentColor + 1) % colorsModel->rowCount();
+    currentColor = (currentColor + 1) % DataManager::instance().colorsModel()->rowCount();
     return currentColor;
 }
 
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -32,6 +32,7 @@
 #include "hwconsts.h"
 #include "ammoSchemeModel.h"
 #include "proto.h"
+#include "GameStyleModel.h"
 
 GameCFGWidget::GameCFGWidget(QWidget* parent) :
     QGroupBox(parent)
--- a/QTfrontend/ui/widget/mapContainer.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -36,6 +36,7 @@
 #include "mapContainer.h"
 #include "igbox.h"
 #include "HWApplication.h"
+#include "ThemeModel.h"
 
 HWMapContainer::HWMapContainer(QWidget * parent) :
     QWidget(parent),
--- a/QTfrontend/ui/widget/mapContainer.h	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/ui/widget/mapContainer.h	Sun Jun 24 20:31:26 2012 +0400
@@ -31,6 +31,7 @@
 
 #include "hwmap.h"
 #include "drawmapscene.h"
+#include "MapModel.h"
 
 class QPushButton;
 class IconedGroupBox;
--- a/QTfrontend/ui/widget/teamselhelper.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/ui/widget/teamselhelper.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -28,6 +28,7 @@
 #include "hwconsts.h"
 #include "frameTeam.h"
 #include "colorwidget.h"
+#include "DataManager.h"
 
 void TeamLabel::teamButtonClicked()
 {
@@ -69,7 +70,7 @@
     if(m_isPlaying)
     {
         // team color
-        colorWidget = new ColorWidget(colorsModel, this);
+        colorWidget = new ColorWidget(DataManager::instance().colorsModel(), this);
         colorWidget->setMinimumWidth(26);
         colorWidget->setMaximumWidth(26);
         colorWidget->setMinimumHeight(26);
--- a/QTfrontend/util/DataManager.cpp	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/util/DataManager.cpp	Sun Jun 24 20:31:26 2012 +0400
@@ -23,13 +23,19 @@
 
 #include <QMap>
 #include <QStringList>
-
+#include <QStandardItemModel>
 #include <QFileInfo>
 
 #include "hwconsts.h"
+#include "HWApplication.h"
+#include "sdlkeys.h"
 
 #include "DataManager.h"
 
+#include "GameStyleModel.h"
+#include "HatModel.h"
+#include "MapModel.h"
+#include "ThemeModel.h"
 
 DataManager::DataManager()
 {
@@ -42,6 +48,8 @@
     m_hatModel = NULL;
     m_mapModel = NULL;
     m_themeModel = NULL;
+    m_colorsModel = NULL;
+    m_bindsModel = NULL;
 }
 
 
@@ -154,6 +162,43 @@
     return m_themeModel;
 }
 
+QStandardItemModel * DataManager::colorsModel()
+{
+    if(m_colorsModel == NULL)
+    {
+        m_colorsModel = new QStandardItemModel();
+
+        int i = 0;
+        while(colors[i])
+        {
+            QStandardItem * item = new QStandardItem();
+            item->setData(QColor(colors[i]));
+            m_colorsModel->appendRow(item);
+            ++i;
+        }
+    }
+
+    return m_colorsModel;
+}
+
+QStandardItemModel * DataManager::bindsModel()
+{
+    if(m_bindsModel == NULL)
+    {
+        m_bindsModel = new QStandardItemModel();
+
+        for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
+        {
+            QStandardItem * item = new QStandardItem();
+            item->setData(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), Qt::DisplayRole);
+            item->setData(sdlkeys[j][0], Qt::UserRole + 1);
+            m_bindsModel->appendRow(item);
+        }
+    }
+
+    return m_bindsModel;
+}
+
 void DataManager::reload()
 {
     m_gameStyleModel->loadGameStyles();
--- a/QTfrontend/util/DataManager.h	Tue Jun 12 17:20:27 2012 +0400
+++ b/QTfrontend/util/DataManager.h	Sun Jun 24 20:31:26 2012 +0400
@@ -26,21 +26,13 @@
 
 #include <QDir>
 #include <QFile>
-
 #include <QStringList>
 
-#include "GameStyleModel.h"
-#include "HatModel.h"
-#include "MapModel.h"
-#include "ThemeModel.h"
-
-class QDir;
-class QFile;
-class QStringList;
 class GameStyleModel;
 class HatModel;
 class MapModel;
 class ThemeModel;
+class QStandardItemModel;
 
 /**
  * @brief Offers access to the data files of hedgewars.
@@ -135,6 +127,9 @@
          */
         ThemeModel * themeModel();
 
+        QStandardItemModel * colorsModel();
+        QStandardItemModel * bindsModel();
+
     public slots:
         /// Reloads data from storage.
         void reload();
@@ -163,6 +158,8 @@
         HatModel * m_hatModel; ///< hat model instance
         MapModel * m_mapModel; ///< map model instance
         ThemeModel * m_themeModel; ///< theme model instance
+        QStandardItemModel * m_colorsModel;
+        QStandardItemModel * m_bindsModel;
 };
 
 #endif // HEDGEWARS_DATAMANAGER_H
--- a/cmake_modules/FindLua.cmake	Tue Jun 12 17:20:27 2012 +0400
+++ b/cmake_modules/FindLua.cmake	Sun Jun 24 20:31:26 2012 +0400
@@ -20,8 +20,8 @@
             FIND_LIBRARY(LUA_DEFAULT NAMES lua51 lua5.1 lua-5.1 lua PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib)
             IF(${LUA_DEFAULT} MATCHES "LUA_DEFAULT-NOTFOUND")
 	        set(LUA_DEFAULT lua)
+            ELSE()
                 set(LUA_FOUND true)
-            ELSE()
                 message(STATUS "LibLua 5.1 found at ${LUA_DEFAULT}")
                 #remove the path (fpc doesn't like it - why?)
                 GET_FILENAME_COMPONENT(LUA_DEFAULT ${LUA_DEFAULT} NAME)
--- a/gameServer/ClientIO.hs	Tue Jun 12 17:20:27 2012 +0400
+++ b/gameServer/ClientIO.hs	Sun Jun 24 20:31:26 2012 +0400
@@ -48,6 +48,7 @@
         listenLoop s chan ci >> return "Connection closed")
         `Exception.catch` (\(e :: Exception.IOException) -> return . B.pack . show $ e)
         `Exception.catch` (\(e :: ShutdownThreadException) -> return . B.pack . show $ e)
+        `Exception.catch` (\(e :: Exception.SomeException) -> return . B.pack . show $ e)
         >>= clientOff >> remove
     where
         clientOff msg = writeChan chan $ ClientMessage (ci, ["QUIT", msg])
--- a/gameServer/HWProtoInRoomState.hs	Tue Jun 12 17:20:27 2012 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Sun Jun 24 20:31:26 2012 +0400
@@ -158,8 +158,8 @@
     cl <- thisClient
     chans <- roomClientsChans
     return [
+        ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
         ModifyClient (\c -> c{isReady = not $ isReady cl}),
-        ModifyRoom (\r -> r{readyPlayers = readyPlayers r + (if isReady cl then -1 else 1)}),
         AnswerClients chans $ if clientProto cl < 38 then
                 [if isReady cl then "NOT_READY" else "READY", nick cl]
                 else
--- a/hedgewars/CMakeLists.txt	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/CMakeLists.txt	Sun Jun 24 20:31:26 2012 +0400
@@ -227,7 +227,7 @@
 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
 
 #when system Lua is not found we need to compile it before engine
-if(NOT ${LUA_FOUND})
+if(NOT LUA_FOUND)
     add_dependencies(${engine_output_name} lua)
 endif()
 
--- a/hedgewars/GSHandlers.inc	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/GSHandlers.inc	Sun Jun 24 20:31:26 2012 +0400
@@ -2114,18 +2114,32 @@
         end
     else
         begin 
-        if Gear^.Timer = 0 then
-        begin
+        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. *)
-        sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
-        if sparkles <> nil then
+            // Abuse a couple of gear values to track origin
+            Gear^.Angle:= hwRound(Gear^.X);
+            Gear^.Power:= 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^.Tint:= $FAB22CFF
-            end
-        end;
-        if (GameTicks and $1 = 0) and (Gear^.Timer < 255) then inc(Gear^.Timer)
+            sparkles:= AddVisualGear(Gear^.Angle, Gear^.Power, 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 exit;
         end;
 
     if (Gear^.Damage > 0) or exBoom then
@@ -2768,7 +2782,7 @@
             CurrentTeam^.CurrHedgehog := Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber);
         until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear^.Damage = 0);
 
-        CurrentHedgehog := @CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog];
+        SwitchCurrentHedgehog(@CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
         AmmoMenuInvalidated:= true; 
 
         HHGear := CurrentHedgehog^.Gear;
@@ -3087,7 +3101,7 @@
         begin
         Gear^.Tag := 0;
         Gear^.X := Gear^.X + int2hwFloat(xx);
-        if not TestCollisionY(Gear, yyn) then
+        if TestCollisionYwithGear(Gear, yyn) = 0 then
             begin
             Gear^.Y := Gear^.Y + int2hwFloat(yyn);
             NextAngle(Gear, dA)
@@ -3165,8 +3179,7 @@
 
     HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and (not gmAttack);
-    DeleteCI(HHGear);
-    Gear^.IntersectGear:= nil;
+    Gear^.CollisionMask:= $FF7F;
 
     FollowGear := Gear;
 
@@ -4026,12 +4039,12 @@
         gear^.RenderTimer := true;
 
     // abort if there is no other portal connected to this one
-    if (Gear^.IntersectGear = nil) then
+    if (Gear^.LinkedGear = nil) then
         exit;
-    if ((Gear^.IntersectGear^.Tag and 1) = 0) then // or if it's still moving;
+    if ((Gear^.LinkedGear^.Tag and 1) = 0) then // or if it's still moving;
         exit;
 
-    conPortal := Gear^.IntersectGear;
+    conPortal := Gear^.LinkedGear;
 
     // check all gears for stuff to port through
     iterator := nil;
@@ -4414,8 +4427,8 @@
         if not Gear^.dX.isNegative then
             Gear^.DirAngle := 180-Gear^.DirAngle;
 
-        if ((Gear^.IntersectGear = nil)
-        or (hwRound(Distance(Gear^.X - Gear^.IntersectGear^.X,Gear^.Y-Gear^.IntersectGear^.Y)) >=Gear^.Radius*2)) then
+        if ((Gear^.LinkedGear = nil)
+        or (hwRound(Distance(Gear^.X - Gear^.LinkedGear^.X,Gear^.Y-Gear^.LinkedGear^.Y)) >=Gear^.Radius*2)) then
             begin
             loadNewPortalBall(Gear, false);
             inc(Gear^.Tag);
@@ -4457,7 +4470,7 @@
     newPortal^.dX := newPortal^.dX * s;
     newPortal^.dY := newPortal^.dY * s;
 
-    newPortal^.IntersectGear := nil;
+    newPortal^.LinkedGear := nil;
 
     if CurrentHedgehog <> nil then
         with CurrentHedgehog^ do
@@ -4486,8 +4499,8 @@
                         else
                             begin
                             // link portals with each other
-                            newPortal^.IntersectGear := iterator;
-                            iterator^.IntersectGear := newPortal;
+                            newPortal^.LinkedGear := iterator;
+                            iterator^.LinkedGear := newPortal;
                             iterator^.Health := newPortal^.Health;
                             end;
                         end;
@@ -4940,7 +4953,7 @@
                 ApplyDamage(tmp, CurrentHedgehog, tmp^.Health div 3, dsUnknown);
             //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3);
             tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0);
-            tmp2^.IntersectGear:= tmp;
+            tmp2^.LinkedGear:= tmp;
             SetAllToActive
             end
         else
@@ -4959,7 +4972,7 @@
     HitGear: PGear;
 begin
     AllInactive := false;
-    HitGear := Gear^.IntersectGear;
+    HitGear := Gear^.LinkedGear;
     dec(Gear^.Timer);
     if (HitGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then
         begin
--- a/hedgewars/SDLh.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/SDLh.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -986,9 +986,6 @@
 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName;
 {$ENDIF}
 
-{$IFDEF ANDROID}
-function Android_JNI_getDensity(): Single; cdecl; external SDLLibName;
-{$ENDIF}
 
 {* Compatibility between SDL-1.2 and SDL-1.3 *}
 procedure SDL_WarpMouse(x, y: Word); {$IFDEF SDL13}inline{$ELSE}cdecl; external SDLLibName{$ENDIF};
--- a/hedgewars/uAI.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uAI.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -284,9 +284,15 @@
                             AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0);
                         end;
             if (BotLevel < 3) and (GoInfo.JumpType = jmpLJump) then // ljump support
+                begin
+                // push current position so we proceed from it after checking jump opportunities
+                if CanGo then Push(ticks, Actions, Me^, Me^.Message);
+                // first check where we go after jump
                 if Push(ticks, Actions, AltMe, Me^.Message) then
                     with Stack.States[Pred(Stack.Count)] do
                         AddAction(MadeActions, aia_LJump, 0, 305 + random(50), 0, 0);
+                break
+                end;
 
             // 'not CanGO' means we can't go straight, possible jumps are checked above
             if not CanGo then
--- a/hedgewars/uAIAmmoTests.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uAIAmmoTests.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -161,7 +161,8 @@
             dX:= dX + windSpeed;
             dY:= dY + cGravityf;
             dec(t)
-        until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
+        until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
+               ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t <= 0);
         
         EX:= trunc(x);
         EY:= trunc(y);
@@ -219,7 +220,8 @@
             dX:= dX + windSpeed;
             dY:= dY + cGravityf;
             dec(t)
-        until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t <= 0);
+        until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
+               ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t <= 0);
         EX:= trunc(x);
         EY:= trunc(y);
 
@@ -269,7 +271,8 @@
             y:= y + dY;
             dY:= dY + cGravityf;
             dec(t)
-        until TestCollExcludingMe(Me, trunc(x), trunc(y), 7) or (t = 0);
+        until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 6)) or 
+               ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 6))) or (t = 0);
         EX:= trunc(x);
         EY:= trunc(y);
         if t < 50 then
@@ -321,7 +324,8 @@
             y:= y + dY;
             dY:= dY + cGravityf;
             dec(t)
-        until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t = 0);
+        until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
+               ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t = 0);
     EX:= trunc(x);
     EY:= trunc(y);
     if t < 50 then 
@@ -380,7 +384,8 @@
         y:= y + dY;
         dY:= dY + cGravityf;
         dec(t)
-    until TestCollExcludingMe(Me, trunc(x), trunc(y), 5) or (t = 0);
+    until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 5)) or 
+           ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 5))) or (t = 0);
     EX:= trunc(x);
     EY:= trunc(y);
     if t < 50 then 
@@ -432,7 +437,8 @@
             y:= y + dY;
             dY:= dY + cGravityf;
             dec(t)
-        until TestCollExcludingMe(Me, trunc(x), trunc(y), 7) or (t = 0);
+       until (((Me = CurrentHedgehog^.Gear) and TestColl(trunc(x), trunc(y), 6)) or 
+               ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, trunc(x), trunc(y), 6))) or (t = 0);
         
         EX:= trunc(x);
         EY:= trunc(y);
@@ -511,7 +517,8 @@
         dY:= dY + cGravityf;
         EX:= trunc(x);
         EY:= trunc(y);
-    until TestCollExcludingMe(Me, EX, EY, 5) or (EY > cWaterLine);
+    until (((Me = CurrentHedgehog^.Gear) and TestColl(EX, EY, 4)) or 
+           ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, EX, EY, 4))) or (EY > cWaterLine);
 
     if (EY < cWaterLine) and (dY >= 0) then
         begin
@@ -564,7 +571,8 @@
     y:= y + vY;
     rx:= trunc(x);
     ry:= trunc(y);
-    if TestCollExcludingMe(Me, rx, ry, 2) then
+    if ((Me = CurrentHedgehog^.Gear) and TestColl(rx, ry, 2)) or 
+        ((Me <> CurrentHedgehog^.Gear) and TestCollExcludingMe(Me, rx, ry, 2)) then
     begin
         x:= x + vX * 8;
         y:= y + vY * 8;
--- a/hedgewars/uAIMisc.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uAIMisc.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -262,19 +262,19 @@
 function TestColl(x, y, r: LongInt): boolean; inline;
 var b: boolean;
 begin
-    b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] <> 0);
+    b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x-r] and $FF7F <> 0);
     if b then
         exit(true);
     
-    b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] <> 0);
+    b:= (((x-r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x-r] and $FF7F <> 0);
     if b then
         exit(true);
     
-    b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] <> 0);
+    b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y-r) and LAND_HEIGHT_MASK) = 0) and (Land[y-r, x+r] and $FF7F <> 0);
     if b then
         exit(true);
     
-    b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] <> 0);
+    b:= (((x+r) and LAND_WIDTH_MASK) = 0) and (((y+r) and LAND_HEIGHT_MASK) = 0) and (Land[y+r, x+r] and $FF7F <> 0);
     if b then
         exit(true);
     
--- a/hedgewars/uCollisions.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uCollisions.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -82,7 +82,7 @@
     X:= hwRound(Gear^.X);
     Y:= hwRound(Gear^.Y);
     Radius:= Gear^.Radius;
-    ChangeRoundInLand(X, Y, Radius - 1, true);
+    ChangeRoundInLand(X, Y, Radius - 1, true, Gear = CurrentHedgehog^.Gear);
     cGear:= Gear
     end;
 Gear^.CollisionIndex:= Count;
@@ -103,7 +103,7 @@
 if Gear^.CollisionIndex >= 0 then
     begin
     with cinfos[Gear^.CollisionIndex] do
-        ChangeRoundInLand(X, Y, Radius - 1, false);
+        ChangeRoundInLand(X, Y, Radius - 1, false, Gear = CurrentHedgehog^.Gear);
     cinfos[Gear^.CollisionIndex]:= cinfos[Pred(Count)];
     cinfos[Gear^.CollisionIndex].cGear^.CollisionIndex:= Gear^.CollisionIndex;
     Gear^.CollisionIndex:= -1;
@@ -138,17 +138,11 @@
 var x, y, i: LongInt;
     TestWord: LongWord;
 begin
-if Gear^.IntersectGear <> nil then
-    with Gear^ do
-        if (hwRound(IntersectGear^.X) + IntersectGear^.Radius < hwRound(X) - Radius)
-        or (hwRound(IntersectGear^.X) - IntersectGear^.Radius > hwRound(X) + Radius) then
-            begin
-            IntersectGear:= nil;
-            TestWord:= 0
-            end
-        else
-            TestWord:= 255
-    else TestWord:= 0;
+// Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
+if (Gear^.CollisionMask = $FF7F) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
+    ((hwRound(Gear^.Hedgehog^.Gear^.X) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.X) - Gear^.Radius) or
+     (hwRound(Gear^.Hedgehog^.Gear^.X) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.X) + Gear^.Radius)) then
+    Gear^.CollisionMask:= $FFFF;
 
 x:= hwRound(Gear^.X);
 if Dir < 0 then
@@ -163,7 +157,7 @@
     i:= y + Gear^.Radius * 2 - 2;
     repeat
         if (y and LAND_HEIGHT_MASK) = 0 then
-            if Land[y, x] > TestWord then
+            if Land[y, x] and Gear^.CollisionMask <> 0 then
                 exit;
         inc(y)
     until (y > i);
@@ -175,36 +169,30 @@
 var x, y, i: LongInt;
     TestWord: LongWord;
 begin
-if Gear^.IntersectGear <> nil then
-    with Gear^ do
-        if (hwRound(IntersectGear^.Y) + IntersectGear^.Radius < hwRound(Y) - Radius) or
-            (hwRound(IntersectGear^.Y) - IntersectGear^.Radius > hwRound(Y) + Radius) then
-                begin
-                IntersectGear:= nil;
-                TestWord:= 0
-                end
-        else
-            TestWord:= 255
-else
-    TestWord:= 0;
+// Special case to emulate the old intersect gear clearing, but with a bit of slop for pixel overlap
+if (Gear^.CollisionMask = $FF7F) and (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) and
+    ((hwRound(Gear^.Hedgehog^.Gear^.Y) + Gear^.Hedgehog^.Gear^.Radius + 4 < hwRound(Gear^.Y) - Gear^.Radius) or
+     (hwRound(Gear^.Hedgehog^.Gear^.Y) - Gear^.Hedgehog^.Gear^.Radius - 4 > hwRound(Gear^.Y) + Gear^.Radius)) then
+    Gear^.CollisionMask:= $FFFF;
 
 y:= hwRound(Gear^.Y);
 if Dir < 0 then
     y:= y - Gear^.Radius
 else
     y:= y + Gear^.Radius;
+
 if (y and LAND_HEIGHT_MASK) = 0 then
     begin
     x:= hwRound(Gear^.X) - Gear^.Radius + 1;
     i:= x + Gear^.Radius * 2 - 2;
     repeat
         if (x and LAND_WIDTH_MASK) = 0 then
-            if Land[y, x] > TestWord then
-            begin
+            if Land[y, x] and Gear^.CollisionMask <> 0 then
+                begin
                 TestCollisionYwithGear:= Land[y, x];
                 exit;
-            end;
-     inc(x)
+                end;
+        inc(x)
     until (x > i);
     end;
 TestCollisionYwithGear:= 0
--- a/hedgewars/uGearsHedgehog.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -395,6 +395,7 @@
             newGear^.Target.X:= TargetPoint.X;
             newGear^.Target.Y:= TargetPoint.Y
             end;
+        if newGear <> nil then newGear^.CollisionMask:= $FF7F;
 
         // Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
         if altUse then
--- a/hedgewars/uGearsList.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uGearsList.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -100,15 +100,14 @@
 gear^.Density:= _1;
 // Define ammo association, if any.
 gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
+gear^.CollisionMask:= $FFFF;
+
+if CurrentHedgehog <> nil then gear^.Hedgehog:= CurrentHedgehog;
+
 if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
     gear^.Z:= cHHZ+1
 else gear^.Z:= cUsualZ;
 
-if CurrentHedgehog <> nil then
-    begin
-    gear^.Hedgehog:= CurrentHedgehog;
-    gear^.IntersectGear:= CurrentHedgehog^.Gear
-    end;
     
 case Kind of
      gtGrenade,
@@ -247,7 +246,7 @@
                 gear^.nImpactSounds:= 1;
                 gear^.Radius:= 16;
                 gear^.Elasticity:= _0_3;
-                gear^.Timer:= 0
+                gear^.Timer:= 500
                 end;
   gtExplosives: begin
                 gear^.ImpactSound:= sndGrenadeImpact;
@@ -483,9 +482,9 @@
 // make sure that portals have their link removed before deletion
 if (Gear^.Kind = gtPortal) then
     begin
-    if (Gear^.IntersectGear <> nil) then
-        if (Gear^.IntersectGear^.IntersectGear = Gear) then
-            Gear^.IntersectGear^.IntersectGear:= nil;
+    if (Gear^.LinkedGear <> nil) then
+        if (Gear^.LinkedGear^.LinkedGear = Gear) then
+            Gear^.LinkedGear^.LinkedGear:= nil;
     end
 else if Gear^.Kind = gtHedgehog then
     (*
--- a/hedgewars/uGearsRender.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uGearsRender.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -948,8 +948,8 @@
        gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
 
        gtPortal: if ((Gear^.Tag and 1) = 0) // still moving?
-                 or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked?
-                 or ((Gear^.IntersectGear^.Tag and 1) = 0) then // linked portal still moving?
+                 or (Gear^.LinkedGear = nil) or (Gear^.LinkedGear^.LinkedGear <> Gear) // not linked&backlinked?
+                 or ((Gear^.LinkedGear^.Tag and 1) = 0) then // linked portal still moving?
                       DrawSpriteRotatedF(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle)
                  else DrawSpriteRotatedF(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle);
 
@@ -990,30 +990,36 @@
                        else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
                        
             gtCase: begin
-                    if Gear^.Timer < 255 then Tint($FF, $FF, $FF, Gear^.Timer);
-                    if ((Gear^.Pos and posCaseAmmo) <> 0) then
-                        begin
-                        i:= (GameTicks shr 6) mod 64;
-                        if i > 18 then
-                            i:= 0;
-                        DrawSprite(sprCase, x - 24, y - 24, i);
-                        end
-                    else if ((Gear^.Pos and posCaseHealth) <> 0) then
+                    if Gear^.Timer > 1000 then
                         begin
-                        i:= ((GameTicks shr 6) + 38) mod 64;
-                        if i > 13 then
-                            i:= 0;
-                        DrawSprite(sprFAid, x - 24, y - 24, i);
-                        end
-                    else if ((Gear^.Pos and posCaseUtility) <> 0) then
+                        if ((Gear^.Pos and posCaseAmmo) <> 0) then
+                            begin
+                            i:= (GameTicks shr 6) mod 64;
+                            if i > 18 then
+                                i:= 0;
+                            DrawSprite(sprCase, x - 24, y - 24, i);
+                            end
+                        else if ((Gear^.Pos and posCaseHealth) <> 0) then
+                            begin
+                            i:= ((GameTicks shr 6) + 38) mod 64;
+                            if i > 13 then
+                                i:= 0;
+                            DrawSprite(sprFAid, x - 24, y - 24, i);
+                            end
+                        else if ((Gear^.Pos and posCaseUtility) <> 0) then
+                            begin
+                            i:= (GameTicks shr 6) mod 70;
+                            if i > 23 then
+                                i:= 0;
+                            i:= i mod 12;
+                            DrawSprite(sprUtility, x - 24, y - 24, i);
+                            end;
+                        end;
+                    if Gear^.Timer <= 1833 then
                         begin
-                        i:= (GameTicks shr 6) mod 70;
-                        if i > 23 then
-                            i:= 0;
-                        i:= i mod 12;
-                        DrawSprite(sprUtility, x - 24, y - 24, i);
-                        end;
-                    if Gear^.Timer < 255 then Tint($FF, $FF, $FF, $FF);
+                        DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
+                                            Gear^.Angle+WorldDx, Gear^.Power+WorldDy-16, 4+Gear^.Tag, 1, 32, 32, 270);
+                        end
                     end;
       gtExplosives: begin
                     if ((Gear^.State and gstDrowning) <> 0) then
--- a/hedgewars/uGearsUtils.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uGearsUtils.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -107,7 +107,7 @@
                         tdX:= Gear^.X-fX;
                         tdY:= Gear^.Y-fY;
                         if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then
-                            dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),Gear^.Radius);
+                            dmg:= dmgBase - hwRound(Distance(tdX, tdY));
                         if dmg > 1 then
                             begin
                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
--- a/hedgewars/uLandGraphics.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uLandGraphics.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -36,10 +36,11 @@
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
-procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
+procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean);
 function  LandBackPixel(x, y: LongInt): LongWord;
 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
 procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
+procedure DumpLandToLog(x, y, r: LongInt);
 
 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
 
@@ -98,46 +99,62 @@
             Land[y - dx, i]:= Value;
 end;
 
-procedure ChangeCircleLines(x, y, dx, dy: LongInt; doSet: boolean);
+procedure ChangeCircleLines(x, y, dx, dy: LongInt; doSet, isCurrent: boolean);
 var i: LongInt;
 begin
 if not doSet then
     begin
     if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-            if (Land[y + dy, i] > 0) and (Land[y + dy, i] < 256) then
-                dec(Land[y + dy, i]); // check > 0 because explosion can erase collision data
+            if isCurrent then 
+                Land[y + dy, i]:= Land[y + dy, i] and $FF7F
+            else if Land[y + dy, i] and $007F > 0 then
+                Land[y + dy, i]:= (Land[y + dy, i] and $FF80) or ((Land[y + dy, i] and $7F) - 1);
     if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-            if (Land[y - dy, i] > 0) and (Land[y - dy, i] < 256) then
-                dec(Land[y - dy, i]);
+            if isCurrent then 
+                Land[y - dy, i]:= Land[y - dy, i] and $FF7F
+            else if Land[y - dy, i] and $007F > 0 then
+                Land[y - dy, i]:= (Land[y - dy, i] and $FF80) or ((Land[y - dy, i] and $7F) - 1);
     if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-            if (Land[y + dx, i] > 0) and (Land[y + dx, i] < 256) then
-                dec(Land[y + dx, i]);
+            if isCurrent then 
+                Land[y + dx, i]:= Land[y + dx, i] and $FF7F
+            else if Land[y + dx, i] and $007F > 0 then
+                Land[y + dx, i]:= (Land[y + dx, i] and $FF80) or ((Land[y + dx, i] and $7F) - 1);
     if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-            if (Land[y - dx, i] > 0) and (Land[y - dx, i] < 256) then
-                dec(Land[y - dx, i]);
+            if isCurrent then 
+                Land[y - dx, i]:= Land[y - dx, i] and $FF7F
+            else if Land[y - dx, i] and $007F > 0 then
+                Land[y - dx, i]:= (Land[y - dx, i] and $FF80) or ((Land[y - dx, i] and $7F) - 1)
     end
 else
     begin
     if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-            if (Land[y + dy, i] < 256) then
-                inc(Land[y + dy, i]);
-    if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
-        for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-            if (Land[y - dy, i] < 256) then
-                inc(Land[y - dy, i]);
-    if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
-        for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-            if (Land[y + dx, i] < 256) then
-                inc(Land[y + dx, i]);
-    if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
-        for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-            if (Land[y - dx, i] < 256) then
-                inc(Land[y - dx, i]);
+            if isCurrent then 
+                Land[y + dy, i]:= Land[y + dy, i] or $80
+            else if Land[y + dy, i] and $007F < 127 then
+                Land[y + dy, i]:= (Land[y + dy, i] and $FF80) or ((Land[y + dy, i] and $7F) + 1);
+    if ((y - dy) and LAND_HEIGHT_MASK) = 0 then                                                   
+        for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do                                  
+            if isCurrent then                                                                     
+                Land[y - dy, i]:= Land[y - dy, i] or $80                                          
+            else if Land[y - dy, i] and $007F < 127 then                                          
+                Land[y - dy, i]:= (Land[y - dy, i] and $FF80) or ((Land[y - dy, i] and $7F) + 1);
+    if ((y + dx) and LAND_HEIGHT_MASK) = 0 then                                                   
+        for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do                                  
+            if isCurrent then                                                                     
+                Land[y + dx, i]:= Land[y + dx, i] or $80                                          
+            else if Land[y + dx, i] and $007F < 127 then                                          
+                Land[y + dx, i]:= (Land[y + dx, i] and $FF80) or ((Land[y + dx, i] and $7F) + 1);
+    if ((y - dx) and LAND_HEIGHT_MASK) = 0 then                                                   
+        for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do                                  
+            if isCurrent then                                                                     
+                Land[y - dx, i]:= Land[y - dx, i] or $80                                          
+            else if Land[y - dx, i] and $007F < 127 then                                          
+                Land[y - dx, i]:= (Land[y - dx, i] and $FF80) or ((Land[y - dx, i] and $7F) + 1)
     end
 end;
 
@@ -163,7 +180,7 @@
     FillCircleLines(x, y, dx, dy, Value);
 end;
 
-procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
+procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean);
 var dx, dy, d: LongInt;
 begin
 dx:= 0;
@@ -171,7 +188,7 @@
 d:= 3 - 2 * Radius;
 while (dx < dy) do
     begin
-    ChangeCircleLines(x, y, dx, dy, doSet);
+    ChangeCircleLines(x, y, dx, dy, doSet, isCurrent);
     if (d < 0) then
         d:= d + 4 * dx + 6
     else
@@ -182,7 +199,7 @@
     inc(dx)
     end;
 if (dx = dy) then
-    ChangeCircleLines(x, y, dx, dy, doSet)
+    ChangeCircleLines(x, y, dx, dy, doSet, isCurrent)
 end;
 
 procedure FillLandCircleLines0(x, y, dx, dy: LongInt);
@@ -1157,4 +1174,28 @@
         DrawLines(x1, y1, x2, y2, dx, dy, color);
 end;
 
+
+procedure DumpLandToLog(x, y, r: LongInt);
+var xx, yy, dx: LongInt;
+    s: shortstring;
+begin
+    s[0]:= char(r * 2 + 1);
+    for yy:= y - r to y + r do
+        begin
+        for dx:= 0 to r*2 do
+            begin
+            xx:= dx - r + x;
+            if (xx = x) and (yy = y) then
+                s[dx + 1]:= 'X'
+            else if Land[yy, xx] > 255 then
+                s[dx + 1]:= 'O'
+            else if Land[yy, xx] > 0 then
+                s[dx + 1]:= '*'
+            else
+                s[dx + 1]:= '.'
+            end;
+        AddFileLog('Land dump: ' + s);
+        end;
+end;
+
 end.
--- a/hedgewars/uMobile.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uMobile.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -28,6 +28,7 @@
 interface
 
 function  isPhone: Boolean; inline;
+function  getScreenDPI: Single; inline;
 procedure performRumble; inline;
 
 procedure GameLoading; inline;
@@ -47,6 +48,10 @@
 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
 {$ENDIF}
 
+{$IFDEF ANDROID}
+function Android_JNI_getDensity(): Single; cdecl; external;
+{$ENDIF}
+
 // this function is just to determine whether we are running on a limited screen device
 function isPhone: Boolean; inline;
 begin
@@ -61,6 +66,15 @@
 {$ENDIF}
 end;
 
+function getScreenDPI: Single; inline;
+begin
+{$IFDEF ANDROID}
+    getScreenDPI:= Android_JNI_getDensity();
+{$ELSE}
+    getScreenDPI:= 1;
+{$ENDIF}
+end;
+
 // this function should make the device vibrate in some way
 procedure PerformRumble; inline;
 {$IFDEF IPHONEOS}const kSystemSoundID_Vibrate = $00000FFF;{$ENDIF}
--- a/hedgewars/uScript.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uScript.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -973,10 +973,9 @@
             prevgear^.Z := cHHZ;
             RemoveGearFromList(prevgear);
             InsertGearToList(prevgear);
-
-            CurrentHedgehog := gear^.Hedgehog;
-// yes, this will muck up turn sequence
-            CurrentTeam := gear^.Hedgehog^.Team;
+            
+            SwitchCurrentHedgehog(gear^.Hedgehog);
+            CurrentTeam:= CurrentHedgehog^.Team;
 
             gear^.State:= gear^.State or gstHHDriven;
             gear^.Active := true;
--- a/hedgewars/uTeams.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uTeams.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -35,6 +35,7 @@
 procedure RestoreTeamsFromSave;
 function  CheckForWin: boolean;
 procedure TeamGoneEffect(var Team: TTeam);
+procedure SwitchCurrentHedgehog(newHog: PHedgehog);
 
 implementation
 uses uLocale, uAmmos, uChat, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript,
@@ -184,7 +185,7 @@
         end
 until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil);
 
-CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
+SwitchCurrentHedgehog(@(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]));
 {$IFDEF USE_TOUCH_INTERFACE}
 if (Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0 then
     begin
@@ -488,7 +489,7 @@
 with CurrentTeam^ do
     begin
     SplitBySpace(id, s);
-    CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
+    SwitchCurrentHedgehog(@Hedgehogs[HedgehogsNumber]);
     val(id, CurrentHedgehog^.BotLevel, c);
     Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
     SplitBySpace(s, id);
@@ -618,6 +619,21 @@
 RecountAllTeamsHealth();
 end;
 
+procedure SwitchCurrentHedgehog(newHog: PHedgehog);
+var oldCI, newCI: boolean;
+    oldHH: PHedgehog;
+begin
+    oldCI:= (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) and (CurrentHedgehog^.Gear^.CollisionIndex >= 0);
+    newCI:= (newHog^.Gear <> nil) and (newHog^.Gear^.CollisionIndex >= 0);
+    if oldCI then DeleteCI(CurrentHedgehog^.Gear);
+    if newCI then DeleteCI(newHog^.Gear);
+    oldHH:= CurrentHedgehog;
+    CurrentHedgehog:= newHog;
+    if oldCI then AddGearCI(oldHH^.Gear);
+    if newCI then AddGearCI(newHog^.Gear)
+end;
+
+
 procedure initModule;
 begin
 RegisterVariable('addhh', @chAddHH, false);
--- a/hedgewars/uTouch.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uTouch.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -22,7 +22,7 @@
 
 interface
 
-uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld;
+uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld, uMobile;
 
 
 procedure initModule;
@@ -557,7 +557,7 @@
     isOnCrosshair:= isOnRect((x-HalfRectSize), (y-HalfRectSize), RectSize, RectSize, finger);
     printFinger(finger);
     WriteLnToConsole(inttostr(finger.x) + '   ' + inttostr(x));
-    WriteLnToConsole(inttostr(x) + '  ' + inttostr(y) + '   ' + inttostr(round(Android_JNI_getDensity() * 10)));
+    WriteLnToConsole(inttostr(x) + '  ' + inttostr(y) + '   ' + inttostr(round(uMobile.getScreenDPI * 10)));
 end;
 
 function isOnCurrentHog(finger: TTouch_Data): boolean;
@@ -632,7 +632,6 @@
 var
     index: Longword;
     //uRenderCoordScaleX, uRenderCoordScaleY: Longword;
-    density: Single;
 begin
     buttonsDown:= 0;
 
@@ -640,13 +639,7 @@
     for index := 0 to High(fingers) do 
         fingers[index].id := nilFingerId;
 
-{$IFDEF ANDROID}
-    density:= Android_JNI_getDensity();
-{$ELSE}
-    density:= 1.0;
-{$ENDIF}
-
-    rectSize:= round(baseRectSize * density);
+    rectSize:= round(baseRectSize * uMobile.getScreenDPI);
     halfRectSize:= rectSize shl 1;
 end;
 
--- a/hedgewars/uTypes.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uTypes.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -249,7 +249,8 @@
             Tag: LongInt;
             Tex: PTexture;
             Z: Longword;
-            IntersectGear: PGear;
+            CollisionMask: Word;
+            LinkedGear: PGear;
             FlightTime: Longword;
             uid: Longword;
             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
--- a/hedgewars/uVisualGears.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uVisualGears.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -642,7 +642,7 @@
                   vgtSmoke: DrawTextureF(SpritesData[sprSmoke].Texture, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, 1, SpritesData[sprSmoke].Width, SpritesData[sprSmoke].Height);
                   vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                   vgtDust: if Gear^.State = 1 then
-                               DrawSprite(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame)
+                               DrawSpriteRotatedF(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame, 1, Gear^.Angle)
                            else
                                DrawSprite(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                   vgtFire: if (Gear^.State and gstTmpFlag) = 0 then
--- a/hedgewars/uWorld.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uWorld.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -218,11 +218,7 @@
 {$IFDEF USE_TOUCH_INTERFACE}
 
 //positioning of the buttons
-{$IFDEF ANDROID}
-buttonScale:= Android_JNI_getDensity()/cDefaultZoomLevel;
-{$ELSE}
-buttonScale:= 1.5/cDefaultZoomLevel;
-{$ENDIF}
+buttonScale:= uMobile.getScreenDPI/cDefaultZoomLevel;
 
 
 with JumpWidget do
--- a/misc/liblua/CMakeLists.txt	Tue Jun 12 17:20:27 2012 +0400
+++ b/misc/liblua/CMakeLists.txt	Sun Jun 24 20:31:26 2012 +0400
@@ -7,6 +7,8 @@
     add_definitions(-DLUA_BUILD_AS_DLL)
     add_library(lua SHARED ${lua_src})
 
+    set(LUA_LIBRARY lua.dll)
+
     set_target_properties(lua PROPERTIES PREFIX "")
     install(TARGETS lua RUNTIME DESTINATION ${target_dir})
 else(WIN32)
--- a/misc/quazip/CMakeLists.txt	Tue Jun 12 17:20:27 2012 +0400
+++ b/misc/quazip/CMakeLists.txt	Sun Jun 24 20:31:26 2012 +0400
@@ -1,7 +1,9 @@
 set(QT_USE_QTCORE TRUE)
 
 find_package(Qt4 REQUIRED)
-include(${QT_USE_FILE})
+if(NOT CROSSAPPLE)
+    include(${QT_USE_FILE})
+endif()
 
 
 file(GLOB SRCS "*.c" "*.cpp")
--- a/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Tue Jun 12 17:20:27 2012 +0400
+++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sun Jun 24 20:31:26 2012 +0400
@@ -67,7 +67,7 @@
 #define MISSIONS_DIRECTORY()    [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Maps/"]
 #define TRAININGS_DIRECTORY()   [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Missions/Training/"]
 #define LOCALE_DIRECTORY()      [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Locale/"]
-#define SCRIPTS_DIRECTORY()     [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/plist/"]
+#define SCRIPTS_DIRECTORY()     [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Data/Scripts/Multiplayer/"]
 
 #define MSG_MEMCLEAN()          DLog(@"has cleaned up some memory");
 #define MSG_DIDUNLOAD()         DLog(@"unloaded");
--- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m	Tue Jun 12 17:20:27 2012 +0400
+++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m	Sun Jun 24 20:31:26 2012 +0400
@@ -85,7 +85,7 @@
 
     // launch the preview here so that we're sure the tcp channel is open
     pthread_t thread_id;
-    pthread_create(&thread_id, NULL, (void *)GenLandPreview, (void *)port);
+    pthread_create(&thread_id, NULL, (void *(*)(void *))GenLandPreview, (void *)port);
     pthread_detach(thread_id);
 
     DLog(@"Waiting for a client on port %d", port);
--- a/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Tue Jun 12 17:20:27 2012 +0400
+++ b/project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m	Sun Jun 24 20:31:26 2012 +0400
@@ -72,7 +72,8 @@
 
 -(NSArray *)listOfScripts {
     if (listOfScripts == nil)
-        self.listOfScripts = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL];
+        self.listOfScripts = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:SCRIPTS_DIRECTORY() error:NULL]
+                              filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF ENDSWITH '.lua'"]];
     return listOfScripts;
 }
 
@@ -202,11 +203,9 @@
             self.lastIndexPath_we = indexPath;
         }
     } else {
-        cell.textLabel.text = [[self.listOfScripts objectAtIndex:row] stringByDeletingPathExtension];
-        NSString *str = [NSString stringWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),[self.listOfScripts objectAtIndex:row]];
-        NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:str];
-        cell.detailTextLabel.text = [dict objectForKey:@"description"];
-        [dict release];
+        cell.textLabel.text = [[[self.listOfScripts objectAtIndex:row] stringByDeletingPathExtension]
+                               stringByReplacingOccurrencesOfString:@"_" withString:@" "];
+        //cell.detailTextLabel.text = ;
         if ([[self.listOfScripts objectAtIndex:row] isEqualToString:self.selectedScript]) {
             UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
             cell.accessoryView = checkbox;
@@ -223,11 +222,11 @@
     return cell;
 }
 
--(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section {
+-(CGFloat) tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger) section {
     return IS_IPAD() ? 0 : 50;
 }
 
--(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger)section {
+-(UIView *)tableView:(UITableView *)aTableView viewForHeaderInSection:(NSInteger) section {
     if (IS_IPAD())
         return nil;
     UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
@@ -239,6 +238,32 @@
     return [theView autorelease];
 }
 
+-(CGFloat) tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger) section {
+    return 40;
+}
+
+-(UIView *)tableView:(UITableView *)aTableView viewForFooterInSection:(NSInteger) section {
+    NSInteger height = 40;
+    UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width, height)];
+    footer.backgroundColor = [UIColor clearColor];
+    footer.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+
+    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, aTableView.frame.size.width*80/100, height)];
+    label.center = CGPointMake(aTableView.frame.size.width/2, height/2);
+    label.textAlignment = UITextAlignmentCenter;
+    label.font = [UIFont italicSystemFontOfSize:12];
+    label.textColor = [UIColor whiteColor];
+    label.numberOfLines = 2;
+    label.backgroundColor = [UIColor clearColor];
+    label.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
+
+    label.text = NSLocalizedString(@"Setting a Style might force a particular Scheme or Weapon configuration.",@"");
+
+    [footer addSubview:label];
+    [label release];
+    return [footer autorelease];
+}
+
 #pragma mark -
 #pragma mark Table view delegate
 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -287,29 +312,30 @@
             self.selectedScript = [self.listOfScripts objectAtIndex:newRow];
 
             // some styles disable or force the choice of a particular scheme/weaponset
-            NSString *path = [[NSString alloc] initWithFormat:@"%@/%@",SCRIPTS_DIRECTORY(),self.selectedScript];
-            NSDictionary *scriptDict = [[NSDictionary alloc] initWithContentsOfFile:path];
+            NSString *path = [[NSString alloc] initWithFormat:@"%@/%@.cfg",SCRIPTS_DIRECTORY(),[self.selectedScript stringByDeletingPathExtension]];
+            NSString *configFile = [[NSString alloc] initWithContentsOfFile:path];
             [path release];
-            self.scriptCommand = [scriptDict objectForKey:@"command"];
-            NSString *scheme = [scriptDict objectForKey:@"scheme"];
-            if ([scheme isEqualToString:@""]) {
+            NSArray *scriptOptions = [configFile componentsSeparatedByString:@"\n"];
+            [configFile release];
+
+            self.scriptCommand = [NSString stringWithFormat:@"escript Scripts/Multiplayer/%@",self.selectedScript];
+            NSString *scheme = [scriptOptions objectAtIndex:0];
+            if ([scheme isEqualToString:@"locked"]) {
                 self.selectedScheme = @"Default.plist";
                 [self.topControl setEnabled:NO forSegmentAtIndex:0];
             } else {
-                self.selectedScheme = scheme;
+                self.selectedScheme = [NSString stringWithFormat:@"%@.plist",scheme];
                 [self.topControl setEnabled:YES forSegmentAtIndex:0];
             }
 
-            NSString *weapon = [scriptDict objectForKey:@"weapon"];
-            if ([weapon isEqualToString:@""]) {
+            NSString *weapon = [scriptOptions objectAtIndex:1];
+            if ([weapon isEqualToString:@"locked"]) {
                 self.selectedWeapon = @"Default.plist";
                 [self.topControl setEnabled:NO forSegmentAtIndex:1];
             } else {
-                self.selectedWeapon = weapon;
+                self.selectedWeapon = [NSString stringWithFormat:@"%@.plist",weapon];
                 [self.topControl setEnabled:YES forSegmentAtIndex:1];
             }
-
-            [scriptDict release];
         }
 
         [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
--- a/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Tue Jun 12 17:20:27 2012 +0400
+++ b/project_files/HedgewarsMobile/Hedgewars.xcodeproj/project.pbxproj	Sun Jun 24 20:31:26 2012 +0400
@@ -1472,7 +1472,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp    ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png  ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${PROJECT_DIR}/../AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n    if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n    then\n        mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n    fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n#remove cfg files since we have plists\nfind ${PROJECT_DIR}/Data/Scripts -name *.cfg -delete\nif ((`ls ${PROJECT_DIR}/Data/Scripts/Multiplayer/*.lua|wc -l` >= `ls ${PROJECT_DIR}/Data/Scripts/plist/*.plist|wc -l` ))\nthen\necho \"${PROJECT_DIR}/Data/Scripts/Multiplayer/Normal.plist:0: warning, missing plist implementation of a Multiplayer script file\"\nfi\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\"";
+			shellScript = "#copy new stuff over old stuff\nrm -rf ${PROJECT_DIR}/Data\n\n#create config.inc\necho \"Updating config file...\"\nPROTO=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep HEDGEWARS_PROTO_VER | cut -d ' ' -f 2 | cut -d ')' -f 1`\nMAJN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MAJOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nMINN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_MINOR | xargs | cut -d ' ' -f 2 |cut -d ')' -f 1`\nPATN=`cat ${PROJECT_DIR}/../../CMakeLists.txt | grep CPACK_PACKAGE_VERSION_PATCH | xargs | cut -d ' ' -f 2 |cut -d '$' -f 1`\nREVN=-`/usr/local/bin/hg id -n ${PROJECT_DIR}/../../`\necho \"const cNetProtoVersion = $PROTO; const cVersionString = '${MAJN}.${MINN}.${PATN}${REVN}'; const cLuaLibrary = '';\" > ${PROJECT_DIR}/config.inc\n\necho \"Copying Data...\"\ncp -R ${PROJECT_DIR}/../../share/hedgewars/Data ${PROJECT_DIR}/Data\n\n#copy some files from QTfrontend/res\necho \"Fetching additional graphics from QTfrontend...\"\nmkdir ${PROJECT_DIR}/Data/Graphics/Icons\ncp    ${PROJECT_DIR}/../../QTfrontend/res/{btn*,icon*,StatsMedal*,ammopic*}.png  ${PROJECT_DIR}/Data/Graphics/Icons/\n\necho \"Removing text and dummy files...\"\n#delete all CMakeLists.txt and image source files\nfind ${PROJECT_DIR}/Data -name CMakeLists.txt -delete\nfind ${PROJECT_DIR}/Data -name *.svg* -delete\nfind ${PROJECT_DIR}/Data -name *.psd -delete\nfind ${PROJECT_DIR}/Data -name *.sifz -delete\nfind ${PROJECT_DIR}/Data -name *.xcf -delete\nfind ${PROJECT_DIR}/Data -name *.orig -delete\nfind ${PROJECT_DIR}/Data -name *.ts -delete\n\n#delete dummy maps and hats, misc stuff\nrm -rf ${PROJECT_DIR}/Data/Maps/test*\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/{TeamCap,TeamHeadband,TeamHair}\nrm -rf ${PROJECT_DIR}/Data/misc/\n\n#delete forbidden maps and WIP themes (remember to check that no Map uses them)\nrm -rf ${PROJECT_DIR}/Data/Maps/{Cheese,FlightJoust}\nrm -rf ${PROJECT_DIR}/Data/Themes/{Beach,Digital}\n\n#delete all names, reserved hats and unused fonts\nrm -rf ${PROJECT_DIR}/Data/Names/\nrm -rf ${PROJECT_DIR}/Data/Graphics/Hats/Reserved/\nrm -rf ${PROJECT_DIR}/Data/Fonts/{wqy-zenhei.ttc,DroidSansFallback.ttf}\n\necho \"Handling audio files...\"\n#copy mono audio\ncp -R ${PROJECT_DIR}/../AudioMono/* ${PROJECT_DIR}/Data/\n#delete the Classic voice\nrm -rf ${PROJECT_DIR}/Data/Sounds/voices/Classic\n#delete the main theme file\nrm -rf ${PROJECT_DIR}/Data/Music/main_theme.ogg\n\n#remove unused voices\nfor i in {Amazing,Brilliant,Bugger,Bungee,Cutitout,Drat,Excellent,Fire,FlawlessPossibility,Gonnagetyou,Grenade,Hmm,Justyouwait,Leavemealone,Ohdear,Ouch,Perfect,Revenge,Runaway,Solong,Thisoneismine,VictoryPossibility,Watchthis,Whatthe,Whoopsee}; do find Data/Sounds/voices/ -name $i.ogg -delete; done\n\necho \"Tweaking Data contents...\"\n#move Lua maps in Missions\nmkdir ${PROJECT_DIR}/Data/Missions/Maps/\nfor i in `ls ${PROJECT_DIR}/Data/Maps/`;\ndo \n    if [[ `ls -f ${PROJECT_DIR}/Data/Maps/$i/map.lua 2> /dev/null` != '' ]];\n    then\n        mv ${PROJECT_DIR}/Data/Maps/$i ${PROJECT_DIR}/Data/Missions/Maps/;\n    fi;\ndone;\n\n#workaround for missing map in CTF_Blizzard\nln -s ../../../Maps/Blizzard/map.png ${PROJECT_DIR}/Data/Missions/Maps/CTF_Blizzard/map.png\n\n#reduce the number of flakes for City\nsed -i -e 's/1500/50/' ${PROJECT_DIR}/Data/Themes/City/theme.cfg\n\necho \"Done\"";
 			showEnvVarsInLog = 0;
 		};
 		9283011B0F10CB2D00CC5A3C /* Build libfpc.a */ = {
@@ -1740,7 +1740,6 @@
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
 				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
@@ -1749,14 +1748,11 @@
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
 				GCC_WARN_PEDANTIC = YES;
 				GCC_WARN_SHADOW = YES;
-				GCC_WARN_SIGN_COMPARE = YES;
 				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = NO;
 				GCC_WARN_UNKNOWN_PRAGMAS = YES;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_LABEL = YES;
-				GCC_WARN_UNUSED_PARAMETER = NO;
 				GCC_WARN_UNUSED_VALUE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
@@ -1850,7 +1846,6 @@
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
 				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
@@ -1859,14 +1854,11 @@
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
 				GCC_WARN_PEDANTIC = YES;
 				GCC_WARN_SHADOW = YES;
-				GCC_WARN_SIGN_COMPARE = YES;
 				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = NO;
 				GCC_WARN_UNKNOWN_PRAGMAS = YES;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_LABEL = YES;
-				GCC_WARN_UNUSED_PARAMETER = NO;
 				GCC_WARN_UNUSED_VALUE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
@@ -2002,7 +1994,6 @@
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
 				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
@@ -2011,14 +2002,11 @@
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
 				GCC_WARN_PEDANTIC = YES;
 				GCC_WARN_SHADOW = YES;
-				GCC_WARN_SIGN_COMPARE = YES;
 				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = NO;
 				GCC_WARN_UNKNOWN_PRAGMAS = YES;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_LABEL = YES;
-				GCC_WARN_UNUSED_PARAMETER = NO;
 				GCC_WARN_UNUSED_VALUE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
@@ -2076,7 +2064,6 @@
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
-				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
 				GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
@@ -2085,14 +2072,11 @@
 				GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
 				GCC_WARN_PEDANTIC = YES;
 				GCC_WARN_SHADOW = YES;
-				GCC_WARN_SIGN_COMPARE = YES;
 				GCC_WARN_STRICT_SELECTOR_MATCH = YES;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
-				GCC_WARN_UNINITIALIZED_AUTOS = NO;
 				GCC_WARN_UNKNOWN_PRAGMAS = YES;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_LABEL = YES;
-				GCC_WARN_UNUSED_PARAMETER = NO;
 				GCC_WARN_UNUSED_VALUE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
--- a/share/CMakeLists.txt	Tue Jun 12 17:20:27 2012 +0400
+++ b/share/CMakeLists.txt	Sun Jun 24 20:31:26 2012 +0400
@@ -1,6 +1,6 @@
 add_subdirectory(hedgewars)
 
-IF(APPLE)
+IF(APPLE OR CROSSAPPLE)
 	#needed for CFBundleVersion and CFBundleShortVersionString
 	FIND_PROGRAM(HGCOMMAND hg)
 	IF (HGCOMMAND AND (EXISTS ${hedgewars_SOURCE_DIR}/.hg))
@@ -24,4 +24,4 @@
 		DESTINATION ../Resources/)
 	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/dsa_pub.pem"
 		DESTINATION ../Resources/)
-ENDIF(APPLE)
+ENDIF(APPLE OR CROSSAPPLE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.cfg	Sun Jun 24 20:31:26 2012 +0400
@@ -0,0 +1,2 @@
+Default
+Default
--- a/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Tue Jun 12 17:20:27 2012 +0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua	Sun Jun 24 20:31:26 2012 +0400
@@ -1608,7 +1608,7 @@
 
 		vType[i] = "generic"
 		vCounter[i] = 0
-		vCounterLim[i] = 3000
+		vCounterLim[i] = 150
 		vCircScore[i] = 0
 		vCircHealth[i] = 1
 
@@ -1801,7 +1801,7 @@
 			vType[i] = "drone"
 			vCircRadMin[i] = 50	*5
 			vCircRadMax[i] = 90	*5
-			vCounterLim[i] = 3000
+			vCounterLim[i] = 150
 			vCircScore[i] = 10
 			vCircHealth[i] = 1
 		--else
@@ -1826,7 +1826,7 @@
 			vCircRadMin[i] = 100*5
 			vCircRadMax[i] = 180*5
 			vCircWidth[i] = 1
-			vCounterLim[i] = 2000
+			vCounterLim[i] = 100
 			vCircScore[i] = 30
 			vCircHealth[i] = 3
 		else
@@ -1998,7 +1998,7 @@
 		end
 
 	-- if player is hit by circle bazooka
-	elseif (GetGearType(gear) == gtShell) then --or (GetGearType(gear) == gtBall) then
+	elseif (GetGearType(gear) == gtShell) and (CurrentHedgehog ~= nil) then --or (GetGearType(gear) == gtBall) then
 
 		dist = GetDistFromGearToGear(gear, CurrentHedgehog)
 
@@ -2387,17 +2387,19 @@
 		--WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy)
 		--WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) )
 
-		if GetX(gear) > GetX(CurrentHedgehog) then
-			dx = dx - turningSpeed--0.1
-		else
-			dx = dx + turningSpeed--0.1
-		end
-
-		if GetY(gear) > GetY(CurrentHedgehog) then
-			dy = dy - turningSpeed--0.1
-		else
-			dy = dy + turningSpeed--0.1
-		end
+        if CurrentHedgehog ~= nil then
+            if GetX(gear) > GetX(CurrentHedgehog) then
+                dx = dx - turningSpeed--0.1
+            else
+                dx = dx + turningSpeed--0.1
+            end
+
+            if GetY(gear) > GetY(CurrentHedgehog) then
+                dy = dy - turningSpeed--0.1
+            else
+                dy = dy + turningSpeed--0.1
+            end
+        end
 
 
 		if (GetGearType(gear) == gtShell) then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.cfg	Sun Jun 24 20:31:26 2012 +0400
@@ -0,0 +1,2 @@
+Default
+Default
--- a/share/hedgewars/Data/Scripts/plist/Balanced Random Weapon.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Balanced_Random_Weapon.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string></string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Capture the Flag.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Capture_the_Flag.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Highlander.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Highlander.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/No Jumping.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/No_Jumping.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Normal.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string></string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Racer.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Racer.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Shoppa.plist</string>
-	<key>weapon</key>
-	<string>Shoppa.plist</string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Random Weapon.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Balanced_Random_Weapon.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string></string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Space Invasion.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Space_Invasion.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/The Specialists.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/The_Specialists.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string></string>
-	<key>weapon</key>
-	<string></string>
-</dict>
-</plist>
--- a/share/hedgewars/Data/Scripts/plist/Tumbler.plist	Tue Jun 12 17:20:27 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>command</key>
-	<string>escript Scripts/Multiplayer/Tumbler.lua</string>
-	<key>description</key>
-	<string></string>
-	<key>scheme</key>
-	<string>Default.plist</string>
-	<key>weapon</key>
-	<string>Default.plist</string>
-</dict>
-</plist>
--- a/tools/pas2c.hs	Tue Jun 12 17:20:27 2012 +0400
+++ b/tools/pas2c.hs	Sun Jun 24 20:31:26 2012 +0400
@@ -89,8 +89,8 @@
     s <- flip execStateT initState $ f fn
     renderCFiles s
     where
-    printLn = liftIO . hPutStrLn stderr
-    print = liftIO . hPutStr stderr
+    printLn = liftIO . hPutStrLn stdout
+    print = liftIO . hPutStr stdout
     initState = Map.empty
     f :: String -> StateT (Map.Map String PascalUnit) IO ()
     f fileName = do
@@ -122,7 +122,7 @@
 renderCFiles units = do
     let u = Map.toList units
     let nss = Map.map (toNamespace nss) units
-    hPutStrLn stderr $ "Units: " ++ (show . Map.keys . Map.filter (not . Map.null) $ nss)
+    --hPutStrLn stderr $ "Units: " ++ (show . Map.keys . Map.filter (not . Map.null) $ nss)
     --writeFile "pas2c.log" $ unlines . map (\t -> show (fst t) ++ "\n" ++ (unlines . map ((:) '\t' . show) . snd $ t)) . Map.toList $ nss
     mapM_ (toCFiles nss) u
     where
@@ -166,7 +166,7 @@
 toCFiles :: Map.Map String Records -> (String, PascalUnit) -> IO ()
 toCFiles _ (_, System _) = return ()
 toCFiles ns p@(fn, pu) = do
-    hPutStrLn stderr $ "Rendering '" ++ fn ++ "'..."
+    hPutStrLn stdout $ "Rendering '" ++ fn ++ "'..."
     toCFiles' p
     where
     toCFiles' (fn, p@(Program {})) = writeFile (fn ++ ".c") $ (render2C initialState . pascal2C) p