OMG merge
authorkoda
Tue, 30 Nov 2010 22:46:47 +0100
changeset 4436 94c948a92759
parent 4366 d19adc635c99 (current diff)
parent 4435 996ef18fa396 (diff)
child 4437 05192cdbce9b
OMG merge
QTfrontend/predefteams.h
hedgewars/CCHandlers.inc
hedgewars/GearDrawing.inc
hedgewars/SinTable.inc
hedgewars/uConsole.pas
hedgewars/uMobile.pas
--- a/QTfrontend/CMakeLists.txt	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/CMakeLists.txt	Tue Nov 30 22:46:47 2010 +0100
@@ -150,7 +150,6 @@
 set(	hwfr_hdrs
 	binds.h
 	ui_hwform.h
-	predefteams.h
 	KB.h
 	hwconsts.h
 	)
--- a/QTfrontend/ammoSchemeModel.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/ammoSchemeModel.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -60,6 +60,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -120,6 +121,7 @@
         << "healthcaseamount" // 34
         << "waterrise"        // 35
         << "healthdecrease"   // 36
+        << "ropepct"          // 37
         ;
 
     QList<QVariant> proMode;
@@ -161,6 +163,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> shoppa;
@@ -202,6 +205,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> cleanslate;
@@ -243,6 +247,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> minefield;
@@ -284,6 +289,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> barrelmayhem;
@@ -325,6 +331,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> tunnelhogs;
@@ -366,6 +373,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> forts;
@@ -407,6 +415,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> timeless;
@@ -448,6 +457,7 @@
         << QVariant(30)            // health case amt 34
         << QVariant(0)             // water rise amt 35
         << QVariant(0)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> thinkingportals;
@@ -489,6 +499,7 @@
         << QVariant(25)            // health case amt 34
         << QVariant(47)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
     QList<QVariant> kingmode;
@@ -530,6 +541,7 @@
         << QVariant(30)            // health case amt 34
         << QVariant(30)            // water rise amt 35
         << QVariant(5)             // health dec amt 36
+        << QVariant(100)           // rope modfier   37
         ;
 
 
--- a/QTfrontend/ammoSchemeModel.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/ammoSchemeModel.h	Tue Nov 30 22:46:47 2010 +0100
@@ -42,6 +42,7 @@
 
     int numberOfDefaultSchemes;
     QStringList predefSchemesNames;
+    QStringList spNames;
 
 public slots:
     void Save();
@@ -54,8 +55,6 @@
 
 private:
     QSettings fileConfig;
-
-    QStringList spNames;
 };
 
 class NetAmmoSchemeModel : public QAbstractTableModel
--- a/QTfrontend/game.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/game.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -40,6 +40,7 @@
     this->config = config;
     this->gamecfg = gamecfg;
     TeamCount = 0;
+    netSuspend = false;
 }
 
 HWGame::~HWGame()
@@ -88,7 +89,7 @@
             HWProto::addStringToBuffer(buf, QString("eammprob %1").arg(ammostr.mid(cAmmoNumber, cAmmoNumber)));
             HWProto::addStringToBuffer(buf, QString("eammdelay %1").arg(ammostr.mid(2 * cAmmoNumber, cAmmoNumber)));
             HWProto::addStringToBuffer(buf, QString("eammreinf %1").arg(ammostr.mid(3 * cAmmoNumber, cAmmoNumber)));
-            HWProto::addStringToBuffer(buf, QString("eammstore"));
+            if(!gamecfg->schemeData(21).toBool()) HWProto::addStringToBuffer(buf, QString("eammstore"));
             HWProto::addStringListToBuffer(buf,
                 (*it).TeamGameConfig(gamecfg->getInitHealth()));
         }
@@ -245,7 +246,7 @@
             break;
         }
         default: {
-            if (gameType == gtNet)
+            if (gameType == gtNet && !netSuspend)
             {
                 emit SendNet(msg);
             }
@@ -377,3 +378,15 @@
     gameState = state;
     emit GameStateChanged(state);
 }
+
+void HWGame::KillAllTeams()
+{
+    if (m_pTeamSelWidget)
+    {
+        QByteArray buf;
+        QList<HWTeam> teams = m_pTeamSelWidget->getPlayingTeams();
+        for(QList<HWTeam>::iterator it = teams.begin(); it != teams.end(); ++it)
+            HWProto::addStringToBuffer(buf, QString("eteamgone %1").arg((*it).TeamName));
+        RawSendIPC(buf);
+    }
+}
--- a/QTfrontend/game.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/game.h	Tue Nov 30 22:46:47 2010 +0100
@@ -53,6 +53,9 @@
     void StartNet();
     void StartTraining(const QString & file);
     void StartCampaign(const QString & file);
+    void KillAllTeams();
+    GameState gameState;
+    bool netSuspend;
 
  protected:
     virtual QStringList setArguments();
@@ -89,7 +92,6 @@
     GameCFGWidget * gamecfg;
     TeamSelWidget* m_pTeamSelWidget;
     GameType gameType;
-    GameState gameState;
 
     void commonConfig();
     void SendConfig();
--- a/QTfrontend/gamecfgwidget.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/gamecfgwidget.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -47,7 +47,7 @@
     QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions);
 
     GameSchemes = new QComboBox(GBoxOptions);
-    GBoxOptionsLayout->addWidget(GameSchemes, 0, 1);
+    GBoxOptionsLayout->addWidget(GameSchemes, 0, 2);
     connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int)));
 
     GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Game scheme"), GBoxOptions), 0, 0);
@@ -59,13 +59,13 @@
     goToSchemePage->setIconSize(pmEdit.size());
     goToSchemePage->setIcon(pmEdit);
     goToSchemePage->setMaximumWidth(pmEdit.width() + 6);
-    GBoxOptionsLayout->addWidget(goToSchemePage, 0, 2);
-    connect(goToSchemePage, SIGNAL(clicked()), this, SIGNAL(goToSchemes()));
+    GBoxOptionsLayout->addWidget(goToSchemePage, 0, 3);
+    connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes()));
 
     GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 1, 0);
 
     WeaponsName = new QComboBox(GBoxOptions);
-    GBoxOptionsLayout->addWidget(WeaponsName, 1, 1);
+    GBoxOptionsLayout->addWidget(WeaponsName, 1, 2);
 
     connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
 
@@ -74,16 +74,19 @@
     goToWeaponPage->setIconSize(pmEdit.size());
     goToWeaponPage->setIcon(pmEdit);
     goToWeaponPage->setMaximumWidth(pmEdit.width() + 6);
-    GBoxOptionsLayout->addWidget(goToWeaponPage, 1, 2);
-
+    GBoxOptionsLayout->addWidget(goToWeaponPage, 1, 3);
     connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons()));
 
-    GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Bind schemes and weapons"), GBoxOptions), 2, 0);
+    //GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Bind schemes with weapons"), GBoxOptions), 2, 0);
 
     bindEntries = new QCheckBox(GBoxOptions);
-    bindEntries->setToolTip(tr("When this option is enabled selecting a game scheme will auto-select a weapon (and viceversa)"));
+    bindEntries->setToolTip(tr("When this option is enabled selecting a game scheme will auto-select a weapon"));
     bindEntries->setChecked(true);
-    GBoxOptionsLayout->addWidget(bindEntries, 2, 2);
+    bindEntries->setMaximumWidth(42);
+    bindEntries->setStyleSheet( "QCheckBox::indicator:checked   { image: url(\":/res/lock.png\"); }"
+                                "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\");   }" );
+    GBoxOptionsLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter);
+    //GBoxOptionsLayout->addWidget(bindEntries, 2, 2);
 
     connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &)));
     connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &)));
@@ -93,9 +96,14 @@
     connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int)));
 }
 
+void GameCFGWidget::jumpToSchemes()
+{
+    emit goToSchemes(GameSchemes->currentIndex());
+}
+
 void GameCFGWidget::jumpToWeapons()
 {
-    emit goToWeapons(WeaponsName->currentText());
+    emit goToWeapons(WeaponsName->currentIndex());
 }
 
 QVariant GameCFGWidget::schemeData(int column) const
@@ -179,6 +187,7 @@
     sl.append(QString("e$hcaseamount %1").arg(schemeData(34).toInt()));
     sl.append(QString("e$waterrise %1").arg(schemeData(35).toInt()));
     sl.append(QString("e$healthdec %1").arg(schemeData(36).toInt()));
+    sl.append(QString("e$ropepct %1").arg(schemeData(37).toInt()));
     sl.append(QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()));
     sl.append(QString("e$mapgen %1").arg(pMapContainer->get_mapgen()));
     sl.append(QString("e$maze_size %1").arg(pMapContainer->get_maze_size()));
@@ -279,17 +288,6 @@
             "AMMO",
             QStringList() << WeaponsName->itemText(index) << WeaponsName->itemData(index).toString()
         );
-        if (bindEntries->isChecked() == true) {
-            QString weapName = WeaponsName->itemText(index);
-            for (int i = 0; i < GameSchemes->count(); i++) {
-                 QString schemeName = GameSchemes->itemText(i);
-                 int res = QString::compare(weapName, schemeName, Qt::CaseSensitive);
-                 if (0 == res) {
-                     GameSchemes->setCurrentIndex(i);
-                     break;
-                 }
-            }
-        }
     }
 }
 
@@ -344,6 +342,7 @@
              int res = QString::compare(weapName, schemeName, Qt::CaseSensitive);
              if (0 == res) {
                  WeaponsName->setCurrentIndex(i);
+                 emit ammoChanged(i);
                  break;
              }
         }
--- a/QTfrontend/gamecfgwidget.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/gamecfgwidget.h	Tue Nov 30 22:46:47 2010 +0100
@@ -44,6 +44,7 @@
     QComboBox * WeaponsName;
     HWMapContainer* pMapContainer;
     QTableView * tv;
+    QVariant schemeData(int column) const;
 
 public slots:
     void setParam(const QString & param, const QStringList & value);
@@ -52,8 +53,8 @@
 
 signals:
     void paramChanged(const QString & param, const QStringList & value);
-    void goToSchemes();
-    void goToWeapons(const QString & name);
+    void goToSchemes(int);
+    void goToWeapons(int);
 
 private slots:
     void ammoChanged(int index);
@@ -62,6 +63,7 @@
     void seedChanged(const QString &);
     void themeChanged(const QString &);
     void schemeChanged(int);
+    void jumpToSchemes();
     void jumpToWeapons();
     void mapgenChanged(MapGenerator m);
     void maze_sizeChanged(int s);
@@ -74,7 +76,6 @@
 
     void setNetAmmo(const QString& name, const QString& ammo);
 
-    QVariant schemeData(int column) const;
 };
 
 #endif // GAMECONFIGWIDGET_H
--- a/QTfrontend/hedgehogerWidget.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/hedgehogerWidget.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -20,8 +20,8 @@
 
 #include "frameTeam.h"
 
-CHedgehogerWidget::CHedgehogerWidget(const QImage& im, QWidget * parent) :
-    ItemNum(im, parent, 1)
+CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) :
+    ItemNum(im, img, parent, 1)
 {
   // TODO: maxHedgehogsPerGame doesn't reset properly and won't match map limits for now
   /*if(parent) {
--- a/QTfrontend/hedgehogerWidget.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/hedgehogerWidget.h	Tue Nov 30 22:46:47 2010 +0100
@@ -28,7 +28,7 @@
   Q_OBJECT
 
  public:
-  CHedgehogerWidget(const QImage& im, QWidget * parent);
+  CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent);
   virtual ~CHedgehogerWidget();
   unsigned char getHedgehogsNum() const;
   void setHHNum (unsigned int num);
--- a/QTfrontend/hedgewars.qrc	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/hedgewars.qrc	Tue Nov 30 22:46:47 2010 +0100
@@ -2,8 +2,15 @@
 <qresource>
     <file alias="Ammos.png">../share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png</file>
     <file>res/hh25x25.png</file>
+    <file>res/hh25x25grey.png</file>
     <file>res/ammopic.png</file>
+    <file>res/ammopicgrey.png</file>
+    <file>res/ammopicbox.png</file>
+    <file>res/ammopicboxgrey.png</file>
+    <file>res/ammopicdelay.png</file>
+    <file>res/ammopicdelaygrey.png</file>
     <file>res/infinity.png</file>
+    <file>res/infinitygrey.png</file>
     <file>res/botlevels/0.png</file>
     <file>res/botlevels/1.png</file>
     <file>res/botlevels/2.png</file>
@@ -80,6 +87,7 @@
     <file>res/iconTime.png</file>
     <file>res/iconMine.png</file>
     <file>res/iconDud.png</file>
+    <file>res/iconRope.png</file>
     <file>res/dice.png</file>
     <file>res/Star.png</file>
     <file>res/file_save.png</file>
@@ -93,8 +101,6 @@
     <file>res/chat_default_off.png</file>
     <file>res/chat_ignore_off.png</file>
     <file>res/chat_friend_off.png</file>
-    <file>res/ammopicbox.png</file>
-    <file>res/ammopicdelay.png</file>
     <file>res/addfriend.png</file>
     <file>res/remfriend.png</file>
     <file>res/ignore.png</file>
@@ -102,6 +108,8 @@
     <file>res/follow.png</file>
     <file>res/info.png</file>
     <file>res/kick.png</file>
+    <file>res/lock.png</file>
+    <file>res/unlock.png</file>
     <file>res/StatsMedal1.png</file>
     <file>res/StatsMedal2.png</file>
     <file>res/StatsMedal3.png</file>
--- a/QTfrontend/hwform.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/hwform.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -77,6 +77,7 @@
 #ifdef USE_XFIRE
     xfire_init();
 #endif
+    game = NULL;
     gameSettings = new QSettings(cfgdir->absolutePath() + "/hedgewars.ini", QSettings::IniFormat);
     frontendEffects = gameSettings->value("frontend/effects", true).toBool();
     playerHash = QString(QCryptographicHash::hash(gameSettings->value("net/nick","").toString().toLatin1(), QCryptographicHash::Md5).toHex());
@@ -127,9 +128,9 @@
     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
         ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
-    connect(ui.pageMultiplayer->teamsSelect, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
-    connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
-    connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
+    connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
+    connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
+    connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
 
     connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
@@ -146,7 +147,11 @@
 #endif
 
     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
-    connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
+    connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
+    connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
+    connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
+    connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
+    connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
 
     connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
@@ -162,9 +167,9 @@
         ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
         ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
-    connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
-    connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
-    connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
+    connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
+    connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
+    connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
 
     connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), this, SLOT(GoToAdmin()));
@@ -194,8 +199,8 @@
         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
         this, SLOT(UpdateWeapons())); // executed second
-    connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
-        this, SLOT(GoBack())); // executed third
+    //connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
+    //    this, SLOT(GoBack())); // executed third
 
     connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
 
@@ -209,6 +214,7 @@
     ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
     ui.pageScheme->setModel(ammoSchemeModel);
     ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
+    ui.pageOptions->SchemesName->setModel(ammoSchemeModel);
 
     wBackground = NULL;
     if (config->isFrontendEffects()) {
@@ -276,7 +282,7 @@
 
 void HWForm::keyReleaseEvent(QKeyEvent *event)
 {
-  if (event->key() == Qt::Key_Escape /*|| event->key() == Qt::Key_Backspace*/ )
+  if (event->key() == Qt::Key_Escape /*|| event->key() == Qt::Key_Backspace*/ ) 
     this->GoBack();
 }
 
@@ -299,6 +305,7 @@
     combos.push_back(ui.pageOptions->WeaponsName);
     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
+    combos.push_back(ui.pageSelectWeapon->selectWeaponSet);
 
     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
 
@@ -363,19 +370,19 @@
 
 void HWForm::GoToSelectNewWeapon()
 {
-    ui.pageSelectWeapon->pWeapons->setWeaponsName(tr("new"));
+    ui.pageSelectWeapon->pWeapons->newWeaponsName();
     GoToPage(ID_PAGE_SELECTWEAPON);
 }
 
 void HWForm::GoToSelectWeapon()
 {
-    ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText());
+    ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
     GoToPage(ID_PAGE_SELECTWEAPON);
 }
 
-void HWForm::GoToSelectWeaponSet(const QString & name)
+void HWForm::GoToSelectWeaponSet(int index)
 {
-    ui.pageSelectWeapon->pWeapons->setWeaponsName(name);
+    ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(index);
     GoToPage(ID_PAGE_SELECTWEAPON);
 }
 
@@ -420,8 +427,21 @@
     GoToPage(ID_PAGE_NETSERVER);
 }
 
-void HWForm::GoToSchemes()
+void HWForm::GoToScheme(int index)
+{
+    ui.pageScheme->selectScheme->setCurrentIndex(index);
+    GoToPage(ID_PAGE_SCHEME);
+}
+
+void HWForm::GoToNewScheme()
 {
+    ui.pageScheme->newRow();
+    GoToPage(ID_PAGE_SCHEME);
+}
+
+void HWForm::GoToEditScheme()
+{
+    ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
     GoToPage(ID_PAGE_SCHEME);
 }
 
@@ -490,8 +510,14 @@
 
     if(id == ID_PAGE_NETGAME) // joining a room
         ui.pageNetGame->pChatWidget->loadLists(ui.pageOptions->editNetNick->text());
-    else if(id == ID_PAGE_ROOMSLIST) // joining the lobby
+// joining the lobby 
+    else if(id == ID_PAGE_ROOMSLIST) {
+        if ( hwnet && game && game->gameState == gsStarted) { // abnormal exit - kick or room destruction - send kills.
+            game->netSuspend = true;
+            game->KillAllTeams();
+        }
         ui.pageRoomsList->chatWidget->loadLists(ui.pageOptions->editNetNick->text());
+    }
 }
 
 void HWForm::GoToPage(quint8 id)
@@ -521,6 +547,9 @@
             GoBack();
 
     if (curid == ID_PAGE_ROOMSLIST) NetDisconnect();
+    if (curid == ID_PAGE_NETGAME) hwnet->partRoom();
+    // need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick
+    //if (curid == ID_PAGE_NETGAME && (!game || game->gameState != gsStarted)) hwnet->partRoom();
 
     if (curid == ID_PAGE_SCHEME)
         ammoSchemeModel->Save();
@@ -588,11 +617,15 @@
 
 void HWForm::DeleteTeam()
 {
-    editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
-    editedTeam->DeleteFile();
+    QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
 
-    // Remove from lists
-    ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
+    if (reallyDelete.exec() == QMessageBox::Ok) {
+        editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
+        editedTeam->DeleteFile();
+
+        // Remove from lists
+        ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
+    }
 }
 
 void HWForm::RandomNames()
@@ -626,6 +659,22 @@
     GoBack();
 }
 
+void HWForm::DeleteScheme()
+{
+    ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
+    if (ui.pageOptions->SchemesName->currentIndex() < ammoSchemeModel->numberOfDefaultSchemes) {
+        QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Can not delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
+    } else {
+        ui.pageScheme->deleteRow();
+    }
+}
+
+void HWForm::DeleteWeaponSet()
+{
+    ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
+    ui.pageSelectWeapon->pWeapons->deleteWeaponsName();
+}
+
 void HWForm::SimpleGame()
 {
     CreateGame(0, 0, *cDefaultAmmoStore);
@@ -678,7 +727,7 @@
     connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
     connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom()));
     connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
-    connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
+    //connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
 
 // rooms list page stuff
     connect(hwnet, SIGNAL(roomsList(const QStringList&)),
@@ -892,11 +941,12 @@
 
 void HWForm::GameStateChanged(GameState gameState)
 {
+    quint8 id = ui.Pages->currentIndex();
     switch(gameState) {
         case gsStarted: {
             Music(false);
             if (wBackground) wBackground->stopAnimation();
-            GoToPage(ID_PAGE_INGAME);
+            if (!hwnet || (!hwnet->isRoomChief() || !hwnet->isInRoom())) GoToPage(ID_PAGE_INGAME);
             ui.pageGameStats->clear();
             if (pRegisterServer)
             {
@@ -910,19 +960,23 @@
         case gsFinished: {
             //setVisible(true);
             setFocusPolicy(Qt::StrongFocus);
-            GoBack();
+            if (id == ID_PAGE_INGAME) GoBack();
             Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
             if (wBackground) wBackground->startAnimation();
             GoToPage(ID_PAGE_GAMESTATS);
-            if (hwnet) hwnet->gameFinished();
+            if (hwnet && (!game || !game->netSuspend)) hwnet->gameFinished();
+            if (game) game->netSuspend = false;
             break;
         }
         default: {
             //setVisible(true);
             setFocusPolicy(Qt::StrongFocus);
             quint8 id = ui.Pages->currentIndex();
-            if (id == ID_PAGE_INGAME) {
-                GoBack();
+            if (id == ID_PAGE_INGAME ||
+// was room chief and the game was aborted
+                (hwnet && hwnet->isRoomChief() && hwnet->isInRoom() && 
+                    (gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed))) {
+                if (id == ID_PAGE_INGAME) GoBack();
                 Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
                 if (wBackground) wBackground->startAnimation();
                 if (hwnet) hwnet->gameFinished();
@@ -1089,7 +1143,7 @@
 
 void HWForm::NetLeftRoom()
 {
-    if (ui.Pages->currentIndex() == ID_PAGE_NETGAME)
+    if (ui.Pages->currentIndex() == ID_PAGE_NETGAME || ui.Pages->currentIndex() == ID_PAGE_INGAME)
         GoBack();
     else
         qWarning("Left room while not in room");
--- a/QTfrontend/hwform.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/hwform.h	Tue Nov 30 22:46:47 2010 +0100
@@ -71,10 +71,12 @@
     void GoToTraining();
     void GoToCampaign();
     void GoToSelectWeapon();
-    void GoToSelectWeaponSet(const QString & name);
+    void GoToSelectWeaponSet(int index);
     void GoToSelectNewWeapon();
     void GoToNetServer();
-    void GoToSchemes();
+    void GoToScheme(int index);
+    void GoToEditScheme();
+    void GoToNewScheme();
     void GoToAdmin();
     void GoToPage(quint8 id);
     void GoBack();
@@ -89,6 +91,8 @@
     void RandomName(const int &i);
     void TeamSave();
     void TeamDiscard();
+    void DeleteScheme();
+    void DeleteWeaponSet();
     void SimpleGame();
     void PlayDemo();
     void StartTraining();
--- a/QTfrontend/hwmap.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/hwmap.h	Tue Nov 30 22:46:47 2010 +0100
@@ -31,6 +31,7 @@
 {
     MAPGEN_REGULAR,
     MAPGEN_MAZE,
+    MAPGEN_LAST
 };
 
 class HWMap : public TCPBase
--- a/QTfrontend/itemNum.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/itemNum.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -22,10 +22,11 @@
 #include <QMouseEvent>
 #include <QPainter>
 
-ItemNum::ItemNum(const QImage& im, QWidget * parent, unsigned char min, unsigned char max) :
-  QFrame(parent), m_im(im), infinityState(false), nonInteractive(false), minItems(min), maxItems(max),
+ItemNum::ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min, unsigned char max) :
+  QFrame(parent), m_im(im), m_img(img), infinityState(false), nonInteractive(false), minItems(min), maxItems(max),
   numItems(min+2 >= max ? min : min+2)
 {
+    enabled = true;
     if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
 }
 
@@ -36,7 +37,7 @@
 void ItemNum::mousePressEvent ( QMouseEvent * event )
 {
   if(nonInteractive) return;
-  if(event->button()==Qt::LeftButton) {
+  if(event->button()==Qt::LeftButton && enabled) {
     event->accept();
     if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems)) {
       incItems();
@@ -45,7 +46,7 @@
       // appears there's an emit in there
       decItems();
     }
-  } else if (event->button()==Qt::RightButton) {
+  } else if (event->button()==Qt::RightButton && enabled) {
     event->accept();
     if(numItems > minItems) {
       decItems();
@@ -71,11 +72,19 @@
 
   if (numItems==maxItems+1) {
     QRect target(0, 0, 100, 32);
-    painter.drawImage(target, QImage(":/res/infinity.png"));
+    if (enabled) {
+        painter.drawImage(target, QImage(":/res/infinity.png"));
+    } else {
+        painter.drawImage(target, QImage(":/res/infinitygrey.png"));
+    }
   } else {
     for(int i=0; i<numItems; i++) {
       QRect target(11 * i, i % 2, 25, 35);
-      painter.drawImage(target, m_im);
+      if (enabled) {
+        painter.drawImage(target, m_im);
+      } else {
+        painter.drawImage(target, m_img);
+      }
     }
   }
 }
@@ -88,9 +97,16 @@
 void ItemNum::setItemsNum(const unsigned char num)
 {
   numItems=num;
+  repaint();
 }
 
 void ItemNum::setInfinityState(bool value)
 {
   infinityState=value;
 }
+
+void ItemNum::setEnabled(bool value)
+{
+  enabled=value;
+  repaint();
+}
--- a/QTfrontend/itemNum.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/itemNum.h	Tue Nov 30 22:46:47 2010 +0100
@@ -28,15 +28,18 @@
 
   public:
     void setInfinityState(bool value);
+    void setEnabled(bool value);
     unsigned char getItemsNum() const;
     void setItemsNum(const unsigned char num);
 
   private:
     QImage m_im;
+    QImage m_img;
     bool infinityState;
+    bool enabled;
 
   protected:
-    ItemNum(const QImage& im, QWidget * parent, unsigned char min=2, unsigned char max=8);
+    ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8);
     virtual QSize sizeHint () const;
     virtual ~ItemNum()=0;
 
--- a/QTfrontend/mapContainer.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/mapContainer.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -370,7 +370,8 @@
 void HWMapContainer::setSeed(const QString & seed)
 {
     m_seed = seed;
-    changeImage();
+    if (chooseMap->currentIndex() < MAPGEN_LAST)
+        changeImage();
 }
 
 void HWMapContainer::setMap(const QString & map)
@@ -410,11 +411,11 @@
 #include <QMessageBox>
 void HWMapContainer::setRandomMap()
 {
+    setRandomSeed();
     switch(chooseMap->currentIndex())
     {
     case MAPGEN_REGULAR:
     case MAPGEN_MAZE:
-        setRandomSeed();
         setRandomTheme();
         break;
     default:
@@ -429,20 +430,21 @@
 void HWMapContainer::setRandomStatic()
 {
     chooseMap->setCurrentIndex(4 + numMissions + rand() % (chooseMap->count() - 4 - numMissions));
-    m_seed = QUuid::createUuid().toString();
+    setRandomSeed();
 }
 
 void HWMapContainer::setRandomMission()
 {
     chooseMap->setCurrentIndex(3 + rand() % numMissions);
-    m_seed = QUuid::createUuid().toString();
+    setRandomSeed();
 }
 
 void HWMapContainer::setRandomSeed()
 {
     m_seed = QUuid::createUuid().toString();
     emit seedChanged(m_seed);
-    changeImage();
+    if (chooseMap->currentIndex() < MAPGEN_LAST)
+        changeImage();
 }
 
 void HWMapContainer::setRandomTheme()
--- a/QTfrontend/pages.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/pages.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -440,17 +440,22 @@
 {
     QGridLayout * pageLayout = new QGridLayout(this);
 
-    BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
+    BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
 
     gameCFG = new GameCFGWidget(this);
     pageLayout->addWidget(gameCFG, 0, 0, 1, 2);
 
-    pageLayout->setRowStretch(1, 1);
+    QPushButton * btnSetup = new QPushButton(this);
+    btnSetup->setText(QPushButton::tr("Setup"));
+    connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
+    pageLayout->addWidget(btnSetup, 1, 0, 1, 2);
+
+    pageLayout->setRowStretch(2, 1);
 
     teamsSelect = new TeamSelWidget(this);
-    pageLayout->addWidget(teamsSelect, 0, 2, 2, 2);
+    pageLayout->addWidget(teamsSelect, 0, 2, 3, 2);
 
-    BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3);
+    BtnStartMPGame = addButton(tr("Start"), pageLayout, 3, 3);
 }
 
 PageOptions::PageOptions(QWidget* parent) :
@@ -522,45 +527,75 @@
         }
 
         {
-            // TODO: This box should contain controls for all schemes: game modes and weapons
-
             IconedGroupBox* groupWeapons = new IconedGroupBox(this);
+            
             //groupWeapons->setContentTopPadding(0);
             //groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
             groupWeapons->setIcon(QIcon(":/res/weaponsicon.png"));
             groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-            groupWeapons->setTitle(QGroupBox::tr("Weapons"));
+            groupWeapons->setTitle(QGroupBox::tr("Schemes and Weapons"));
             QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons);
 
+            QLabel* SchemeLabel = new QLabel(groupWeapons);
+            SchemeLabel->setText(QLabel::tr("Game scheme"));
+            WeaponsLayout->addWidget(SchemeLabel, 1, 0);
+
+            SchemesName = new QComboBox(groupWeapons);
+            WeaponsLayout->addWidget(SchemesName, 1, 1);
+
+            SchemeNew = new QPushButton(groupWeapons);
+            SchemeNew->setToolTip(tr("New scheme"));
+            SchemeNew->setIconSize(pmNew.size());
+            SchemeNew->setIcon(pmNew);
+            SchemeNew->setMaximumWidth(pmNew.width() + 6);
+            WeaponsLayout->addWidget(SchemeNew, 1, 2);
+
+            SchemeEdit = new QPushButton(groupWeapons);
+            SchemeEdit->setToolTip(tr("Edit scheme"));
+            SchemeEdit->setIconSize(pmEdit.size());
+            SchemeEdit->setIcon(pmEdit);
+            SchemeEdit->setMaximumWidth(pmEdit.width() + 6);
+            WeaponsLayout->addWidget(SchemeEdit, 1, 3);
+
+            SchemeDelete = new QPushButton(groupWeapons);
+            SchemeDelete->setToolTip(tr("Delete scheme"));
+            SchemeDelete->setIconSize(pmDelete.size());
+            SchemeDelete->setIcon(pmDelete);
+            SchemeDelete->setMaximumWidth(pmDelete.width() + 6);
+            SchemeDelete->setEnabled(false);
+            WeaponsLayout->addWidget(SchemeDelete, 1, 4);
+
+            QLabel* WeaponLabel = new QLabel(groupWeapons);
+            WeaponLabel->setText(QLabel::tr("Weapons"));
+            WeaponsLayout->addWidget(WeaponLabel, 2, 0);
+
             WeaponsName = new QComboBox(groupWeapons);
-            WeaponsLayout->addWidget(WeaponsName, 0, 0);
+            WeaponsLayout->addWidget(WeaponsName, 2, 1);
 
-            WeaponsButt = new QPushButton(groupWeapons);
-            WeaponsButt->setToolTip(tr("New weapon scheme"));
-            WeaponsButt->setIconSize(pmNew.size());
-            WeaponsButt->setIcon(pmNew);
-            WeaponsButt->setMaximumWidth(pmNew.width() + 6);
-            WeaponsLayout->addWidget(WeaponsButt, 0, 1);
+            WeaponNew = new QPushButton(groupWeapons);
+            WeaponNew->setToolTip(tr("New weapon set"));
+            WeaponNew->setIconSize(pmNew.size());
+            WeaponNew->setIcon(pmNew);
+            WeaponNew->setMaximumWidth(pmNew.width() + 6);
+            WeaponsLayout->addWidget(WeaponNew, 2, 2);
 
             WeaponEdit = new QPushButton(groupWeapons);
-            WeaponEdit->setToolTip(tr("Edit weapon scheme"));
+            WeaponEdit->setToolTip(tr("Edit weapon set"));
             WeaponEdit->setIconSize(pmEdit.size());
             WeaponEdit->setIcon(pmEdit);
             WeaponEdit->setMaximumWidth(pmEdit.width() + 6);
-            WeaponsLayout->addWidget(WeaponEdit, 0, 2);
+            WeaponsLayout->addWidget(WeaponEdit, 2, 3);
 
             WeaponDelete = new QPushButton(groupWeapons);
-            WeaponDelete->setToolTip(tr("Delete weapon scheme"));
+            WeaponDelete->setToolTip(tr("Delete weapon set"));
             WeaponDelete->setIconSize(pmDelete.size());
             WeaponDelete->setIcon(pmDelete);
             WeaponDelete->setMaximumWidth(pmDelete.width() + 6);
-            WeaponDelete->setEnabled(false);
-            WeaponDelete->setVisible(false); // hide for now
-            WeaponsLayout->addWidget(WeaponDelete, 0, 3);
+            WeaponsLayout->addWidget(WeaponDelete, 2, 4);
 
             WeaponTooltip = new QCheckBox(this);
             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
-            WeaponsLayout->addWidget(WeaponTooltip, 1, 0, 1, 3);
+            WeaponsLayout->addWidget(WeaponTooltip, 3, 0, 1, 4);
 
             gbTBLayout->addWidget(groupWeapons, 1, 0);
         }
@@ -730,7 +765,7 @@
             hr->setFixedHeight(10);
             GBAlayout->addWidget(hr);
 
-                QLabel *restartNote = new QLabel(this);
+            QLabel *restartNote = new QLabel(this);
             restartNote->setText(QString("* ") + QLabel::tr("Restart game to apply"));
             restartNote->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
             GBAlayout->addWidget(restartNote);
@@ -895,19 +930,24 @@
     // chatwidget
     pChatWidget = new HWChatWidget(this, gameSettings, sdli, true);
     pChatWidget->setShowReady(true); // show status bulbs by default
-    pageLayout->addWidget(pChatWidget, 1, 0, 1, 2);
+    pageLayout->addWidget(pChatWidget, 2, 0, 1, 2);
     pageLayout->setRowStretch(1, 100);
 
     pGameCFG = new GameCFGWidget(this);
     pageLayout->addWidget(pGameCFG, 0, 0);
 
+    QPushButton * btnSetup = new QPushButton(this);
+    btnSetup->setText(QPushButton::tr("Setup"));
+    connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
+    pageLayout->addWidget(btnSetup, 1, 0);
+
     pNetTeamsWidget = new TeamSelWidget(this);
     pNetTeamsWidget->setAcceptOuter(true);
-    pageLayout->addWidget(pNetTeamsWidget, 0, 1);
+    pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1);
 
 
     QHBoxLayout * bottomLayout = new QHBoxLayout;
-    pageLayout->addLayout(bottomLayout, 3, 0, 1, 2);
+    pageLayout->addLayout(bottomLayout, 4, 0, 1, 2);
 
     BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true);
 
@@ -988,7 +1028,7 @@
 
     BtnCampaignPage = addButton(":/res/Campaign.png", middleLine, 0, true);
     BtnCampaignPage->setToolTip(tr("Campaign Mode (...). IN DEVELOPMENT"));
-    BtnCampaignPage->setVisible(false);
+    //BtnCampaignPage->setVisible(false);
 
     BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 1, true);
     BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT"));
@@ -1063,18 +1103,24 @@
     QGridLayout * pageLayout = new QGridLayout(this);
 
     pWeapons = new SelWeaponWidget(cAmmoNumber, this);
-    pageLayout->addWidget(pWeapons, 0, 0, 1, 4);
+    pageLayout->addWidget(pWeapons, 0, 0, 1, 6);
 
     BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
-    BtnDefault = addButton(tr("Default"), pageLayout, 1, 1);
-    BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2);
-    BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true);
+    BtnDefault = addButton(tr("Default"), pageLayout, 1, 2);
+    BtnNew = addButton(tr("New"), pageLayout, 1, 3);
+    BtnDelete = addButton(tr("Delete"), pageLayout, 1, 4);
+    BtnSave = addButton(":/res/Save.png", pageLayout, 1, 5, true);
     BtnSave->setStyleSheet("QPushButton{margin: 24px 0px 0px 0px;}");
     BtnBack->setFixedHeight(BtnSave->height());
     BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}");
 
+    selectWeaponSet = new QComboBox(this);
+    pageLayout->addWidget(selectWeaponSet, 1, 1);
+
     connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault()));
     connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save()));
+    connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName()));
+    connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&)));
 }
 
 PageInGame::PageInGame(QWidget* parent) :
@@ -1658,105 +1704,118 @@
     glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1);
 
     l = new QLabel(gbBasicSettings);
-    l->setText(QLabel::tr("Crate Drops"));
+    l->setText(QLabel::tr("% Rope Length"));
     l->setWordWrap(true);
     glBSLayout->addWidget(l,6,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
-    l->setPixmap(QPixmap(":/res/iconBox.png"));
+    l->setPixmap(QPixmap(":/res/iconRope.png"));
     glBSLayout->addWidget(l,6,1,1,1);
-    SB_CaseProb = new FreqSpinBox(gbBasicSettings);
-    SB_CaseProb->setRange(0, 9);
-    SB_CaseProb->setValue(5);
-    glBSLayout->addWidget(SB_CaseProb,6,2,1,1);
+    SB_RopeModifier = new QSpinBox(gbBasicSettings);
+    SB_RopeModifier->setRange(25, 999);
+    SB_RopeModifier->setValue(100);
+    SB_RopeModifier->setSingleStep(25);
+    glBSLayout->addWidget(SB_RopeModifier,6,2,1,1);
 
     l = new QLabel(gbBasicSettings);
-    l->setText(QLabel::tr("% Health Crates"));
+    l->setText(QLabel::tr("Crate Drops"));
     l->setWordWrap(true);
     glBSLayout->addWidget(l,7,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
-    l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon
+    l->setPixmap(QPixmap(":/res/iconBox.png"));
     glBSLayout->addWidget(l,7,1,1,1);
-    SB_HealthCrates = new QSpinBox(gbBasicSettings);
-    SB_HealthCrates->setRange(0, 100);
-    SB_HealthCrates->setValue(35);
-    SB_HealthCrates->setSingleStep(5);
-    glBSLayout->addWidget(SB_HealthCrates,7,2,1,1);
+    SB_CaseProb = new FreqSpinBox(gbBasicSettings);
+    SB_CaseProb->setRange(0, 9);
+    SB_CaseProb->setValue(5);
+    glBSLayout->addWidget(SB_CaseProb,7,2,1,1);
 
     l = new QLabel(gbBasicSettings);
-    l->setText(QLabel::tr("Health in Crates"));
+    l->setText(QLabel::tr("% Health Crates"));
     l->setWordWrap(true);
     glBSLayout->addWidget(l,8,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon
     glBSLayout->addWidget(l,8,1,1,1);
+    SB_HealthCrates = new QSpinBox(gbBasicSettings);
+    SB_HealthCrates->setRange(0, 100);
+    SB_HealthCrates->setValue(35);
+    SB_HealthCrates->setSingleStep(5);
+    glBSLayout->addWidget(SB_HealthCrates,8,2,1,1);
+
+    l = new QLabel(gbBasicSettings);
+    l->setText(QLabel::tr("Health in Crates"));
+    l->setWordWrap(true);
+    glBSLayout->addWidget(l,9,0,1,1);
+    l = new QLabel(gbBasicSettings);
+    l->setFixedSize(32,32);
+    l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon
+    glBSLayout->addWidget(l,9,1,1,1);
     SB_CrateHealth = new QSpinBox(gbBasicSettings);
     SB_CrateHealth->setRange(0, 200);
     SB_CrateHealth->setValue(25);
     SB_CrateHealth->setSingleStep(5);
-    glBSLayout->addWidget(SB_CrateHealth,8,2,1,1);
+    glBSLayout->addWidget(SB_CrateHealth,9,2,1,1);
 
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Mines Time"));
     l->setWordWrap(true);
-    glBSLayout->addWidget(l,9,0,1,1);
+    glBSLayout->addWidget(l,10,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon
-    glBSLayout->addWidget(l,9,1,1,1);
+    glBSLayout->addWidget(l,10,1,1,1);
     SB_MinesTime = new QSpinBox(gbBasicSettings);
     SB_MinesTime->setRange(-1, 5);
     SB_MinesTime->setValue(3);
     SB_MinesTime->setSingleStep(1);
     SB_MinesTime->setSpecialValueText(tr("Random"));
     SB_MinesTime->setSuffix(" "+ tr("Seconds"));
-    glBSLayout->addWidget(SB_MinesTime,9,2,1,1);
+    glBSLayout->addWidget(SB_MinesTime,10,2,1,1);
 
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Mines"));
     l->setWordWrap(true);
-    glBSLayout->addWidget(l,10,0,1,1);
+    glBSLayout->addWidget(l,11,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon
-    glBSLayout->addWidget(l,10,1,1,1);
+    glBSLayout->addWidget(l,11,1,1,1);
     SB_Mines = new QSpinBox(gbBasicSettings);
     SB_Mines->setRange(0, 80);
     SB_Mines->setValue(0);
     SB_Mines->setSingleStep(5);
-    glBSLayout->addWidget(SB_Mines,10,2,1,1);
+    glBSLayout->addWidget(SB_Mines,11,2,1,1);
 
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("% Dud Mines"));
     l->setWordWrap(true);
-    glBSLayout->addWidget(l,11,0,1,1);
+    glBSLayout->addWidget(l,12,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconDud.png"));
-    glBSLayout->addWidget(l,11,1,1,1);
+    glBSLayout->addWidget(l,12,1,1,1);
     SB_MineDuds = new QSpinBox(gbBasicSettings);
     SB_MineDuds->setRange(0, 100);
     SB_MineDuds->setValue(0);
     SB_MineDuds->setSingleStep(5);
-    glBSLayout->addWidget(SB_MineDuds,11,2,1,1);
+    glBSLayout->addWidget(SB_MineDuds,12,2,1,1);
 
 
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Explosives"));
     l->setWordWrap(true);
-    glBSLayout->addWidget(l,12,0,1,1);
+    glBSLayout->addWidget(l,13,0,1,1);
     l = new QLabel(gbBasicSettings);
     l->setFixedSize(32,32);
     l->setPixmap(QPixmap(":/res/iconDamage.png"));
-    glBSLayout->addWidget(l,12,1,1,1);
+    glBSLayout->addWidget(l,13,1,1,1);
     SB_Explosives = new QSpinBox(gbBasicSettings);
     SB_Explosives->setRange(0, 40);
     SB_Explosives->setValue(0);
     SB_Explosives->setSingleStep(1);
-    glBSLayout->addWidget(SB_Explosives,12,2,1,1);
-
+    glBSLayout->addWidget(SB_Explosives,13,2,1,1);
 
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Scheme Name:"));
@@ -1823,6 +1882,7 @@
     mapper->addMapping(SB_CrateHealth, 34);
     mapper->addMapping(SB_WaterRise, 35);
     mapper->addMapping(SB_HealthDecrease, 36);
+    mapper->addMapping(SB_RopeModifier, 37);
 
     mapper->toFirst();
 }
@@ -1836,8 +1896,12 @@
 
 void PageScheme::deleteRow()
 {
-    QAbstractItemModel * model = mapper->model();
-    model->removeRow(selectScheme->currentIndex());
+    QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel);
+
+    if (reallyDelete.exec() == QMessageBox::Ok) {
+        QAbstractItemModel * model = mapper->model();
+        model->removeRow(selectScheme->currentIndex());
+    }
 }
 
 void PageScheme::schemeSelected(int n)
--- a/QTfrontend/pages.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/pages.h	Tue Nov 30 22:46:47 2010 +0100
@@ -196,6 +196,9 @@
     GameCFGWidget *gameCFG;
     TeamSelWidget *teamsSelect;
     QPushButton *BtnStartMPGame;
+
+signals:
+    void SetupClicked();
 };
 
 class PageOptions : public AbstractPage
@@ -205,11 +208,16 @@
 public:
     PageOptions(QWidget* parent = 0);
 
-    QPushButton *WeaponsButt;
+    QCheckBox *WeaponTooltip;
+    QPushButton *WeaponNew;
     QPushButton *WeaponEdit;
     QPushButton *WeaponDelete;
     QComboBox *WeaponsName;
-    QCheckBox *WeaponTooltip;
+    QPushButton *SchemeNew;
+    QPushButton *SchemeEdit;
+    QPushButton *SchemeDelete;
+    QComboBox *SchemesName;
+
     QComboBox *CBLanguage;
 
     QPushButton *BtnBack;
@@ -314,6 +322,9 @@
 public slots:
     void setReadyStatus(bool isReady);
     void setMasterMode(bool isMaster);
+
+signals:
+    void SetupClicked();
 };
 
 class PageInfo : public AbstractPage
@@ -379,8 +390,10 @@
     QPushButton *BtnSave;
     QPushButton *BtnDefault;
     QPushButton *BtnDelete;
+    QPushButton *BtnNew;
     QPushButton *BtnBack;
     SelWeaponWidget* pWeapons;
+    QComboBox* selectWeaponSet;
 };
 
 class PageInGame : public AbstractPage
@@ -455,9 +468,14 @@
     QPushButton * BtnNew;
     QPushButton * BtnDelete;
     QPushButton * BtnSave;
+    QComboBox * selectScheme;
 
     void setModel(QAbstractItemModel * model);
 
+public slots:
+    void newRow();
+    void deleteRow();
+
 private:
     QDataWidgetMapper * mapper;
     ToggleButtonWidget * TBW_mode_Forts;
@@ -497,16 +515,15 @@
     QSpinBox * SB_Mines;
     QSpinBox * SB_MineDuds;
     QSpinBox * SB_Explosives;
+    QSpinBox * SB_RopeModifier;
     QLineEdit * LE_name;
-    QComboBox * selectScheme;
 
     QGroupBox * gbGameModes;
     QGroupBox * gbBasicSettings;
 
 private slots:
-    void newRow();
-    void deleteRow();
     void schemeSelected(int);
+
 };
 
 class PageAdmin : public AbstractPage
--- a/QTfrontend/predefteams.h	Mon Nov 29 09:11:31 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-2010 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
- */
-
-#ifndef PREDEFTEAMS_H
-#define PREDEFTEAMS_H
-
-#include <QtGlobal>
-
-#define PREDEFTEAMS_COUNT 3
-/*
-struct PredefinedTeam
-{
-    const char * TeamName;
-    const char * hh0name;
-    const char * hh1name;
-    const char * hh2name;
-    const char * hh3name;
-    const char * hh4name;
-    const char * hh5name;
-    const char * hh6name;
-    const char * hh7name;
-    const char * hh0hat;
-    const char * hh1hat;
-    const char * hh2hat;
-    const char * hh3hat;
-    const char * hh4hat;
-    const char * hh5hat;
-    const char * hh6hat;
-    const char * hh7hat;
-    QString Grave;
-    QString Fort;
-};
-
-
-const PredefinedTeam pteams[PREDEFTEAMS_COUNT] =
-{
-    {
-        QT_TRANSLATE_NOOP("teams", "Hedgehogs"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 1"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 2"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 3"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 4"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 5"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 6"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 7"),
-        QT_TRANSLATE_NOOP("teams", "hedgehog 8"),
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "Simple", "Island"
-    },
-    {
-        QT_TRANSLATE_NOOP("teams", "Goddess"),
-        QT_TRANSLATE_NOOP("teams", "Isis"),
-        QT_TRANSLATE_NOOP("teams", "Astarte"),
-        QT_TRANSLATE_NOOP("teams", "Diana"),
-        QT_TRANSLATE_NOOP("teams", "Aphrodite"),
-        QT_TRANSLATE_NOOP("teams", "Hecate"),
-        QT_TRANSLATE_NOOP("teams", "Demeter"),
-        QT_TRANSLATE_NOOP("teams", "Kali"),
-        QT_TRANSLATE_NOOP("teams", "Inanna"),
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "Bone", "Island"
-    },
-    {
-        QT_TRANSLATE_NOOP("teams", "Fruits"),
-        QT_TRANSLATE_NOOP("teams", "Banana"),
-        QT_TRANSLATE_NOOP("teams", "Apple"),
-        QT_TRANSLATE_NOOP("teams", "Orange"),
-        QT_TRANSLATE_NOOP("teams", "Lemon"),
-        QT_TRANSLATE_NOOP("teams", "Pineapple"),
-        QT_TRANSLATE_NOOP("teams", "Mango"),
-        QT_TRANSLATE_NOOP("teams", "Peach"),
-        QT_TRANSLATE_NOOP("teams", "Plum"),
-        "banana",
-        "apple",
-        "orange",
-        "lemon",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "NoHat",
-        "coffin", "Barrelhouse"
-    }
-};
-*/
-#endif // PREDEFTEAMS_H
Binary file QTfrontend/res/ammopicboxgrey.png has changed
Binary file QTfrontend/res/ammopicdelaygrey.png has changed
Binary file QTfrontend/res/ammopicgrey.png has changed
Binary file QTfrontend/res/hh25x25grey.png has changed
Binary file QTfrontend/res/iconRope.png has changed
Binary file QTfrontend/res/infinitygrey.png has changed
Binary file QTfrontend/res/lock.png has changed
Binary file QTfrontend/res/unlock.png has changed
--- a/QTfrontend/selectWeapon.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/selectWeapon.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -40,7 +40,7 @@
     return ammo.copy(x, y, 32, 32);
 }
 
-SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QWidget* parent) :
+SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent) :
     QWidget(parent)
 {
     QHBoxLayout* hbLayout = new QHBoxLayout(this);
@@ -53,7 +53,7 @@
     lbl->setGeometry(0, 0, 30, 30);
     hbLayout->addWidget(lbl);
 
-    item = new WeaponItem(image, this);
+    item = new WeaponItem(image, imagegrey, this);
     item->setItemsNum(wNum);
     item->setInfinityState(allowInfinite);
     hbLayout->addWidget(item);
@@ -74,6 +74,11 @@
     return item->getItemsNum();
 }
 
+void SelWeaponItem::setEnabled(bool value)
+{
+    item->setEnabled(value);
+}
+
 SelWeaponWidget::SelWeaponWidget(int numItems, QWidget* parent) :
   QFrame(parent),
   m_numItems(numItems)
@@ -124,19 +129,19 @@
     for(; i < m_numItems; ++i) {
         if (i == 6) continue;
         if (k % 4 == 0) ++j;
-        SelWeaponItem * swi = new SelWeaponItem(true, i, currentState[i].digitValue(), QImage(":/res/ammopic.png"), this);
+        SelWeaponItem * swi = new SelWeaponItem(true, i, currentState[i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this);
         weaponItems[i].append(swi);
         p1Layout->addWidget(swi, j, k % 4);
 
-        SelWeaponItem * pwi = new SelWeaponItem(false, i, currentState[numItems + i].digitValue(), QImage(":/res/ammopicbox.png"), this);
+        SelWeaponItem * pwi = new SelWeaponItem(false, i, currentState[numItems + i].digitValue(), QImage(":/res/ammopicbox.png"), QImage(":/res/ammopicboxgrey.png"), this);
         weaponItems[i].append(pwi);
         p2Layout->addWidget(pwi, j, k % 4);
 
-        SelWeaponItem * dwi = new SelWeaponItem(false, i, currentState[numItems*2 + i].digitValue(), QImage(":/res/ammopicdelay.png"), this);
+        SelWeaponItem * dwi = new SelWeaponItem(false, i, currentState[numItems*2 + i].digitValue(), QImage(":/res/ammopicdelay.png"), QImage(":/res/ammopicdelaygrey.png"), this);
         weaponItems[i].append(dwi);
         p3Layout->addWidget(dwi, j, k % 4);
 
-        SelWeaponItem * awi = new SelWeaponItem(false, i, currentState[numItems*3 + i].digitValue(), QImage(":/res/ammopic.png"), this);
+        SelWeaponItem * awi = new SelWeaponItem(false, i, currentState[numItems*3 + i].digitValue(), QImage(":/res/ammopic.png"), QImage(":/res/ammopicgrey.png"), this);
         weaponItems[i].append(awi);
         p4Layout->addWidget(awi, j, k % 4);
 
@@ -150,6 +155,11 @@
 
 void SelWeaponWidget::setWeapons(const QString& ammo)
 {
+    bool enable = true;
+    for(int i = 0; i < cDefaultAmmos.size(); i++)
+        if (!cDefaultAmmos[i].first.compare(m_name->text())) {
+            enable = false;
+        }
     for(int i = 0; i < m_numItems; ++i) {
         twi::iterator it = weaponItems.find(i);
         if (it == weaponItems.end()) continue;
@@ -157,12 +167,20 @@
         it.value()[1]->setItemsNum(ammo[m_numItems + i].digitValue());
         it.value()[2]->setItemsNum(ammo[m_numItems*2 + i].digitValue());
         it.value()[3]->setItemsNum(ammo[m_numItems*3 + i].digitValue());
+        it.value()[0]->setEnabled(enable);
+        it.value()[1]->setEnabled(enable);
+        it.value()[2]->setEnabled(enable);
+        it.value()[3]->setEnabled(enable);
     }
-    update();
+    m_name->setEnabled(enable);
 }
 
 void SelWeaponWidget::setDefault()
 {
+    for(int i = 0; i < cDefaultAmmos.size(); i++)
+        if (!cDefaultAmmos[i].first.compare(m_name->text())) {
+            return;
+        }
     setWeapons(*cDefaultAmmoStore);
 }
 
@@ -215,11 +233,11 @@
 {
     if (curWeaponsName == "") return;
 
-    if (curWeaponsName == "Default") {
-        QMessageBox impossible(QMessageBox::Warning, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set"));
-        impossible.exec();
-        return;
-    }
+    for(int i = 0; i < cDefaultAmmos.size(); i++)
+        if (!cDefaultAmmos[i].first.compare(m_name->text())) {
+            QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set '%1'!").arg(cDefaultAmmos[i].first));
+            return;
+        }
 
     QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"), QMessageBox::Ok | QMessageBox::Cancel);
 
@@ -229,15 +247,22 @@
     }
 }
 
+void SelWeaponWidget::newWeaponsName()
+{
+    setWeaponsName(tr("new"));
+}
+
 void SelWeaponWidget::setWeaponsName(const QString& name)
 {
-    if(name != "" && wconf->contains(name)) {
-        setWeapons(wconf->value(name).toString());
-    }
+    m_name->setText(name);
 
     curWeaponsName = name;
 
-    m_name->setText(name);
+    if(name != "" && wconf->contains(name)) {
+        setWeapons(wconf->value(name).toString());
+    } else {
+        setWeapons(*cDefaultAmmoStore);
+    }
 }
 
 QStringList SelWeaponWidget::getWeaponNames() const
--- a/QTfrontend/selectWeapon.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/selectWeapon.h	Tue Nov 30 22:46:47 2010 +0100
@@ -33,10 +33,11 @@
   Q_OBJECT
 
 public:
-  SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QWidget* parent=0);
+  SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QImage image, QImage imagegrey, QWidget* parent=0);
 
   unsigned char getItemsNum() const;
   void setItemsNum(const unsigned char num);
+  void setEnabled(bool value);
 
  private:
   WeaponItem* item;
@@ -56,6 +57,7 @@
   void setWeapons(const QString& ammo);
   void setWeaponsName(const QString& name);
   void deleteWeaponsName();
+  void newWeaponsName();
   void save();
 
  signals:
--- a/QTfrontend/teamselect.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/teamselect.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -233,10 +233,6 @@
     p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
     addScrArea(framePlaying, p.color(QPalette::Window).light(105), 250);
     addScrArea(frameDontPlaying, p.color(QPalette::Window).dark(105), 0);
-    QPushButton * btnSetup = new QPushButton(this);
-    btnSetup->setText(QPushButton::tr("Setup"));
-    connect(btnSetup, SIGNAL(clicked()), this, SIGNAL(SetupClicked()));
-    mainLayout.addWidget(btnSetup);
 }
 
 void TeamSelWidget::setAcceptOuter(bool acceptOuter)
--- a/QTfrontend/teamselect.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/teamselect.h	Tue Nov 30 22:46:47 2010 +0100
@@ -56,7 +56,6 @@
 
  signals:
   void setEnabledGameStart(bool);
-  void SetupClicked();
   void teamWillPlay(HWTeam team);
   void teamNotPlaying(const HWTeam& team);
   void hhogsNumChanged(const HWTeam&);
--- a/QTfrontend/teamselhelper.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/teamselhelper.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -73,7 +73,7 @@
         connect(colorButt, SIGNAL(clicked()), this, SLOT(changeTeamColor()));
         mainLayout.addWidget(colorButt);
 
-        phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), this);
+        phhoger = new CHedgehogerWidget(QImage(":/res/hh25x25.png"), QImage(":/res/hh25x25grey.png"), this);
         connect(phhoger, SIGNAL(hedgehogsNumChanged()), this, SLOT(hhNumChanged()));
         phhoger->setHHNum(team.numHedgehogs);
         mainLayout.addWidget(phhoger);
--- a/QTfrontend/weaponItem.cpp	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/weaponItem.cpp	Tue Nov 30 22:46:47 2010 +0100
@@ -18,8 +18,8 @@
 
 #include "weaponItem.h"
 
-WeaponItem::WeaponItem(const QImage& im, QWidget * parent) :
-  ItemNum(im, parent, 0)
+WeaponItem::WeaponItem(const QImage& im, const QImage& img, QWidget * parent) :
+  ItemNum(im, img, parent, 0)
 {
 }
 
--- a/QTfrontend/weaponItem.h	Mon Nov 29 09:11:31 2010 +0100
+++ b/QTfrontend/weaponItem.h	Tue Nov 30 22:46:47 2010 +0100
@@ -26,7 +26,7 @@
   Q_OBJECT
 
  public:
-  WeaponItem(const QImage& im, QWidget * parent);
+  WeaponItem(const QImage& im, const QImage& img, QWidget * parent);
   virtual ~WeaponItem();
 
  signals:
--- a/hedgewars/CCHandlers.inc	Mon Nov 29 09:11:31 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,848 +0,0 @@
-(*
-* Hedgewars, a free turn based strategy game
-* Copyright (c) 2004-2010 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
-*)
-
-function CheckNoTeamOrHH: boolean;
-var bRes: boolean;
-begin
-bRes:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
-{$IFDEF DEBUGFILE}
-if bRes then
-if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil')
-                        else AddFileLog('CONSOLE: CurTeam <> nil, Gear = nil');
-{$ENDIF}
-CheckNoTeamOrHH:= bRes;
-end;
-////////////////////////////////////////////////////////////////////////////////
-procedure chQuit(var s: shortstring);
-const prevGState: TGameState = gsConfirm;
-begin
-s:= s; // avoid compiler hint
-if GameState <> gsConfirm then
-        begin
-        prevGState:= GameState;
-        GameState:= gsConfirm
-        end else
-        GameState:= prevGState
-end;
-
-procedure chConfirm(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if GameState = gsConfirm then
-    begin
-    SendIPC('Q');
-    GameState:= gsExit
-    end
-else
-    begin
-    GameState:= gsChat;
-    KeyPressChat(27);
-    KeyPressChat(47);
-    KeyPressChat(116);
-    KeyPressChat(101);
-    KeyPressChat(97);
-    KeyPressChat(109);
-    KeyPressChat(32)
-    end
-end;
-
-procedure chCheckProto(var s: shortstring);
-var i, c: LongInt;
-begin
-if isDeveloperMode then
-begin
-val(s, i, c);
-if (c <> 0) or (i = 0) then exit;
-TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true);
-TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true)
-end
-end;
-
-procedure chAddTeam(var s: shortstring);
-var Color: Longword;
-    ts, cs: shortstring;
-begin
-cs:= '';
-ts:= '';
-if isDeveloperMode then
-begin
-SplitBySpace(s, cs);
-SplitBySpace(cs, ts);
-val(cs, Color);
-TryDo(Color <> 0, 'Error: black team color', true);
-
-// color is always little endian so the mask must be constant also in big endian archs
-Color:= Color or $FF000000;
-    
-AddTeam(Color);
-CurrentTeam^.TeamName:= ts;
-CurrentTeam^.PlayerHash:= s;
-if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
-
-CurrentTeam^.voicepack:= AskForVoicepack('Default')
-end
-end;
-
-procedure chTeamLocal(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if not isDeveloperMode then exit;
-if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true);
-CurrentTeam^.ExtDriven:= true
-end;
-
-procedure chGrave(var s: shortstring);
-begin
-if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true);
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-CurrentTeam^.GraveName:= s
-end;
-
-procedure chFort(var s: shortstring);
-begin
-if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/fort"', true);
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-CurrentTeam^.FortName:= s
-end;
-
-procedure chVoicepack(var s: shortstring);
-begin
-if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/voicepack"', true);
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-CurrentTeam^.voicepack:= AskForVoicepack(s)
-end;
-
-procedure chFlag(var s: shortstring);
-begin
-if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/flag"', true);
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-CurrentTeam^.flag:= s
-end;
-
-procedure chScript(var s: shortstring);
-begin
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-ScriptLoad(s)
-end;
-
-procedure chAddHH(var id: shortstring);
-var s: shortstring;
-    Gear: PGear;
-begin
-s:= '';
-if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
-with CurrentTeam^ do
-    begin
-    SplitBySpace(id, s);
-    CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
-    val(id, CurrentHedgehog^.BotLevel);
-    Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
-    SplitBySpace(s, id);
-    val(s, Gear^.Health);
-    TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
-    PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam;
-    if (GameFlags and gfSharedAmmo) <> 0 then CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex
-    else if (GameFlags and gfPerHogAmmo) <> 0 then
-        begin
-        AddAmmoStore;
-        CurrentHedgehog^.AmmoStore:= StoreCnt - 1
-        end
-    else CurrentHedgehog^.AmmoStore:= TeamsCount - 1;
-    CurrentHedgehog^.Gear:= Gear;
-    CurrentHedgehog^.Name:= id;
-    CurrentHedgehog^.InitialHealth:= Gear^.Health;
-    CurrHedgehog:= HedgehogsNumber;
-    inc(HedgehogsNumber)
-    end
-end;
-
-procedure chSetHat(var s: shortstring);
-begin
-if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
-with CurrentTeam^ do
-    begin
-    if not CurrentHedgehog^.King then
-    if (s = '') or 
-        (((GameFlags and gfKing) <> 0) and (s = 'crown')) or
-        ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
-        CurrentHedgehog^.Hat:= 'NoHat'
-    else
-        CurrentHedgehog^.Hat:= s
-    end;
-end;
-
-procedure chSetHHCoords(var x: shortstring);
-var y: shortstring;
-    t: Longint;
-begin
-y:= '';
-if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then exit;
-SplitBySpace(x, y);
-val(x, t);
-CurrentHedgehog^.Gear^.X:= int2hwFloat(t);
-val(y, t);
-CurrentHedgehog^.Gear^.Y:= int2hwFloat(t)
-end;
-
-procedure chSetAmmoLoadout(var descr: shortstring);
-begin
-SetAmmoLoadout(descr)
-end;
-
-procedure chSetAmmoDelay(var descr: shortstring);
-begin
-SetAmmoDelay(descr)
-end;
-
-procedure chSetAmmoProbability(var descr: shortstring);
-begin
-SetAmmoProbability(descr)
-end;
-
-procedure chSetAmmoReinforcement(var descr: shortstring);
-begin
-SetAmmoReinforcement(descr)
-end;
-
-procedure chAddAmmoStore(var descr: shortstring);
-begin
-descr:= ''; // avoid compiler hint
-AddAmmoStore
-end;
-
-procedure chBind(var id: shortstring);
-var s: shortstring;
-    b: LongInt;
-begin
-s:= '';
-if CurrentTeam = nil then exit;
-SplitBySpace(id, s);
-if s[1]='"' then Delete(s, 1, 1);
-if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
-b:= KeyNameToCode(id);
-if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"', false)
-        else CurrentTeam^.Binds[b]:= s
-end;
-
-procedure chCurU_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementY:= -1;
-end;
-
-procedure chCurU_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementY:= 0;
-end;
-
-procedure chCurD_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementY:= 1;
-end;
-
-procedure chCurD_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementY:= 0;
-end;
-
-procedure chCurL_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementX:= -1;
-end;
-
-procedure chCurL_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementX:= 0;
-end;
-
-procedure chCurR_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementX:= 1;
-end;
-
-procedure chCurR_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-CursorMovementX:= 0;
-end;
-
-procedure chLeft_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('L');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmLeft
-end;
-
-procedure chLeft_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('l');
-with CurrentHedgehog^.Gear^ do
-    Message:= Message and not gmLeft
-end;
-
-procedure chRight_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('R');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmRight
-end;
-
-procedure chRight_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('r');
-with CurrentHedgehog^.Gear^ do
-    Message:= Message and not gmRight
-end;
-
-procedure chUp_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('U');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmUp
-end;
-
-procedure chUp_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('u');
-with CurrentHedgehog^.Gear^ do
-    Message:= Message and not gmUp
-end;
-
-procedure chDown_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('D');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmDown
-end;
-
-procedure chDown_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('d');
-with CurrentHedgehog^.Gear^ do
-    Message:= Message and not gmDown
-end;
-
-procedure chPrecise_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('Z');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmPrecise
-end;
-
-procedure chPrecise_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('z');
-with CurrentHedgehog^.Gear^ do
-    Message:= Message and not gmPrecise
-end;
-
-procedure chLJump(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('j');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmLJump
-end;
-
-procedure chHJump(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('J');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmHJump
-end;
-
-procedure chAttack_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    begin
-    {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
-    if ((State and gstHHDriven) <> 0) then
-        begin
-        FollowGear:= CurrentHedgehog^.Gear;
-        if not CurrentTeam^.ExtDriven then SendIPC('A');
-        Message:= Message or gmAttack
-        end
-    end
-end;
-
-procedure chAttack_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then exit;
-with CurrentHedgehog^.Gear^ do
-    begin
-    if not CurrentTeam^.ExtDriven and
-        ((Message and gmAttack) <> 0) then SendIPC('a');
-    Message:= Message and not gmAttack
-    end
-end;
-
-procedure chSwitch(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-if not CurrentTeam^.ExtDriven then SendIPC('S');
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    Message:= Message or gmSwitch
-end;
-
-procedure chNextTurn(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    TryDo(AllInactive, '/nextturn called when not all gears are inactive', true);
-
-    if not CurrentTeam^.ExtDriven then SendIPC('N');
-{$IFDEF DEBUGFILE}
-    AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));
-{$ENDIF}
-end;
-
-procedure chSay(var s: shortstring);
-begin
-SendIPC('s' + s);
-
-if copy(s, 1, 4) = '/me ' then
-    s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
-else
-    s:= #1 + UserNick + ': ' + s;
-
-AddChatString(s)
-end;
-
-procedure chTeamSay(var s: shortstring);
-begin
-SendIPC('b' + s);
-
-s:= #4 + '[Team] ' + UserNick + ': ' + s;
-
-AddChatString(s)
-end;
-
-procedure chTimer(var s: shortstring);
-begin
-if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit;
-
-if not CurrentTeam^.ExtDriven then SendIPC(s);
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    begin
-    Message:= Message or gmTimer;
-    MsgParam:= byte(s[1]) - ord('0')
-    end
-end;
-
-procedure chSlot(var s: shortstring);
-var slot: LongWord;
-begin
-if (s[0] <> #1) or CheckNoTeamOrHH then exit;
-slot:= byte(s[1]) - 49;
-if slot > cMaxSlotIndex then exit;
-if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-with CurrentHedgehog^.Gear^ do
-    begin
-    Message:= Message or gmSlot;
-    MsgParam:= slot
-    end
-end;
-
-procedure chSetWeapon(var s: shortstring);
-begin
-    if (s[0] <> #1) or CheckNoTeamOrHH then exit;
-
-    if TAmmoType(s[1]) > High(TAmmoType) then exit;
-
-    if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
-
-    with CurrentHedgehog^.Gear^ do
-    begin
-        Message:= Message or gmWeapon;
-        MsgParam:= byte(s[1]);
-    end;
-end;
-
-procedure chTaunt(var s: shortstring);
-begin
-if (s[0] <> #1) or CheckNoTeamOrHH then exit;
-
-if TWave(s[1]) > High(TWave) then exit;
-
-if not CurrentTeam^.ExtDriven then SendIPC('t' + s);
-
-with CurrentHedgehog^.Gear^ do
-    begin
-    Message:= Message or gmAnimate;
-    MsgParam:= byte(s[1])
-    end
-end;
-
-procedure chHogSay(var s: shortstring);
-var Gear: PVisualGear;
-    text: shortstring;
-begin
-text:= copy(s, 2, Length(s)-1);
-if CheckNoTeamOrHH
-or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
-    begin
-    chSay(text);
-    exit
-    end;
-
-if not CurrentTeam^.ExtDriven then SendIPC('h' + s);
-
-if byte(s[1]) < 4 then
-    begin
-    Gear:= AddVisualGear(0, 0, vgtSpeechBubble);
-    if Gear <> nil then
-    begin
-    Gear^.Hedgehog:= CurrentHedgehog;
-    Gear^.Text:= text;
-    Gear^.FrameTicks:= byte(s[1])
-    end
-    end
-else
-    begin
-    SpeechType:= byte(s[1])-3;
-    SpeechText:= text
-    end;
-
-end;
-
-procedure doPut(putX, putY: LongInt; fromAI: boolean);
-begin
-if CheckNoTeamOrHH or isPaused then exit;
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-bShowFinger:= false;
-if not CurrentTeam^.ExtDriven and bShowAmmoMenu then
-    begin
-    bSelected:= true;
-    exit
-    end;
-
-with CurrentHedgehog^.Gear^,
-    CurrentHedgehog^ do
-    if (State and gstHHChooseTarget) <> 0 then
-        begin
-        isCursorVisible:= false;
-        if not CurrentTeam^.ExtDriven then
-            begin
-            if fromAI then
-                begin
-                TargetPoint.X:= putX;
-                TargetPoint.Y:= putY
-                end else
-                begin
-                TargetPoint.X:= CursorPoint.X - WorldDx;
-                TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy;
-                end;
-            SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
-            end
-        else
-            begin
-            TargetPoint.X:= putX;
-            TargetPoint.Y:= putY
-            end;
-        {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF}
-        State:= State and not gstHHChooseTarget;
-        if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then
-            Message:= Message or gmAttack;
-        end
-    else
-        if CurrentTeam^.ExtDriven then
-            OutError('got /put while not being in choose target mode', false)
-end;
-
-procedure chPut(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    doPut(0, 0, false);
-end;
-
-procedure chCapture(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-flagMakeCapture:= true
-end;
-
-procedure chSkip(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if not CurrentTeam^.ExtDriven then SendIPC(',');
-uStats.Skipped;
-skipFlag:= true
-end;
-
-procedure chSetMap(var s: shortstring);
-begin
-if isDeveloperMode then
-begin
-Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
-InitStepsFlags:= InitStepsFlags or cifMap
-end
-end;
-
-procedure chSetTheme(var s: shortstring);
-begin
-if isDeveloperMode then
-begin
-Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s;
-InitStepsFlags:= InitStepsFlags or cifTheme
-end
-end;
-
-procedure chSetSeed(var s: shortstring);
-begin
-if isDeveloperMode then
-begin
-SetRandomSeed(s);
-cSeed:= s;
-InitStepsFlags:= InitStepsFlags or cifRandomize
-end
-end;
-
-procedure chAmmoMenu(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH then
-    bShowAmmoMenu:= true
-else
-    begin
-    with CurrentTeam^ do
-        with Hedgehogs[CurrHedgehog] do
-            begin
-            bSelected:= false;
-
-            if bShowAmmoMenu then bShowAmmoMenu:= false
-            else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or 
-                    ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or
-                    ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
-            end;
-    if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1
-    end
-end;
-
-procedure chFullScr(var s: shortstring);
-var flags: Longword = 0;
-    ico: PSDL_Surface;
-{$IFDEF DEBUGFILE}
-    buf: array[byte] of char;
-{$ENDIF}
-begin
-    s:= s; // avoid compiler hint
-    if Length(s) = 0 then cFullScreen:= not cFullScreen
-    else cFullScreen:= s = '1';
-
-{$IFDEF DEBUGFILE}
-    buf[0]:= char(0); // avoid compiler hint
-    AddFileLog('Prepare to change video parameters...');
-{$ENDIF}
-
-    flags:= SDL_OPENGL;// or SDL_RESIZABLE;
-
-    if cFullScreen then
-        flags:= flags or SDL_FULLSCREEN;
-
-{$IFDEF SDL_IMAGE_NEWER}
-    WriteToConsole('Init SDL_image... ');
-    SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true);
-    WriteLnToConsole(msgOK);
-{$ENDIF}
-    // load engine icon
-{$IFDEF DARWIN}
-    ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps);
-{$ELSE}
-    ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps);
-{$ENDIF}
-    if ico <> nil then
-    begin
-        SDL_WM_SetIcon(ico, 0);
-        SDL_FreeSurface(ico)
-    end;
-    
-    // set window caption
-    SDL_WM_SetCaption('Hedgewars', nil);
-    
-    if SDLPrimSurface <> nil then
-    begin
-{$IFDEF DEBUGFILE}
-        AddFileLog('Freeing old primary surface...');
-{$ENDIF}
-        SDL_FreeSurface(SDLPrimSurface);
-        SDLPrimSurface:= nil;
-    end;
-    
-{$IFDEF SDL13}
-    if SDLwindow = nil then
-    begin
-        SDLwindow:= SDL_CreateWindow('Hedgewars', 0, 0, cScreenWidth, cScreenHeight,
-                        SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN    
-                        {$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS{$ENDIF});     
-        SDL_CreateRenderer(SDLwindow, -1, 0);
-    end;
-    
-    SDL_SetRenderDrawColor(0, 0, 0, 255);    
-    SDL_RenderFill(nil);     
-    SDL_RenderPresent();
-{$ELSE}
-    SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
-    SDLTry(SDLPrimSurface <> nil, true);
-    PixelFormat:= SDLPrimSurface^.format;
-{$ENDIF}
-
-{$IFDEF DEBUGFILE}
-    AddFileLog('Setting up OpenGL...');
-    AddFileLog('SDL video driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))));
-{$ENDIF}
-    SetupOpenGL();
-end;
-
-procedure chVol_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-inc(cVolumeDelta, 3)
-end;
-
-procedure chVol_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-dec(cVolumeDelta, 3)
-end;
-
-procedure chFindhh(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused then exit;
-bShowFinger:= true;
-FollowGear:= CurrentHedgehog^.Gear
-end;
-
-procedure chPause(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
-if gameType <> gmtNet then
-    isPaused:= not isPaused;
-SDL_ShowCursor(ord(isPaused))
-end;
-
-procedure chRotateMask(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-if ((GameFlags and gfInvulnerable) = 0) then cTagsMask:= cTagsMasks[cTagsMask] else cTagsMask:= cTagsMasksNoHealth[cTagsMask];
-end;
-
-procedure chSpeedup_p(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-isSpeed:= true
-end;
-
-procedure chSpeedup_m(var s: shortstring);
-begin
-s:= s; // avoid compiler hint
-isSpeed:= false
-end;
-
-procedure chZoomIn(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    if ZoomValue < cMinZoomLevel then
-        ZoomValue:= ZoomValue + cZoomDelta;
-end;
-
-procedure chZoomOut(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    if ZoomValue > cMaxZoomLevel then
-        ZoomValue:= ZoomValue - cZoomDelta;
-end;
-
-procedure chZoomReset(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    ZoomValue:= cDefaultZoomLevel;
-end;
-
-procedure chChat(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    GameState:= gsChat;
-    KeyPressChat(27)
-end;
-
-procedure chHistory(var s: shortstring);
-begin
-    s:= s; // avoid compiler hint
-    uChat.showAll:= not uChat.showAll
-end;
--- a/hedgewars/CMakeLists.txt	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/CMakeLists.txt	Tue Nov 30 22:46:47 2010 +0100
@@ -11,24 +11,24 @@
 #if the headers are not installed, the newer apis won't be activated
 find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_INCLUDE_DIR})
 if(sdlmixer_h)
-	file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+")
-	string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}")
+    file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+")
+    string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}")
 
-	if(sdlmixer_version GREATER 9)
-		message(STATUS "Enabling enhanced SDL_Mixer calls")
-		set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn})
-	endif()
+    if(sdlmixer_version GREATER 9)
+        message(STATUS "Enabling enhanced SDL_Mixer calls")
+        set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn})
+    endif()
 endif()
 
 find_file(sdlimage_h SDL_image.h ${SDLIMAGE_INCLUDE_DIR})
 if(sdlimage_h)
-	file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+")
-	string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}")
+    file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+")
+    string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}")
 
-	if(sdlimage_version GREATER 7)
-		message(STATUS "Enabling enhanced SDL_Image calls")
-		set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn})
-	endif()
+    if(sdlimage_version GREATER 7)
+        message(STATUS "Enabling enhanced SDL_Image calls")
+        set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn})
+    endif()
 endif()
 
 #SOURCE AND PROGRAMS SECTION
@@ -36,86 +36,94 @@
 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
 
 set(engine_sources
-	${hwengine_project}
-	SDLh.pas
-	uAI.pas
-	uAIActions.pas
-	uAIAmmoTests.pas
-	uAIMisc.pas
-	uAmmos.pas
-	uChat.pas
-	uCollisions.pas
-	uConsole.pas
-	uConsts.pas
-	uFloat.pas
-	uGame.pas
-	uGears.pas
-	uIO.pas
-	uKeys.pas
-	uLand.pas
-	uLandGraphics.pas
-	uLandObjects.pas
-	uLandTemplates.pas
-	uLandTexture.pas
-	uLocale.pas
-	uMisc.pas
-	uMobile.pas
-	uRandom.pas
-	uScript.pas
-	adler32.pas
-	uSound.pas
-	uStats.pas
-	uStore.pas
-	uTeams.pas
-	uVisualGears.pas
-	uWorld.pas
-	CCHandlers.inc
-	GSHandlers.inc
-	VGSHandlers.inc
-	GearDrawing.inc
-	HHHandlers.inc
-	SinTable.inc
-	ArgParsers.inc
-	options.inc
-	${CMAKE_CURRENT_BINARY_DIR}/config.inc
-	)
+    ${hwengine_project}
+    SDLh.pas
+    uAI.pas
+    uAIActions.pas
+    uAIAmmoTests.pas
+    uAIMisc.pas
+    uAmmos.pas
+    uCaptions.pas
+    uChat.pas
+    uCollisions.pas
+    uCommands.pas
+    uCommandHandlers.pas
+    uConsole.pas
+    uConsts.pas
+    uDebug.pas
+    uFloat.pas
+    uGame.pas
+    uGears.pas
+    uGearsRender.pas
+    uIO.pas
+    uKeys.pas
+    uLand.pas
+    uLandGraphics.pas
+    uLandObjects.pas
+    uLandTemplates.pas
+    uLandTexture.pas
+    uLocale.pas
+    uMisc.pas
+    uMobile.pas
+    uRandom.pas
+    uRender.pas
+    uRenderUtils.pas
+    uScript.pas
+    uSinTable.pas
+    uSound.pas
+    uStats.pas
+    uStore.pas
+    uTeams.pas
+    uTextures.pas
+    uTypes.pas
+    uUtils.pas
+    uVisualGears.pas
+    uWorld.pas
+    GSHandlers.inc
+    VGSHandlers.inc
+    HHHandlers.inc
+    ArgParsers.inc
+    options.inc
+    adler32.pas
+    ${CMAKE_CURRENT_BINARY_DIR}/config.inc
+    )
 
 if(BUILD_ENGINE_LIBRARY)
-	message(STATUS "Engine will be built as library (experimental)")
-	set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
-	set(engine_sources ${hwengine_project} PascalExports.pas ${engine_sources})
-	set(pascal_compiler_flags_cmn "-dHWLIBRARY" "-k-no_order_inits" "-fPIC" ${pascal_compiler_flags_cmn})
+    message(STATUS "Engine will be built as library (experimental)")
+    set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas)
+    set(engine_sources ${hwengine_project} PascalExports.pas ${engine_sources})
+    set(pascal_compiler_flags_cmn "-dHWLIBRARY" "-k-no_order_inits" "-fPIC" ${pascal_compiler_flags_cmn})
 endif(BUILD_ENGINE_LIBRARY)
 
 
 find_program(fpc_executable ${fpc_tryexe})
 
 if(fpc_executable)
-	 exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output)
+    exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output)
 endif(fpc_executable)
 
 set(noexecstack_flags "-k-z" "-knoexecstack")
 file(WRITE ${EXECUTABLE_OUTPUT_PATH}/checkstack.pas "begin end.")
 
 exec_program(${fpc_executable} ${EXECUTABLE_OUTPUT_PATH}
-	ARGS ${noexecstack_flags} checkstack.pas
-	OUTPUT_VARIABLE noout
-	RETURN_VALUE testnoexecstack
-	)
+    ARGS ${noexecstack_flags} checkstack.pas
+    OUTPUT_VARIABLE noout
+    RETURN_VALUE testnoexecstack
+    )
 
 if(${testnoexecstack})
-	set (noexecstack_flags "")
+    set (noexecstack_flags "")
 endif(${testnoexecstack})
 
 
 if(APPLE)
-	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}")
+    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(powerpc_build)
-		set(powerpc_build "powerpc")
-	endif()
+    if(powerpc_build)
+        set(powerpc_build "powerpc")
+    endif()
 endif(APPLE)
 
 
@@ -123,19 +131,19 @@
 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
 
 if(fpc_version)
-	string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
-	string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
-	string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
-	message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}")
-	math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
+    string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" fpc_vers_major "${fpc_version}")
+    string(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" fpc_vers_minor "${fpc_version}")
+    string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" fpc_vers_patch "${fpc_version}")
+    message(STATUS "Freepascal version detected: ${fpc_vers_major}.${fpc_vers_minor}")
+    math(EXPR fpc_ver "${fpc_vers_major}*10000 + ${fpc_vers_minor}*100 + ${fpc_vers_patch}")
 
-	if(fpc_ver LESS "020200")
-		message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
-	elseif(APPLE AND x86_64_build AND fpc_ver LESS "020400")
-		message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!")
-	endif()
+    if(fpc_ver LESS "020200")
+        message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
+    elseif(APPLE AND x86_64_build AND fpc_ver LESS "020400")
+        message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications!")
+    endif()
 else()
-	message(FATAL_ERROR "No Pascal compiler found!")
+    message(FATAL_ERROR "No Pascal compiler found!")
 endif()
 
 set(pascal_compiler ${fpc_executable})
@@ -144,40 +152,40 @@
 
 #DEPENDECIES AND EXECUTABLES SECTION
 IF(NOT APPLE OR BUILD_ENGINE_LIBRARY)
-	#here is the command for standard executables or for shared library
-	add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
-		COMMAND "${pascal_compiler}"
-		ARGS ${pascal_compiler_flags}
-		MAIN_DEPENDENCY ${hwengine_project}
-		DEPENDS ${engine_sources}
-		)
+    #here is the command for standard executables or for shared library
+    add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
+        COMMAND "${pascal_compiler}"
+        ARGS ${pascal_compiler_flags}
+        MAIN_DEPENDENCY ${hwengine_project}
+        DEPENDS ${engine_sources}
+        )
 ELSE()
-	#let's build sdlmain, which is absent from the framework
-	find_package(SDL REQUIRED)
+    #let's build sdlmain, which is absent from the framework
+    find_package(SDL REQUIRED)
 
-	set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
-	include_directories(${SDL_INCLUDE_DIR})
+    set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+    include_directories(${SDL_INCLUDE_DIR})
 
-	add_library (SDLmain STATIC SDLMain.m)
+    add_library (SDLmain STATIC SDLMain.m)
 
 
-	#these are the dependencies for building a universal binary on Mac OS X
-	foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
-		set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
-		add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
-			COMMAND "${pascal_compiler}"
-			ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch}
-			MAIN_DEPENDENCY ${hwengine_project}
-			DEPENDS ${engine_sources} SDLmain lua
-			)
-		add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
-	endforeach()
+    #these are the dependencies for building a universal binary on Mac OS X
+    foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
+        set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
+        add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
+            COMMAND "${pascal_compiler}"
+            ARGS ${pascal_compiler_flags} -ohwengine.${build_arch} -P${build_arch}
+            MAIN_DEPENDENCY ${hwengine_project}
+            DEPENDS ${engine_sources} SDLmain lua
+            )
+        add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
+    endforeach()
 
-	add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine"
-		COMMAND "lipo"
-		ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine
-		DEPENDS ${lipo_args_list}
-		)
+    add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine"
+        COMMAND "lipo"
+        ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine
+        DEPENDS ${lipo_args_list}
+        )
 ENDIF()
 
 
--- a/hedgewars/GSHandlers.inc	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/GSHandlers.inc	Tue Nov 30 22:46:47 2010 +0100
@@ -78,15 +78,15 @@
             if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then
             begin
                 if (CurrentHedgehog^.Gear = gi) then
-                    PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack)
+                    PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack)
                 else
                 begin
                     if (gi^.State and gstMoving) = 0 then
                         gi^.State := gi^.State or gstLoser;
                     if d > r div 2 then
-                        PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack)
+                        PlaySound(sndNooo, gi^.Hedgehog^.Team^.voicepack)
                     else
-                        PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack);
+                        PlaySound(sndUhOh, gi^.Hedgehog^.Team^.voicepack);
                 end;
             end;
         end;
@@ -131,13 +131,13 @@
                 if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then
                     if Gear^.Kind = gtHedgehog then 
                         begin
-                        if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then
+                        if Gear^.Hedgehog^.Effects[heResurrectable] then
                             ResurrectHedgehog(Gear)
                         else
                             begin
                             Gear^.doStep := @doStepDrowningGear;
                             Gear^.State := Gear^.State and (not gstHHDriven);
-                            AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+                            AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
                             end
                         end
                     else
@@ -173,7 +173,7 @@
         CheckGearDrowning := false;
 end;
 
-procedure CheckCollision(Gear: PGear);
+procedure CheckCollision(Gear: PGear); inline;
 begin
     if TestCollisionXwithGear(Gear, hwSign(Gear^.X)) or TestCollisionYwithGear(Gear, hwSign(Gear^.Y)
        )
@@ -203,9 +203,9 @@
         if (Gear^.Invulnerable) then exit;
 
         //if _0_6 < Gear^.dY then
-        //    PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
+        //    PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack)
         //else
-        //    PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+        //    PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack);
 
         ApplyDamage(Gear, dmg, dsFall);
     end
@@ -626,8 +626,8 @@
     dec(Gear^.Timer);
     if Gear^.Timer = 0 then
     begin
-        PHedgehog(Gear^.Hedgehog)^.Gear^.Message:= PHedgehog(Gear^.Hedgehog)^.Gear^.Message and not gmAttack;
-        PHedgehog(Gear^.Hedgehog)^.Gear^.State:= PHedgehog(Gear^.Hedgehog)^.Gear^.State and not gstAttacking;
+        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);
@@ -806,7 +806,7 @@
     shell: PVisualGear;
 begin
     cArtillery := true;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNotKickable;
     HedgehogChAngle(HHGear);
     if not cLaserSighting then
@@ -899,7 +899,7 @@
     HHGear: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     dec(Gear^.Timer);
     if (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) =
        0) then
@@ -973,7 +973,7 @@
     HHGear: PGear;
 begin
     i := 0;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     y := hwRound(Gear^.Y) - cHHRadius * 2;
     while y < hwRound(Gear^.Y) do
@@ -1005,7 +1005,7 @@
 begin
     AllInactive := false;
     dec(Gear^.Timer);
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     HedgehogChAngle(HHGear);
 
@@ -1087,7 +1087,7 @@
 begin
     BTPrevAngle := High(LongInt);
     BTSteps := 0;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := 0;
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepBlowTorchWork
@@ -1102,14 +1102,14 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     if ((HHGear^.State and gstHHDriven) = 0)
        or (CheckGearDrowning(HHGear))
        or TestCollisionYwithGear(HHGear, 1) then
     begin
         DeleteGear(Gear);
         isCursorVisible := false;
-        ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
         exit
     end;
 
@@ -1128,11 +1128,11 @@
         Gear^.X := HHGear^.X;
         Gear^.Y := HHGear^.Y;
 
-        ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope);
+        ApplyAngleBounds(Gear^.Hedgehog^, amRope);
 
         Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX);
         Gear^.dY := -AngleCos(HHGear^.Angle);
-        Gear^.Friction := _450;
+        Gear^.Friction := _450 * _0_01 * cRopePercent;
         Gear^.Elasticity := _0;
         Gear^.State := Gear^.State and not gsttmpflag;
         Gear^.doStep := @doStepRope;
@@ -1170,7 +1170,7 @@
 end;
 
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     if ((HHGear^.State and gstHHDriven) = 0)
        or (CheckGearDrowning(HHGear)) then
@@ -1240,7 +1240,7 @@
         begin
         lx := hwRound(nx);
         ly := hwRound(ny);
-        if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then
+        if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and ((Land[ly, lx] and $FF00) <> 0) then
             begin
             ny := _1 / Distance(ropeDx, ropeDy);
             // old rope pos
@@ -1330,10 +1330,37 @@
         HHGear^.dY := HHGear^.dY * len;
         end;
 
-
-    if (Gear^.Message and gmAttack) <> 0 then
+    haveCollision:= false;
+    if RopePoints.Count > 0 then
+        begin
+        ly:= hwRound(RopePoints.ar[0].Y);
+        lx:= hwRound(RopePoints.ar[0].X)
+        end
+    else if Gear^.Elasticity.QWordValue > 0 then
+        begin
+        ly:= hwRound(Gear^.Y);
+        lx:= hwRound(Gear^.X)
+        end;
+(* // just in case it turns out we have rounding problems
+    i:= -1;
+    while not haveCollision and (i < 2) do
+        begin
+        j:= -1;
+        while not haveCollision and (j < 2) do
+            begin
+            haveCollision:= ((((ly + i) and LAND_HEIGHT_MASK) = 0) and 
+                            (((lx + j) and LAND_WIDTH_MASK) = 0) and 
+                            ((Land[ly + i, lx + j] and $FF00) <> 0));
+            inc(j)
+            end;
+        inc(i)
+        end; *)
+    if ((Gear^.Message and gmAttack) <> 0) or
+           (((ly and LAND_HEIGHT_MASK) = 0) and 
+           ((lx and LAND_WIDTH_MASK) = 0) and 
+           ((Land[ly, lx] and $FF00) = 0)) then
         if (Gear^.State and gsttmpFlag) <> 0 then
-            with PHedgehog(Gear^.Hedgehog)^ do
+            with Gear^.Hedgehog^ do
                 begin
                 PlaySound(sndRopeRelease);
                 if CurAmmoType <> amParachute then
@@ -1356,10 +1383,10 @@
 begin
     if (Gear^.State and gstAttacked) = 0 then
     begin
-        OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
+        OnUsedAmmo(HHGear^.Hedgehog^);
         Gear^.State := Gear^.State or gstAttacked
     end;
-    ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^)
+    ApplyAmmoChanges(HHGear^.Hedgehog^)
 end;
 
 begin
@@ -1367,7 +1394,7 @@
     Gear^.Y := Gear^.Y - Gear^.dY;
     Gear^.Elasticity := Gear^.Elasticity + _1;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     DeleteCI(HHGear);
 
     if (HHGear^.State and gstMoving) <> 0 then
@@ -1397,8 +1424,7 @@
         ty := _0;
         while tt > _20 do
             begin
-            if  TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX))
-               or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then
+            if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)] and $FF00) <> 0) then
                 begin
                 Gear^.X := Gear^.X + tx;
                 Gear^.Y := Gear^.Y + ty;
@@ -1422,7 +1448,9 @@
             end;
         end;
 
-    CheckCollision(Gear);
+    if ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) <> 0) then
+        Gear^.State:= Gear^.State or gstCollision
+    else Gear^.State:= Gear^.State and not gstCollision;
 
     if (Gear^.State and gstCollision) <> 0 then
         if Gear^.Elasticity < _10 then
@@ -1447,7 +1475,7 @@
        or ((HHGear^.State and gstHHDriven) = 0)
        or (HHGear^.Damage > 0) then
         begin
-        with PHedgehog(Gear^.Hedgehog)^.Gear^ do
+        with Gear^.Hedgehog^.Gear^ do
             begin
             State := State and not gstAttacking;
             Message := Message and not gmAttack
@@ -1808,7 +1836,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
@@ -1825,7 +1853,7 @@
     HHGear: PGear;
     i: LongInt;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
@@ -1978,7 +2006,7 @@
         exit
     end;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then
     begin
         Gear^.Tag := hwRound(HHGear^.Y);
@@ -2008,7 +2036,7 @@
     HHGear: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     DeleteCI(HHGear);
     HHGear^.X := int2hwFloat(hwRound(HHGear^.X)) - _0_5;
     HHGear^.dX := SignAs(cLittle, Gear^.dX);
@@ -2021,7 +2049,7 @@
     Gear^.doStep := @doStepFirePunchWork;
     DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5);
 
-    PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), PHedgehog(HHGear^.Hedgehog)^.Team^.
+    PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^.
     voicepack)
 end;
 
@@ -2031,7 +2059,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     inc(Gear^.Timer);
 
@@ -2049,7 +2077,7 @@
         end;
         DeleteGear(Gear);
         isCursorVisible := false;
-        ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
         exit
     end;
 
@@ -2070,7 +2098,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     DeleteCI(HHGear);
 
@@ -2167,7 +2195,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     tx := int2hwFloat(TargetPoint.X);
     ty := int2hwFloat(TargetPoint.Y);
     x := HHGear^.X;
@@ -2202,8 +2230,8 @@
 var 
     HHGear: PGear;
 begin
-    PHedgehog(Gear^.Hedgehog)^.Unplaced := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    Gear^.Hedgehog^.Unplaced := false;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Y := HHGear^.Y + HHGear^.dY;
     // hedgehog falling to collect cases
     HHGear^.dY := HHGear^.dY + cGravity;
@@ -2233,7 +2261,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
        TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
        sprHHTelepMask, 0, false) then
@@ -2275,14 +2303,14 @@
 
     if ((Gear^.Message and not gmSwitch) <> 0) or (TurnTimeLeft = 0) then
     begin
-        HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+        HHGear := Gear^.Hedgehog^.Gear;
         Msg := Gear^.Message and not gmSwitch;
         DeleteGear(Gear);
-        OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
-        ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
+        OnUsedAmmo(HHGear^.Hedgehog^);
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
 
         HHGear := CurrentHedgehog^.Gear;
-        ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
         HHGear^.Message := Msg;
         exit
     end;
@@ -2326,7 +2354,7 @@
 begin
     Gear^.doStep := @doStepSwitcherWork;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     with HHGear^ do
     begin
         State := State and not gstAttacking;
@@ -2377,7 +2405,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.State := HHGear^.State or gstNoDamage;
     DeleteCI(HHGear);
 
@@ -2437,7 +2465,7 @@
     if Gear^.Timer = 0 then
     begin
         Gear^.Pos := 1;
-        PlaySound(sndKamikaze, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+        PlaySound(sndKamikaze, Gear^.Hedgehog^.Team^.voicepack);
         Gear^.doStep := @doStepKamikazeWork
     end
 end;
@@ -2448,7 +2476,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     HHGear^.dX := Gear^.dX;
     HHGear^.dY := Gear^.dY;
@@ -2637,7 +2665,7 @@
 begin
     AllInactive := false;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and (not gmAttack);
     DeleteCI(HHGear);
     Gear^.IntersectGear:= nil;
@@ -2687,7 +2715,7 @@
         Gear^.Timer := 0;
         inc(Gear^.Pos);
         if Gear^.Pos = 5 then
-            PlaySound(sndYoohoo, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
+            PlaySound(sndYoohoo, Gear^.Hedgehog^.Team^.voicepack)
     end;
 
     if Gear^.Pos = 14 then
@@ -2697,7 +2725,7 @@
 procedure doStepSeduction(Gear: PGear);
 begin
     AllInactive := false;
-    DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear);
+    DeleteCI(Gear^.Hedgehog^.Gear);
     Gear^.doStep := @doStepSeductionWear
 end;
 
@@ -2836,7 +2864,7 @@
 begin
     AllInactive := false;
     dec(Gear^.Timer);
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HedgehogChAngle(HHGear);
     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
@@ -2864,7 +2892,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and not (gmUp or gmDown);
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepBallgunWork
@@ -2889,7 +2917,7 @@
     if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and (
        TimeTrialStartTime = 0) then TimeTrialStartTime := RealTicks;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     FollowGear := Gear;
 
     fChanged := false;
@@ -3025,7 +3053,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := 0;
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.Angle := HHGear^.Angle;
@@ -3045,7 +3073,7 @@
     isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
     if Gear^.Pos > 0 then dec(Gear^.Pos);
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     //dec(Gear^.Timer);
     move := _0_2;
     fuel := 50;
@@ -3152,7 +3180,7 @@
             end;
         DeleteGear(Gear);
         isCursorVisible := false;
-        ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
         //    if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
 
 //    Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
@@ -3169,7 +3197,7 @@
     Gear^.Pos:= 0;
     Gear^.doStep := @doStepJetpackWork;
 
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     FollowGear := HHGear;
     AfterAttack;
     with HHGear^ do
@@ -3427,7 +3455,7 @@
     // destroy portal if ground it was attached too is gone
     if ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) = 0)
        or (Gear^.Timer < 1)
-       or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog)
+       or (Gear^.Hedgehog <> CurrentHedgehog)
        or (hwRound(Gear^.Y) > cWaterLine) then
     begin
         deleteGear(Gear);
@@ -3754,7 +3782,7 @@
     doPortalColorSwitch();
     doStepPerPixel(Gear, @doStepMovingPortal_real, true);
     if (Gear^.Timer < 1)
-       or (PHedgehog(Gear^.Hedgehog) <> CurrentHedgehog) then
+       or (Gear^.Hedgehog <> CurrentHedgehog) then
             deleteGear(Gear);
 end;
 
@@ -4047,7 +4075,7 @@
     Fire: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HedgehogChAngle(HHGear);
     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
@@ -4111,7 +4139,7 @@
 var 
     HHGear: PGear;
 begin
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight);
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepFlamethrowerWork
@@ -4140,7 +4168,7 @@
          t: PGearArray;
          i: LongInt;
 begin
-HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+HHGear:= Gear^.Hedgehog^.Gear;
 HHGear^.State:= HHGear^.State or gstNoDamage;
 DeleteCI(HHGear);
 
@@ -4181,7 +4209,7 @@
     HHGear: PGear;
 begin
     AllInactive := false;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     dec(Gear^.Timer);
     if (HHGear = nil) or (Gear^.Timer = 0) or ((Gear^.Message and gmDestroy) <> 0) then
     begin
@@ -4234,7 +4262,7 @@
     HHGear: PGear;
 begin
     i := 0;
-    HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
 
     y := hwRound(Gear^.Y) - cHHRadius * 2;
     while y < hwRound(Gear^.Y) do
@@ -4265,9 +4293,12 @@
         dec(TurnTimeLeft);
 
     AllInactive := false;
-    hh := PHedgehog(Gear^.Hedgehog);
-    DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy -
+    hh := Gear^.Hedgehog;
+
+    // no, you can't do that here
+    {DrawCentered(hwRound(hh^.Gear^.X) + WorldDx, hwRound(hh^.Gear^.Y) + WorldDy -
             cHHRadius - 14 - hh^.HealthTagTex^.h, hh^.HealthTagTex);
+    }
     (*DrawCircle(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, 1.5, 0, 0, $FF,
             $FF);*)
 
@@ -4321,13 +4352,13 @@
                 resgear^.Health := graves[i]^.Health;
                 PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear;
                 DeleteGear(graves[i]);
-                RenderHealth(PHedgehog(resgear^.Hedgehog)^);
-                RecountTeamHealth(Phedgehog(resgear^.Hedgehog)^.Team);
-                PHedgehog(resgear^.Hedgehog)^.Effects[heResurrected]:= true;
-                if PHedgehog(resgear^.Hedgehog)^.Hat = 'NoHat' then
+                RenderHealth(resgear^.Hedgehog^);
+                RecountTeamHealth(resgear^.Hedgehog^.Team);
+                resgear^.Hedgehog^.Effects[heResurrected]:= true;
+                if resgear^.Hedgehog^.Hat = 'NoHat' then
                     begin
-                    FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex);
-                    PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex(
+                    FreeTexture(resgear^.Hedgehog^.HatTex);
+                    resgear^.Hedgehog^.HatTex := Surface2Tex(
                         LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone),
                         True)
                     end
--- a/hedgewars/GearDrawing.inc	Mon Nov 29 09:11:31 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,854 +0,0 @@
-procedure DrawHH(Gear: PGear; ox, oy: LongInt);
-var i, t: LongInt;
-    amt: TAmmoType;
-    sign, hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
-    dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real;  // laser, change
-    defaultPos, HatVisible: boolean;
-    HH: PHedgehog;
-    CurWeapon: PAmmo;
-begin
-HH:= PHedgehog(Gear^.Hedgehog);
-if HH^.Unplaced then exit;
-m:= 1;
-if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1;
-sx:= ox + 1; // this offset is very common
-sy:= oy - 3;
-sign:= hwSign(Gear^.dX);
-
-if (Gear^.State and gstHHDeath) <> 0 then
-    begin
-    DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos);
-    Tint(HH^.Team^.Clan^.Color);
-    DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos + 8);
-    Tint($FF, $FF, $FF, $FF);
-    exit
-    end
-else if (Gear^.State and gstHHGone) <> 0 then
-    begin
-    DrawRotatedF(sprTeleport, sx, sy, Gear^.Pos, sign, 0);
-    exit
-    end;
-
-defaultPos:= true;
-HatVisible:= false;
-
-
-if HH^.Effects[hePoisoned] then
-    begin
-    Tint($00, $FF, $40, $40);
-    DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360);
-    Tint($FF, $FF, $FF, $FF)
-    end;
-
-if ((Gear^.State and gstWinner) <> 0) and
-   ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then
-    begin
-    DrawHedgehog(sx, sy,
-            sign,
-            2,
-            0,
-            0);
-    defaultPos:= false
-    end;
-if (Gear^.State and gstDrowning) <> 0 then
-    begin
-    DrawHedgehog(sx, sy,
-            sign,
-            1,
-            7,
-            0);
-    defaultPos:= false
-    end else
-if (Gear^.State and gstLoser) <> 0 then
-    begin
-    DrawHedgehog(sx, sy,
-            sign,
-            2,
-            3,
-            0);
-    defaultPos:= false
-    end else
-
-if (Gear^.State and gstHHDriven) <> 0 then
-    begin
-    if ((Gear^.State and gstHHThinking) = 0) and
-       (ShowCrosshair  or ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtRope))) and
-       ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then
-        begin
-(* These calculations are a little complex for a few reasons:
-   1: I need to draw the laser from weapon origin to nearest land
-   2: I need to start the beam outside the hedgie for attractiveness.
-   3: I need to extend the beam beyond land.
-   This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
-*)
-        dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle);
-        dy:= -Cos(Gear^.Angle * pi / cMaxAngle);
-        if cLaserSighting then
-            begin
-            lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle);
-            ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle);
-
-            // ensure we start outside the hedgehog (he's solid after all)
-            while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do
-                begin
-                lx:= lx + dx;
-                ly:= ly + dy
-                end;
-
-            // add hog's position
-            lx:= lx + ox - WorldDx;
-            ly:= ly + oy - WorldDy;
-
-            // decrease number of iterations required
-            ax:= dx * 4;
-            ay:= dy * 4;
-
-            tx:= round(lx);
-            ty:= round(ly);
-            hx:= tx;
-            hy:= ty;
-            while ((ty and LAND_HEIGHT_MASK) = 0) and
-                ((tx and LAND_WIDTH_MASK) = 0) and
-                (Land[ty, tx] = 0) do // TODO: check for constant variable instead
-                begin
-                lx:= lx + ax;
-                ly:= ly + ay;
-                tx:= round(lx);
-                ty:= round(ly)
-                end;
-            // reached edge of land. assume infinite beam. Extend it way out past camera
-            if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then
-                begin
-                tx:= round(lx + ax * (LAND_WIDTH div 4));
-                ty:= round(ly + ay * (LAND_WIDTH div 4));
-                end;
-
-            //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then
-                begin
-                DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0);
-                end;
-            end;
-        // draw crosshair
-        cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
-        cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
-        DrawRotatedTex(HH^.Team^.CrosshairTex,
-                12, 12, cx + WorldDx, cy + WorldDy, 0,
-                sign * (Gear^.Angle * 180.0) / cMaxAngle);
-        end;
-    hx:= ox + 8 * sign;
-    hy:= oy - 2;
-    aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
-    if CurAmmoGear <> nil then
-    begin
-        case CurAmmoGear^.Kind of
-            gtShotgunShot: begin
-                    if (CurAmmoGear^.State and gstAnimation <> 0) then
-                        DrawRotated(sprShotgun, hx, hy, sign, aangle)
-                    else
-                        DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
-                end;
-            gtDEagleShot: DrawRotated(sprDEagle, hx, hy, sign, aangle);
-            gtSniperRifleShot: begin
-                    if (CurAmmoGear^.State and gstAnimation <> 0) then
-                        DrawRotatedF(sprSniperRifle, hx, hy, 1, sign, aangle)
-                    else
-                        DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle)
-                end;
-            gtBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
-            gtRCPlane: begin
-                DrawRotated(sprHandPlane, hx, hy, sign, 0);
-                defaultPos:= false
-                end;
-            gtRope: begin
-                if Gear^.X < CurAmmoGear^.X then
-                    begin
-                    dAngle:= 0;
-                    hAngle:= 180;
-                    i:= 1
-                    end else
-                    begin
-                    dAngle:= 180;
-                    hAngle:= 0;
-                    i:= -1
-                    end;
-               if ((Gear^.State and gstWinner) = 0) then
-                   begin
-                   DrawHedgehog(ox, oy,
-                           i,
-                           1,
-                           0,
-                           DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
-                   with HH^ do
-                       if (HatTex <> nil) then
-                           begin
-                           DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
-                               i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
-                           if HatTex^.w > 64 then
-                               begin
-                               Tint(HH^.Team^.Clan^.Color);
-                               DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
-                                   i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
-                               Tint($FF, $FF, $FF, $FF)
-                               end
-                           end
-                   end;
-                DrawAltWeapon(Gear, ox, oy);
-                defaultPos:= false
-                end;
-            gtBlowTorch: begin
-                DrawRotated(sprBlowTorch, hx, hy, sign, aangle);
-                DrawHedgehog(sx, sy,
-                        sign,
-                        3,
-                        HH^.visStepPos div 2,
-                        0);
-                with HH^ do
-                    if (HatTex <> nil) then
-                        begin
-                        DrawTextureF(HatTex,
-                            1,
-                            sx,
-                            sy - 5,
-                            0,
-                            sign,
-                            32,
-                            32);
-                        if HatTex^.w > 64 then
-                            begin
-                            Tint(HH^.Team^.Clan^.Color);
-                            DrawTextureF(HatTex,
-                                1,
-                                sx,
-                                sy - 5,
-                                32,
-                                sign,
-                                32,
-                                32);
-                            Tint($FF, $FF, $FF, $FF)
-                            end
-                        end;
-                defaultPos:= false
-                end;
-            gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180);
-            gtFirePunch: begin
-                DrawHedgehog(sx, sy,
-                        sign,
-                        1,
-                        4,
-                        0);
-                defaultPos:= false
-                end;
-            gtPickHammer: begin
-                defaultPos:= false;
-                dec(sy,20);
-                end;
-            gtTeleport: defaultPos:= false;
-            gtWhip: begin
-                DrawRotatedF(sprWhip,
-                        sx,
-                        sy,
-                        1,
-                        sign,
-                        0);
-                defaultPos:= false
-                end;
-            gtHammer: begin
-                DrawRotatedF(sprHammer,
-                        sx,
-                        sy,
-                        1,
-                        sign,
-                        0);
-                defaultPos:= false
-                end;
-            gtResurrector: begin
-                DrawRotated(sprHandResurrector, sx, sy, 0, 0); 
-                defaultPos:= false
-                end;
-            gtKamikaze: begin
-                if CurAmmoGear^.Pos = 0 then
-                    DrawHedgehog(sx, sy,
-                            sign,
-                            1,
-                            6,
-                            0)
-                else
-                    DrawRotatedF(sprKamikaze,
-                            ox, oy,
-                            CurAmmoGear^.Pos - 1,
-                            sign,
-                            aangle);
-                defaultPos:= false
-                end;
-            gtSeduction: begin
-                if CurAmmoGear^.Pos >= 6 then
-                    DrawHedgehog(sx, sy,
-                            sign,
-                            2,
-                            2,
-                            0)
-                else
-                    begin
-                    DrawRotatedF(sprDress,
-                            ox, oy,
-                            CurAmmoGear^.Pos,
-                            sign,
-                            0);
-                    DrawSprite(sprCensored, ox - 32, oy - 20, 0)
-                    end;
-                defaultPos:= false
-                end;
-            gtFlamethrower: begin
-                DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
-                if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
-                end;
-        end;
-
-        case CurAmmoGear^.Kind of
-            gtShotgunShot,
-            gtDEagleShot,
-            gtSniperRifleShot,
-            gtShover: begin
-                DrawHedgehog(sx, sy,
-                        sign,
-                        0,
-                        4,
-                        0);
-                defaultPos:= false;
-                HatVisible:= true
-            end
-        end
-    end else
-
-    if ((Gear^.State and gstHHJumping) <> 0) then
-    begin
-    DrawHedgehog(sx, sy,
-        sign*m,
-        1,
-        1,
-        0);
-    HatVisible:= true;
-    defaultPos:= false
-    end else
-
-    if (Gear^.Message and (gmLeft or gmRight) <> 0) and (not isCursorVisible) then
-        begin
-        DrawHedgehog(sx, sy,
-            sign,
-            0,
-            HH^.visStepPos div 2,
-            0);
-        defaultPos:= false;
-        HatVisible:= true
-        end
-    else
-
-    if ((Gear^.State and gstAnimation) <> 0) then
-        begin
-        if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then
-            begin
-            Gear^.State:= Gear^.State and not gstAnimation;
-            end
-        else
-            begin
-            DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite,
-                    sx,
-                    sy,
-                    Gear^.Pos,
-                    sign,
-                    0.0);
-            defaultPos:= false
-            end
-        end
-    else
-    if ((Gear^.State and gstAttacked) = 0) then
-        begin
-        if HH^.Timer > 0 then
-            begin
-            // There must be a tidier way to do this. Anyone?
-            if aangle <= 90 then aangle:= aangle+360;
-            if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10)
-            else aangle:= aangle+((240-aangle)*HH^.Timer/10);
-            dec(HH^.Timer)
-            end;
-        amt:= CurrentHedgehog^.CurAmmoType;
-        CurWeapon:= GetAmmoEntry(HH^);
-        case amt of
-            amBazooka: DrawRotated(sprHandBazooka, hx, hy, sign, aangle);
-            amMortar: DrawRotated(sprHandMortar, hx, hy, sign, aangle);
-            amMolotov: DrawRotated(sprHandMolotov, hx, hy, sign, aangle);
-            amBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
-            amDrill: DrawRotated(sprHandDrill, hx, hy, sign, aangle);
-            amRope: DrawRotated(sprHandRope, hx, hy, sign, aangle);
-            amShotgun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
-            amDEagle: DrawRotated(sprHandDEagle, hx, hy, sign, aangle);
-            amSineGun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
-            amPortalGun: if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer?
-                            DrawRotatedF(sprPortalGun, hx, hy, 0, sign, aangle)
-                      else
-                            DrawRotatedF(sprPortalGun, hx, hy, 1+(CurWeapon^.Timer and 1), sign, aangle);
-            amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle);
-            amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, sign, aangle);
-            amCake: DrawRotated(sprHandCake, hx, hy, sign, aangle);
-            amGrenade: DrawRotated(sprHandGrenade, hx, hy, sign, aangle);
-            amWatermelon: DrawRotated(sprHandMelon, hx, hy, sign, aangle);
-            amSkip: DrawRotated(sprHandSkip, hx, hy, sign, aangle);
-            amClusterBomb: DrawRotated(sprHandCluster, hx, hy, sign, aangle);
-            amDynamite: DrawRotated(sprHandDynamite, hx, hy, sign, aangle);
-            amHellishBomb: DrawRotated(sprHandHellish, hx, hy, sign, aangle);
-            amGasBomb: DrawRotated(sprHandCheese, hx, hy, sign, aangle);
-            amMine: DrawRotated(sprHandMine, hx, hy, sign, aangle);
-            amSMine: DrawRotated(sprHandSMine, hx, hy, sign, aangle);
-            amSeduction: DrawRotated(sprHandSeduction, hx, hy, sign, aangle);
-            amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
-            amRCPlane: begin
-                DrawRotated(sprHandPlane, hx, hy, sign, 0);
-                defaultPos:= false
-                end;
-            amGirder: begin
-                DrawRotated(sprHandConstruction, hx, hy, sign, aangle);
-                DrawSpriteClipped(sprGirder,
-                                  ox-256,
-                                  oy-256,
-                                  LongInt(topY)+WorldDy,
-                                  LongInt(rightX)+WorldDx,
-                                  cWaterLine+WorldDy,
-                                  LongInt(leftX)+WorldDx)
-                end;
-            amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
-            amFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
-            amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here
-        end;
-
-        case amt of
-            amAirAttack,
-            amMineStrike,
-            amDrillStrike: DrawRotated(sprHandAirAttack, sx, oy, sign, 0);
-            amPickHammer: DrawHedgehog(sx, sy,
-                        sign,
-                        1,
-                        2,
-                        0);
-            amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, sign, 0);
-            amKamikaze: DrawHedgehog(sx, sy,
-                        sign,
-                        1,
-                        5,
-                        0);
-            amWhip: DrawRotatedF(sprWhip,
-                        sx,
-                        sy,
-                        0,
-                        sign,
-                        0);
-            amHammer: DrawRotatedF(sprHammer,
-                        sx,
-                        sy,
-                        0,
-                        sign,
-                        0);
-        else
-            DrawHedgehog(sx, sy,
-                sign,
-                0,
-                4,
-                0);
-
-            HatVisible:= true;
-            (* with HH^ do
-                if (HatTex <> nil)
-                and (HatVisibility > 0) then
-                    DrawTextureF(HatTex,
-                        HatVisibility,
-                        sx,
-                        sy - 5,
-                        0,
-                        sign,
-                        32,
-                        32); *)
-        end;
-
-        case amt of
-            amBaseballBat: DrawRotated(sprHandBaseball,
-                    sx - 4 * sign,
-                    sy + 9, sign, aangle);
-        end;
-
-        defaultPos:= false
-    end;
-
-end else // not gstHHDriven
-    begin
-    if (Gear^.Damage > 0)
-    and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
-        begin
-        DrawHedgehog(sx, sy,
-            sign,
-            2,
-            1,
-            Gear^.DirAngle);
-        defaultPos:= false
-        end else
-
-    if ((Gear^.State and gstHHJumping) <> 0) then
-        begin
-        DrawHedgehog(sx, sy,
-            sign*m,
-            1,
-            1,
-            0);
-        defaultPos:= false
-        end;
-    end;
-
-with HH^ do
-    begin
-    if defaultPos then
-        begin
-        DrawRotatedF(sprHHIdle,
-            sx,
-            sy,
-            (RealTicks div 128 + Gear^.Pos) mod 19,
-            sign,
-            0);
-        HatVisible:= true;
-        end;
-
-    if HatVisible then
-        if HatVisibility < 1.0 then
-            HatVisibility:= HatVisibility + 0.2
-        else
-    else
-        if HatVisibility > 0.0 then
-            HatVisibility:= HatVisibility - 0.2;
-
-    if (HatTex <> nil)
-    and (HatVisibility > 0) then
-        if DefaultPos then
-            begin
-            DrawTextureF(HatTex,
-                HatVisibility,
-                sx,
-                sy - 5,
-                (RealTicks div 128 + Gear^.Pos) mod 19,
-                sign,
-                32,
-                32);
-            if HatTex^.w > 64 then
-                begin
-                Tint(HH^.Team^.Clan^.Color);
-                DrawTextureF(HatTex,
-                    HatVisibility,
-                    sx,
-                    sy - 5,
-                    (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
-                    sign,
-                    32,
-                    32);
-                Tint($FF, $FF, $FF, $FF)
-                end
-            end
-        else
-            begin
-            DrawTextureF(HatTex,
-                HatVisibility,
-                sx,
-                sy - 5,
-                0,
-                sign*m,
-                32,
-                32);
-            if HatTex^.w > 64 then
-                begin
-                Tint(HH^.Team^.Clan^.Color);
-                DrawTextureF(HatTex,
-                    HatVisibility,
-                    sx,
-                    sy - 5,
-                    32,
-                    sign*m,
-                    32,
-                    32);
-                Tint($FF, $FF, $FF, $FF)
-                end
-            end
-    end;
-if (Gear^.State and gstHHDriven) <> 0 then
-    begin
-(*    if (CurAmmoGear = nil) then
-        begin
-        amt:= CurrentHedgehog^.CurAmmoType;
-        case amt of
-            amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0);
-            end
-        end; *)
-    if CurAmmoGear <> nil then
-        begin
-        case CurAmmoGear^.Kind of
-            gtJetpack: begin
-                       DrawSprite(sprJetpack, sx-32, sy-32, 0);
-                       if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then
-                           begin
-                           if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1);
-                           if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2);
-                           if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3)
-                           end;
-                       if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex);
-                       DrawAltWeapon(Gear, sx, sy)
-                       end;
-            end;
-        end
-    end;
-
-with HH^ do
-    begin
-    if ((Gear^.State and not gstWinner) = 0)
-        or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0))
-        or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then
-        begin
-        t:= sy - cHHRadius - 9;
-        if (cTagsMask and htTransparent) <> 0 then
-            Tint($FF, $FF, $FF, $80);
-        if ((cTagsMask and htHealth) <> 0) then
-            begin
-            dec(t, HealthTagTex^.h + 2);
-            DrawCentered(ox, t, HealthTagTex)
-            end;
-        if (cTagsMask and htName) <> 0 then
-            begin
-            dec(t, NameTagTex^.h + 2);
-            DrawCentered(ox, t, NameTagTex)
-            end;
-        if (cTagsMask and htTeamName) <> 0 then
-            begin
-            dec(t, Team^.NameTagTex^.h + 2);
-            DrawCentered(ox, t, Team^.NameTagTex)
-            end;
-        if (cTagsMask and htTransparent) <> 0 then
-            Tint($FF, $FF, $FF, $FF)
-        end;
-    if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog
-        begin
-        if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
-            DrawSprite(sprFinger, ox - 16, oy - 64,
-                        GameTicks div 32 mod 16);
-
-        if (Gear^.State and gstDrowning) = 0 then
-            if (Gear^.State and gstHHThinking) <> 0 then
-                DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8)
-        end
-    end;
-
-if HH^.Effects[hePoisoned] then
-    begin
-    Tint($00, $FF, $40, $80);
-    DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360);
-    end;
-if HH^.Effects[heResurrected] then
-    begin
-    Tint($f5, $db, $35, $20);
-    DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
-    end;
-
-if Gear^.Invulnerable then
-    begin
-    Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750))));
-    DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0);
-    end;
-if cVampiric and
-   (CurrentHedgehog^.Gear <> nil) and
-   (CurrentHedgehog^.Gear = Gear) then
-    begin
-    Tint($FF, 0, 0, max($40, floor($FF * abs(1 - (RealTicks mod 1500) / 750))));
-    DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
-    end;
-    Tint($FF, $FF, $FF, $FF)
-end;
-
-procedure DrawGears;
-var Gear, HHGear: PGear;
-    i: Longword;
-    x, y, startX, endX, startY, endY: LongInt;
-begin
-Gear:= GearsList;
-while Gear<>nil do
-    begin
-    x:= hwRound(Gear^.X) + WorldDx;
-    y:= hwRound(Gear^.Y) + WorldDy;
-    case Gear^.Kind of
-          gtBomb: DrawRotated(sprBomb, x, y, 0, Gear^.DirAngle);
-       gtGasBomb: DrawRotated(sprCheese, x, y, 0, Gear^.DirAngle);
-       gtMolotov: DrawRotated(sprMolotov, x, y, 0, Gear^.DirAngle);
-
-       gtRCPlane: begin
-                  if (Gear^.Tag = -1) then
-                     DrawRotated(sprPlane, x, y, -1,  DxDy2Angle(Gear^.dX, Gear^.dY) + 90)
-                  else
-                     DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX));
-                  if ((TrainingFlags and tfRCPlane) <> 0) and (TrainingTargetGear <> nil) and ((Gear^.State and gstDrowning) = 0) then
-                     DrawRotatedf(sprFinger, x, y, GameTicks div 32 mod 16, 0, DxDy2Angle(Gear^.X - TrainingTargetGear^.X, TrainingTargetGear^.Y - Gear^.Y));
-                  end;
-       gtBall: DrawRotatedf(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?
-                      DrawRotatedf(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle)
-                 else DrawRotatedf(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle);
-
-           gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then
-                        DrawRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX))
-                    else
-                        DrawRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-
-        gtHedgehog: DrawHH(Gear, x, y);
-
-           gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-
-           gtGrave: begin 
-                    DrawTextureF(PHedgehog(Gear^.Hedgehog)^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32);
-                    if Gear^.Health > 0 then
-                        begin
-                        //Tint($33, $33, $FF, max($40, floor($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
-                        Tint($f5, $db, $35, max($40, floor($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
-                        //Tint($FF, $FF, $FF, max($40, floor($FF * abs(1 - (RealTicks mod 1500) / 750))));
-                        DrawSprite(sprVampiric, x - 24, y - 24, 0);
-                        Tint($FF, $FF, $FF, $FF)
-                        end
-                    end;
-             gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-      gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
-            gtRope: DrawRope(Gear);
-            gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
-                           DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
-                       else if Gear^.Health <> 0 then DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
-                       else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
-           gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
-                           DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
-                       else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
-                       else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
-            gtCase: case Gear^.Pos of
-                         posCaseAmmo  : begin
-                                        i:= (GameTicks shr 6) mod 64;
-                                        if i > 18 then i:= 0;
-                                        DrawSprite(sprCase, x - 24, y - 24, i);
-                                        end;
-                         posCaseHealth: begin
-                                        i:= ((GameTicks shr 6) + 38) mod 64;
-                                        if i > 13 then i:= 0;
-                                        DrawSprite(sprFAid, x - 24, y - 24, i);
-                                        end;
-                         posCaseUtility: 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;
-      gtExplosives: begin
-                    if ((Gear^.State and gstDrowning) <> 0) then
-                        DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
-                    else if Gear^.State and gstAnimation = 0 then
-                        begin
-                        i:= (GameTicks shr 6 + Gear^.uid*3) mod 64;
-                        if i > 18 then i:= 0;
-                        DrawSprite(sprExplosives, x - 24, y - 24, i)
-                        end
-                    else if Gear^.State and gsttmpFlag = 0 then
-                        DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
-                    else
-                        DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
-                    end;
-        gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
-     gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
-         gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
-           gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16);
-       gtParachute: begin
-                    DrawSprite(sprParachute, x - 24, y - 48, 0);
-                    DrawAltWeapon(Gear, x + 1, y - 3)
-                    end;
-       gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 0)
-                                     else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1);
-         gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-        gtTeleport: begin
-                    HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
-                    if not PHedgehog(Gear^.Hedgehog)^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
-                    DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0);
-                    end;
-        gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
-          gtTarget: begin
-                    Tint($FF, $FF, $FF, floor($FF * Gear^.Timer / 1000));
-                    DrawSprite(sprTarget, x - 16, y - 16, 0);
-                    Tint($FF, $FF, $FF, $FF);
-                    end;
-          gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-          gtCake: if Gear^.Pos = 6 then
-                     DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90)
-                  else
-                     DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90);
-       gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, x - 16, y - 16, 0);
-      gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle);
-      gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle);
-     gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle);
-           gtBirdy: begin
-                    if Gear^.State and gstAnimation = gstAnimation then
-                        begin
-                        if Gear^.State and gstTmpFlag = 0 then // Appearing
-                            begin
-                            endX:= x - WorldDx;
-                            endY:= y - WorldDy;
-                            if Gear^.Tag < 0 then
-                                startX:= max(LAND_WIDTH + 1024, endX + 2048)
-                            else
-                                startX:= max(-LAND_WIDTH - 1024, endX - 2048);
-                            startY:= endY - 256;
-                            DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + floor((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + floor((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
-                            end
-                        else // Disappearing
-                            begin
-                            startX:= x - WorldDx;
-                            startY:= y - WorldDy;
-                            if Gear^.Tag > 0 then
-                                endX:= max(LAND_WIDTH + 1024, startX + 2048)
-                            else
-                                endX:= max(-LAND_WIDTH - 1024, startX - 2048);
-                            endY:= startY + 256;
-                            DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + floor((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + floor((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY)) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
-                            end;
-                        end
-                    else
-                        DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
-                    end;
-             gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 1, 16, 16, Gear^.DirAngle);
-           gtPiano: begin
-                    if (Gear^.State and gstDrowning) = 0 then
-                        begin
-                        Tint($FF, $FF, $FF, $10);
-                        for i:= 8 downto 1 do
-                            DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0);
-                        Tint($FF, $FF, $FF, $FF)
-                        end;
-                    DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y, 0, 1, 128, 128, 0);
-                    end;
-     gtPoisonCloud: begin
-                    if Gear^.Timer < 1020 then
-                        Tint($C0, $C0, $00, Gear^.Timer div 8)
-                    else if Gear^.Timer > 3980 then
-                        Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8)
-                    else
-                        Tint($C0, $C0, $00, $C0);
-                    DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360);
-                    Tint($FF, $FF, $FF, $FF)
-                    end;
-     gtResurrector: begin
-                    DrawRotated(sprCross, x, y, 0, 0);
-                    Tint($f5, $db, $35, max($00, floor($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
-                    DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5);
-                    Tint($FF, $FF, $FF, $FF);
-                    end;
-      gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-         end;
-      if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex);
-      Gear:= Gear^.NextGear
-      end;
-end;
--- a/hedgewars/HHHandlers.inc	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/HHHandlers.inc	Tue Nov 30 22:46:47 2010 +0100
@@ -48,7 +48,7 @@
 ChangeAmmo:= false;
 slot:= Gear^.MsgParam;
 
-with PHedgehog(Gear^.Hedgehog)^ do
+with Gear^.Hedgehog^ do
     begin
     Gear^.Message:= Gear^.Message and not gmSlot;
     ammoidx:= 0;
@@ -60,7 +60,7 @@
 
     while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx);
 
-    if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^);
+    if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(Gear^.Hedgehog^);
 
     MultiShootAttacks:= 0;
     Gear^.Message:= Gear^.Message and not (gmLJump or gmHJump);
@@ -101,7 +101,7 @@
     s: boolean;
 begin
 weap:= TAmmoType(Gear^.MsgParam);
-Hedgehog:= PHedgehog(Gear^.Hedgehog);
+Hedgehog:= Gear^.Hedgehog;
 
 if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet
 
@@ -118,15 +118,15 @@
         dec(t)
         end;
 
-if s then ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^)
+if s then ApplyAmmoChanges(Gear^.Hedgehog^)
 end;
 
 procedure HHSetTimer(Gear: PGear);
 var CurWeapon: PAmmo;
 begin
 Gear^.Message:= Gear^.Message and not gmTimer;
-CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^);
-with PHedgehog(Gear^.Hedgehog)^ do
+CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
+with Gear^.Hedgehog^ do
     if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
         begin
         CurWeapon^.Timer:= 1000 * Gear^.MsgParam;
@@ -143,9 +143,9 @@
     altUse: boolean;
 begin
 bShowFinger:= false;
-CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^);
+CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
 with Gear^,
-     PHedgehog(Gear^.Hedgehog)^ do
+     Gear^.Hedgehog^ do
      begin
      if ((State and gstHHDriven) <> 0)and
         ((State and (gstAttacked or gstHHChooseTarget)) = 0) and
@@ -386,7 +386,7 @@
 const frametime = 200;
       timertime = frametime * 6;
 begin
-if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
+if Gear^.Hedgehog^.Unplaced then exit;
 if Gear^.Timer > 1 then
     begin
     AllInactive:= false;
@@ -406,7 +406,7 @@
     Gear^.Z:= cCurrHHZ;
     RemoveGearFromList(Gear);
     InsertGearToList(Gear);
-    PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+    PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
     Gear^.Pos:= 0;
     Gear^.Timer:= timertime
     end
@@ -417,7 +417,7 @@
 const frametime = 65;
       timertime = frametime * 11;
 begin
-if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
+if Gear^.Hedgehog^.Unplaced then exit;
 if Gear^.Timer > 1 then
     begin
     AllInactive:= false;
@@ -434,7 +434,7 @@
     Gear^.Z:= cCurrHHZ;
     RemoveGearFromList(Gear);
     InsertGearToList(Gear);
-    PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+    PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
     PlaySound(sndWarp);
     Gear^.Pos:= 0;
     Gear^.Timer:= timertime
@@ -454,16 +454,16 @@
        posCaseUtility,
        posCaseAmmo: begin
                     a:= Gear^.AmmoType;
-                    AddAmmo(PHedgehog(HH^.Hedgehog)^, a);
+                    AddAmmo(HH^.Hedgehog^, a);
 // Possibly needs to check shared clan ammo game flag once added.
 // On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
-                    if (not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven 
-                      or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0)))
-                      or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan)
+                    if (not (HH^.Hedgehog^.Team^.ExtDriven 
+                      or (HH^.Hedgehog^.BotLevel > 0)))
+                      or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan)
                       or (GameType = gmtDemo)  then
                         begin
                         s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')';
-                        AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo);
+                        AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
 
                         // show ammo icon
                         vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo);
@@ -474,12 +474,12 @@
                     end;
      posCaseHealth: begin
                     inc(HH^.Health, Gear^.Health);
-                    PHedgehog(HH^.Hedgehog)^.Effects[hePoisoned] := false;
+                    HH^.Hedgehog^.Effects[hePoisoned] := false;
                     str(Gear^.Health, s);
                     s:= '+' + s;
-                    AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo);
-                    RenderHealth(PHedgehog(HH^.Hedgehog)^);
-                    RecountTeamHealth(PHedgehog(HH^.Hedgehog)^.Team);
+                    AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
+                    RenderHealth(HH^.Hedgehog^);
+                    RecountTeamHealth(HH^.Hedgehog^.Team);
 
                     i:= 0;
                     while i < Gear^.Health do
@@ -497,11 +497,11 @@
 var PrevdX: LongInt;
     CurWeapon: PAmmo;
 begin
-CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^);
+CurWeapon:= GetAmmoEntry(Gear^.Hedgehog^);
 if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
    begin
    if isCursorVisible then
-      with PHedgehog(Gear^.Hedgehog)^ do
+      with Gear^.Hedgehog^ do
         with CurWeapon^ do
           begin
           if (Gear^.Message and gmLeft  ) <> 0 then
@@ -536,7 +536,7 @@
          Gear^.dY:= -_0_15;
          if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX);
          Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
-         PlaySound(sndJump1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+         PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
          exit
          end;
       end;
@@ -549,7 +549,7 @@
       Gear^.dY:= -_0_2;
       SetLittle(Gear^.dX);
       Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
-      PlaySound(sndJump3, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+      PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack);
       exit
       end;
 
@@ -570,7 +570,7 @@
       end;
    DeleteCI(Gear); // must be after exit!! (see previous line)
 
-   PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7;
+   Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
       begin
       if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
@@ -630,7 +630,7 @@
 procedure HedgehogChAngle(Gear: PGear);
 var da: LongWord;
 begin
-with PHedgehog(Gear^.Hedgehog)^ do
+with Gear^.Hedgehog^ do
     if (CurAmmoType = amRope)
     and ((Gear^.State and (gstMoving or gstHHJumping)) = gstMoving) then da:= 2 else da:= 1;
 
@@ -649,7 +649,7 @@
 if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862;
 if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862;
 
-if PHedgehog(Gear^.Hedgehog)^.Unplaced then
+if Gear^.Hedgehog^.Unplaced then
    begin
    Gear^.dY:= _0;
    Gear^.dX:= _0;
@@ -773,7 +773,7 @@
     wasJumping: boolean;
     Hedgehog: PHedgehog;
 begin
-Hedgehog:= PHedgehog(Gear^.Hedgehog);
+Hedgehog:= Gear^.Hedgehog;
 if not isInMultiShoot then
    AllInactive:= false
 else
@@ -919,16 +919,16 @@
         PrvInactive:= false;
         AllInactive:= false;
 
-        if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then
+        if not Gear^.Hedgehog^.Team^.hasGone then
             begin
-            PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] := false;
-            if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then begin
+            Gear^.Hedgehog^.Effects[hePoisoned] := false;
+            if Gear^.Hedgehog^.Effects[heResurrectable] then begin
                 ResurrectHedgehog(Gear);
             end else begin
                 Gear^.State:= Gear^.State or gstHHDeath;
                 Gear^.doStep:= @doStepHedgehogDead;
                 // Death message
-                AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+                AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
             end;
             end
         else
@@ -936,7 +936,7 @@
             Gear^.State:= Gear^.State or gstHHGone;
             Gear^.doStep:= @doStepHedgehogGone;
             // Gone message
-            AddCaption(Format(GetEventString(eidGone), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+            AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
             end
         end;
     exit
@@ -974,7 +974,7 @@
     doStepHedgehogFree(Gear)
 else
     begin
-    with PHedgehog(Gear^.Hedgehog)^ do
+    with Gear^.Hedgehog^ do
         if Team^.hasGone then TeamGoneEffect(Team^);
     doStepHedgehogDriven(Gear)
     end;
--- a/hedgewars/SDLh.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/SDLh.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -774,7 +774,7 @@
 function  TTF_Init: LongInt; cdecl; external SDL_TTFLibName;
 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
 
-function  TTF_SizeUTF8(font: PTTF_Font; const text: PChar; var w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
+function  TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
 
 function  TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
--- a/hedgewars/SinTable.inc	Mon Nov 29 09:11:31 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1045 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007 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
- *)
-
-const SinTable: array[0..1024] of QWord = (
-     $00000000,
-     $006487EB,
-     $00C90FC6,
-     $012D9782,
-     $01921F10,
-     $01F6A660,
-     $025B2D62,
-     $02BFB407,
-     $03243A40,
-     $0388BFFC,
-     $03ED452D,
-     $0451C9C3,
-     $04B64DAF,
-     $051AD0E0,
-     $057F5348,
-     $05E3D4D7,
-     $0648557E,
-     $06ACD52C,
-     $071153D3,
-     $0775D163,
-     $07DA4DCC,
-     $083EC900,
-     $08A342EE,
-     $0907BB86,
-     $096C32BB,
-     $09D0A87B,
-     $0A351CB8,
-     $0A998F62,
-     $0AFE0069,
-     $0B626FBF,
-     $0BC6DD53,
-     $0C2B4916,
-     $0C8FB2F9,
-     $0CF41AEB,
-     $0D5880DF,
-     $0DBCE4C3,
-     $0E214689,
-     $0E85A622,
-     $0EEA037D,
-     $0F4E5E8B,
-     $0FB2B73D,
-     $10170D83,
-     $107B614E,
-     $10DFB28F,
-     $11440135,
-     $11A84D31,
-     $120C9675,
-     $1270DCF0,
-     $12D52093,
-     $1339614E,
-     $139D9F13,
-     $1401D9D1,
-     $14661179,
-     $14CA45FC,
-     $152E774A,
-     $1592A554,
-     $15F6D00B,
-     $165AF75E,
-     $16BF1B3E,
-     $17233B9D,
-     $1787586A,
-     $17EB7197,
-     $184F8713,
-     $18B398CF,
-     $1917A6BC,
-     $197BB0CB,
-     $19DFB6EB,
-     $1A43B90E,
-     $1AA7B724,
-     $1B0BB11E,
-     $1B6FA6EC,
-     $1BD3987F,
-     $1C3785C8,
-     $1C9B6EB6,
-     $1CFF533B,
-     $1D633348,
-     $1DC70ECC,
-     $1E2AE5B8,
-     $1E8EB7FE,
-     $1EF2858D,
-     $1F564E57,
-     $1FBA124B,
-     $201DD15B,
-     $20818B77,
-     $20E5408F,
-     $2148F095,
-     $21AC9B79,
-     $2210412C,
-     $2273E19E,
-     $22D77CBF,
-     $233B1281,
-     $239EA2D5,
-     $24022DAA,
-     $2465B2F1,
-     $24C9329C,
-     $252CAC9A,
-     $259020DD,
-     $25F38F55,
-     $2656F7F3,
-     $26BA5AA7,
-     $271DB762,
-     $27810E14,
-     $27E45EB0,
-     $2847A924,
-     $28AAED62,
-     $290E2B5B,
-     $297162FF,
-     $29D4943F,
-     $2A37BF0B,
-     $2A9AE355,
-     $2AFE010D,
-     $2B611823,
-     $2BC42889,
-     $2C27322F,
-     $2C8A3506,
-     $2CED30FF,
-     $2D50260A,
-     $2DB31418,
-     $2E15FB1A,
-     $2E78DB01,
-     $2EDBB3BD,
-     $2F3E853F,
-     $2FA14F78,
-     $30041258,
-     $3066CDD1,
-     $30C981D3,
-     $312C2E50,
-     $318ED336,
-     $31F17079,
-     $32540608,
-     $32B693D3,
-     $331919CD,
-     $337B97E6,
-     $33DE0E0E,
-     $34407C36,
-     $34A2E250,
-     $3505404B,
-     $3567961A,
-     $35C9E3AC,
-     $362C28F3,
-     $368E65DE,
-     $36F09A61,
-     $3752C66A,
-     $37B4E9EB,
-     $381704D5,
-     $38791719,
-     $38DB20A7,
-     $393D2170,
-     $399F1966,
-     $3A010879,
-     $3A62EE9A,
-     $3AC4CBBA,
-     $3B269FCB,
-     $3B886ABB,
-     $3BEA2C7E,
-     $3C4BE503,
-     $3CAD943C,
-     $3D0F3A1A,
-     $3D70D68C,
-     $3DD26986,
-     $3E33F2F6,
-     $3E9572CF,
-     $3EF6E901,
-     $3F58557E,
-     $3FB9B836,
-     $401B111A,
-     $407C601B,
-     $40DDA52A,
-     $413EE039,
-     $41A01138,
-     $42013818,
-     $426254CA,
-     $42C3673F,
-     $43246F69,
-     $43856D38,
-     $43E6609E,
-     $4447498B,
-     $44A827F0,
-     $4508FBBF,
-     $4569C4E9,
-     $45CA835E,
-     $462B3710,
-     $468BDFF0,
-     $46EC7DEE,
-     $474D10FD,
-     $47AD990D,
-     $480E160F,
-     $486E87F5,
-     $48CEEEAF,
-     $492F4A2F,
-     $498F9A65,
-     $49EFDF44,
-     $4A5018BB,
-     $4AB046BD,
-     $4B10693A,
-     $4B708024,
-     $4BD08B6C,
-     $4C308B02,
-     $4C907ED9,
-     $4CF066E1,
-     $4D50430C,
-     $4DB0134A,
-     $4E0FD78D,
-     $4E6F8FC7,
-     $4ECF3BE8,
-     $4F2EDBE2,
-     $4F8E6FA6,
-     $4FEDF725,
-     $504D7250,
-     $50ACE11A,
-     $510C4372,
-     $516B994B,
-     $51CAE295,
-     $522A1F43,
-     $52894F44,
-     $52E8728C,
-     $5347890A,
-     $53A692B0,
-     $54058F70,
-     $54647F3B,
-     $54C36203,
-     $552237B8,
-     $5581004C,
-     $55DFBBB0,
-     $563E69D7,
-     $569D0AB0,
-     $56FB9E2E,
-     $575A2443,
-     $57B89CDE,
-     $581707F3,
-     $58756572,
-     $58D3B54D,
-     $5931F775,
-     $59902BDC,
-     $59EE5273,
-     $5A4C6B2B,
-     $5AAA75F7,
-     $5B0872C8,
-     $5B66618E,
-     $5BC4423C,
-     $5C2214C4,
-     $5C7FD916,
-     $5CDD8F25,
-     $5D3B36E1,
-     $5D98D03D,
-     $5DF65B29,
-     $5E53D798,
-     $5EB1457C,
-     $5F0EA4C4,
-     $5F6BF565,
-     $5FC9374E,
-     $60266A71,
-     $60838EC1,
-     $60E0A42F,
-     $613DAAAC,
-     $619AA22A,
-     $61F78A9B,
-     $625463F0,
-     $62B12E1B,
-     $630DE90E,
-     $636A94BB,
-     $63C73113,
-     $6423BE08,
-     $64803B8B,
-     $64DCA98F,
-     $65390805,
-     $659556DF,
-     $65F1960E,
-     $664DC585,
-     $66A9E535,
-     $6705F510,
-     $6761F508,
-     $67BDE50F,
-     $6819C516,
-     $6875950F,
-     $68D154EC,
-     $692D049F,
-     $6988A41B,
-     $69E4334F,
-     $6A3FB230,
-     $6A9B20AE,
-     $6AF67EBB,
-     $6B51CC49,
-     $6BAD094B,
-     $6C0835B2,
-     $6C635170,
-     $6CBE5C77,
-     $6D1956B9,
-     $6D744028,
-     $6DCF18B5,
-     $6E29E054,
-     $6E8496F6,
-     $6EDF3C8C,
-     $6F39D10A,
-     $6F945460,
-     $6FEEC681,
-     $70492760,
-     $70A376EE,
-     $70FDB51D,
-     $7157E1DF,
-     $71B1FD26,
-     $720C06E5,
-     $7265FF0E,
-     $72BFE593,
-     $7319BA65,
-     $73737D77,
-     $73CD2EBC,
-     $7426CE24,
-     $74805BA4,
-     $74D9D72C,
-     $753340AF,
-     $758C981F,
-     $75E5DD6E,
-     $763F108F,
-     $76983174,
-     $76F1400F,
-     $774A3C52,
-     $77A32630,
-     $77FBFD9B,
-     $7854C285,
-     $78AD74E0,
-     $7906149F,
-     $795EA1B5,
-     $79B71C13,
-     $7A0F83AC,
-     $7A67D872,
-     $7AC01A58,
-     $7B184950,
-     $7B70654C,
-     $7BC86E3F,
-     $7C20641B,
-     $7C7846D3,
-     $7CD01659,
-     $7D27D2A0,
-     $7D7F7B99,
-     $7DD71139,
-     $7E2E9370,
-     $7E860232,
-     $7EDD5D71,
-     $7F34A51F,
-     $7F8BD930,
-     $7FE2F995,
-     $803A0641,
-     $8090FF28,
-     $80E7E43A,
-     $813EB56C,
-     $819572AF,
-     $81EC1BF7,
-     $8242B135,
-     $8299325D,
-     $82EF9F62,
-     $8345F835,
-     $839C3CC9,
-     $83F26D12,
-     $84488902,
-     $849E908B,
-     $84F483A1,
-     $854A6236,
-     $85A02C3C,
-     $85F5E1A8,
-     $864B826B,
-     $86A10E78,
-     $86F685C2,
-     $874BE83C,
-     $87A135D9,
-     $87F66E8C,
-     $884B9247,
-     $88A0A0FD,
-     $88F59AA1,
-     $894A7F26,
-     $899F4E7F,
-     $89F408A0,
-     $8A48AD7A,
-     $8A9D3D00,
-     $8AF1B727,
-     $8B461BE0,
-     $8B9A6B1F,
-     $8BEEA4D7,
-     $8C42C8FA,
-     $8C96D77C,
-     $8CEAD050,
-     $8D3EB368,
-     $8D9280B9,
-     $8DE63834,
-     $8E39D9CD,
-     $8E8D6578,
-     $8EE0DB27,
-     $8F343ACD,
-     $8F87845E,
-     $8FDAB7CC,
-     $902DD50C,
-     $9080DC0F,
-     $90D3CCCA,
-     $9126A72F,
-     $91796B31,
-     $91CC18C5,
-     $921EAFDD,
-     $9271306C,
-     $92C39A66,
-     $9315EDBE,
-     $93682A67,
-     $93BA5055,
-     $940C5F7A,
-     $945E57CB,
-     $94B0393B,
-     $950203BD,
-     $9553B744,
-     $95A553C4,
-     $95F6D930,
-     $9648477C,
-     $96999E9A,
-     $96EADE80,
-     $973C071F,
-     $978D186C,
-     $97DE125A,
-     $982EF4DD,
-     $987FBFE7,
-     $98D0736D,
-     $99210F62,
-     $997193BA,
-     $99C20068,
-     $9A125560,
-     $9A629296,
-     $9AB2B7FD,
-     $9B02C588,
-     $9B52BB2C,
-     $9BA298DC,
-     $9BF25E8C,
-     $9C420C2F,
-     $9C91A1B9,
-     $9CE11F1F,
-     $9D308453,
-     $9D7FD149,
-     $9DCF05F6,
-     $9E1E224C,
-     $9E6D2640,
-     $9EBC11C6,
-     $9F0AE4D1,
-     $9F599F56,
-     $9FA84148,
-     $9FF6CA9A,
-     $A0453B42,
-     $A0939332,
-     $A0E1D25F,
-     $A12FF8BC,
-     $A17E063F,
-     $A1CBFAD9,
-     $A219D681,
-     $A2679928,
-     $A2B542C5,
-     $A302D349,
-     $A3504AAB,
-     $A39DA8DD,
-     $A3EAEDD3,
-     $A4381983,
-     $A4852BDF,
-     $A4D224DD,
-     $A51F046F,
-     $A56BCA8B,
-     $A5B87724,
-     $A6050A2F,
-     $A65183A0,
-     $A69DE36B,
-     $A6EA2984,
-     $A73655DF,
-     $A7826871,
-     $A7CE612E,
-     $A81A400B,
-     $A86604FB,
-     $A8B1AFF3,
-     $A8FD40E7,
-     $A948B7CB,
-     $A9941495,
-     $A9DF5738,
-     $AA2A7FA9,
-     $AA758DDB,
-     $AAC081C5,
-     $AB0B5B59,
-     $AB561A8D,
-     $ABA0BF54,
-     $ABEB49A4,
-     $AC35B971,
-     $AC800EB0,
-     $ACCA4954,
-     $AD146953,
-     $AD5E6EA1,
-     $ADA85932,
-     $ADF228FC,
-     $AE3BDDF3,
-     $AE85780B,
-     $AECEF73A,
-     $AF185B73,
-     $AF61A4AC,
-     $AFAAD2D9,
-     $AFF3E5EF,
-     $B03CDDE3,
-     $B085BAA9,
-     $B0CE7C36,
-     $B117227F,
-     $B15FAD79,
-     $B1A81D19,
-     $B1F07153,
-     $B238AA1C,
-     $B280C769,
-     $B2C8C930,
-     $B310AF64,
-     $B35879FB,
-     $B3A028E9,
-     $B3E7BC25,
-     $B42F33A1,
-     $B4768F55,
-     $B4BDCF34,
-     $B504F334,
-     $B54BFB49,
-     $B592E769,
-     $B5D9B789,
-     $B6206B9E,
-     $B667039D,
-     $B6AD7F7A,
-     $B6F3DF2C,
-     $B73A22A7,
-     $B78049E1,
-     $B7C654CE,
-     $B80C4364,
-     $B8521599,
-     $B897CB60,
-     $B8DD64B0,
-     $B922E17E,
-     $B96841BF,
-     $B9AD8569,
-     $B9F2AC70,
-     $BA37B6CB,
-     $BA7CA46D,
-     $BAC1754E,
-     $BB062962,
-     $BB4AC09E,
-     $BB8F3AF8,
-     $BBD39866,
-     $BC17D8DD,
-     $BC5BFC52,
-     $BCA002BA,
-     $BCE3EC0D,
-     $BD27B83E,
-     $BD6B6744,
-     $BDAEF913,
-     $BDF26DA3,
-     $BE35C4E7,
-     $BE78FED6,
-     $BEBC1B66,
-     $BEFF1A8C,
-     $BF41FC3E,
-     $BF84C071,
-     $BFC7671B,
-     $C009F032,
-     $C04C5BAB,
-     $C08EA97D,
-     $C0D0D99E,
-     $C112EC02,
-     $C154E0A0,
-     $C196B76D,
-     $C1D87060,
-     $C21A0B6E,
-     $C25B888D,
-     $C29CE7B4,
-     $C2DE28D7,
-     $C31F4BEE,
-     $C36050ED,
-     $C3A137CB,
-     $C3E2007E,
-     $C422AAFC,
-     $C463373A,
-     $C4A3A530,
-     $C4E3F4D2,
-     $C5242618,
-     $C56438F7,
-     $C5A42D65,
-     $C5E40359,
-     $C623BAC8,
-     $C66353A9,
-     $C6A2CDF2,
-     $C6E22999,
-     $C7216694,
-     $C76084DA,
-     $C79F8461,
-     $C7DE651F,
-     $C81D270B,
-     $C85BCA1B,
-     $C89A4E44,
-     $C8D8B37F,
-     $C916F9C0,
-     $C95520FE,
-     $C9932930,
-     $C9D1124D,
-     $CA0EDC49,
-     $CA4C871D,
-     $CA8A12BF,
-     $CAC77F24,
-     $CB04CC45,
-     $CB41FA16,
-     $CB7F088F,
-     $CBBBF7A6,
-     $CBF8C752,
-     $CC35778A,
-     $CC720844,
-     $CCAE7977,
-     $CCEACB19,
-     $CD26FD21,
-     $CD630F87,
-     $CD9F0240,
-     $CDDAD543,
-     $CE168888,
-     $CE521C04,
-     $CE8D8FAF,
-     $CEC8E380,
-     $CF04176E,
-     $CF3F2B6E,
-     $CF7A1F79,
-     $CFB4F385,
-     $CFEFA78A,
-     $D02A3B7D,
-     $D064AF56,
-     $D09F030C,
-     $D0D93696,
-     $D11349EB,
-     $D14D3D02,
-     $D1870FD2,
-     $D1C0C253,
-     $D1FA547A,
-     $D233C641,
-     $D26D179C,
-     $D2A64885,
-     $D2DF58F1,
-     $D31848D8,
-     $D3511832,
-     $D389C6F5,
-     $D3C25519,
-     $D3FAC295,
-     $D4330F60,
-     $D46B3B73,
-     $D4A346C3,
-     $D4DB3148,
-     $D512FAFB,
-     $D54AA3D1,
-     $D5822BC4,
-     $D5B992C9,
-     $D5F0D8D8,
-     $D627FDEA,
-     $D65F01F5,
-     $D695E4F1,
-     $D6CCA6D6,
-     $D703479A,
-     $D739C736,
-     $D77025A2,
-     $D7A662D4,
-     $D7DC7EC5,
-     $D812796C,
-     $D84852C1,
-     $D87E0ABB,
-     $D8B3A152,
-     $D8E9167F,
-     $D91E6A38,
-     $D9539C76,
-     $D988AD30,
-     $D9BD9C5E,
-     $D9F269F8,
-     $DA2715F5,
-     $DA5BA04F,
-     $DA9008FC,
-     $DAC44FF5,
-     $DAF87531,
-     $DB2C78A8,
-     $DB605A53,
-     $DB941A29,
-     $DBC7B822,
-     $DBFB3437,
-     $DC2E8E60,
-     $DC61C694,
-     $DC94DCCB,
-     $DCC7D0FF,
-     $DCFAA326,
-     $DD2D533A,
-     $DD5FE131,
-     $DD924D06,
-     $DDC496AF,
-     $DDF6BE25,
-     $DE28C360,
-     $DE5AA658,
-     $DE8C6707,
-     $DEBE0563,
-     $DEEF8167,
-     $DF20DB09,
-     $DF521242,
-     $DF83270B,
-     $DFB4195C,
-     $DFE4E92D,
-     $E0159678,
-     $E0462134,
-     $E076895A,
-     $E0A6CEE2,
-     $E0D6F1C6,
-     $E106F1FD,
-     $E136CF81,
-     $E1668A4A,
-     $E1962250,
-     $E1C5978C,
-     $E1F4E9F7,
-     $E224198A,
-     $E253263D,
-     $E2821009,
-     $E2B0D6E7,
-     $E2DF7AD0,
-     $E30DFBBC,
-     $E33C59A4,
-     $E36A9482,
-     $E398AC4D,
-     $E3C6A0FF,
-     $E3F47291,
-     $E42220FC,
-     $E44FAC38,
-     $E47D143F,
-     $E4AA590A,
-     $E4D77A91,
-     $E50478CE,
-     $E53153B9,
-     $E55E0B4D,
-     $E58A9F81,
-     $E5B71050,
-     $E5E35DB2,
-     $E60F87A0,
-     $E63B8E14,
-     $E6677106,
-     $E6933071,
-     $E6BECC4C,
-     $E6EA4493,
-     $E715993D,
-     $E740CA44,
-     $E76BD7A2,
-     $E796C150,
-     $E7C18746,
-     $E7EC2980,
-     $E816A7F6,
-     $E84102A1,
-     $E86B397B,
-     $E8954C7D,
-     $E8BF3BA2,
-     $E8E906E2,
-     $E912AE37,
-     $E93C319B,
-     $E9659107,
-     $E98ECC75,
-     $E9B7E3DE,
-     $E9E0D73D,
-     $EA09A68A,
-     $EA3251C0,
-     $EA5AD8D9,
-     $EA833BCD,
-     $EAAB7A97,
-     $EAD39531,
-     $EAFB8B94,
-     $EB235DBB,
-     $EB4B0B9E,
-     $EB729539,
-     $EB99FA84,
-     $EBC13B7B,
-     $EBE85816,
-     $EC0F5050,
-     $EC362422,
-     $EC5CD387,
-     $EC835E7A,
-     $ECA9C4F3,
-     $ECD006EC,
-     $ECF62461,
-     $ED1C1D4B,
-     $ED41F1A4,
-     $ED67A167,
-     $ED8D2C8E,
-     $EDB29312,
-     $EDD7D4EE,
-     $EDFCF21D,
-     $EE21EA98,
-     $EE46BE5A,
-     $EE6B6D5D,
-     $EE8FF79C,
-     $EEB45D11,
-     $EED89DB6,
-     $EEFCB986,
-     $EF20B07B,
-     $EF448290,
-     $EF682FBF,
-     $EF8BB802,
-     $EFAF1B55,
-     $EFD259B1,
-     $EFF57311,
-     $F0186771,
-     $F03B36C9,
-     $F05DE116,
-     $F0806651,
-     $F0A2C676,
-     $F0C5017F,
-     $F0E71767,
-     $F1090828,
-     $F12AD3BD,
-     $F14C7A22,
-     $F16DFB50,
-     $F18F5744,
-     $F1B08DF6,
-     $F1D19F64,
-     $F1F28B86,
-     $F2135259,
-     $F233F3D8,
-     $F2546FFC,
-     $F274C6C2,
-     $F294F824,
-     $F2B5041D,
-     $F2D4EAA8,
-     $F2F4ABC1,
-     $F3144762,
-     $F333BD87,
-     $F3530E2B,
-     $F3723949,
-     $F3913EDB,
-     $F3B01EDE,
-     $F3CED94D,
-     $F3ED6E23,
-     $F40BDD5A,
-     $F42A26F0,
-     $F4484ADD,
-     $F466491F,
-     $F48421B1,
-     $F4A1D48D,
-     $F4BF61B0,
-     $F4DCC915,
-     $F4FA0AB6,
-     $F5172691,
-     $F5341C9F,
-     $F550ECDE,
-     $F56D9747,
-     $F58A1BD8,
-     $F5A67A8B,
-     $F5C2B35C,
-     $F5DEC647,
-     $F5FAB347,
-     $F6167A59,
-     $F6321B77,
-     $F64D969E,
-     $F668EBC9,
-     $F6841AF5,
-     $F69F241C,
-     $F6BA073B,
-     $F6D4C44E,
-     $F6EF5B50,
-     $F709CC3E,
-     $F7241713,
-     $F73E3BCB,
-     $F7583A63,
-     $F77212D5,
-     $F78BC51F,
-     $F7A5513C,
-     $F7BEB729,
-     $F7D7F6E1,
-     $F7F11060,
-     $F80A03A4,
-     $F822D0A6,
-     $F83B7765,
-     $F853F7DD,
-     $F86C5208,
-     $F88485E4,
-     $F89C936D,
-     $F8B47AA0,
-     $F8CC3B78,
-     $F8E3D5F1,
-     $F8FB4A09,
-     $F91297BC,
-     $F929BF05,
-     $F940BFE2,
-     $F9579A4F,
-     $F96E4E48,
-     $F984DBCA,
-     $F99B42D2,
-     $F9B1835B,
-     $F9C79D63,
-     $F9DD90E6,
-     $F9F35DE1,
-     $FA090450,
-     $FA1E8430,
-     $FA33DD7E,
-     $FA491036,
-     $FA5E1C55,
-     $FA7301D8,
-     $FA87C0BC,
-     $FA9C58FD,
-     $FAB0CA99,
-     $FAC5158C,
-     $FAD939D2,
-     $FAED376A,
-     $FB010E50,
-     $FB14BE80,
-     $FB2847F8,
-     $FB3BAAB4,
-     $FB4EE6B3,
-     $FB61FBF0,
-     $FB74EA69,
-     $FB87B21A,
-     $FB9A5302,
-     $FBACCD1D,
-     $FBBF2068,
-     $FBD14CE1,
-     $FBE35284,
-     $FBF5314F,
-     $FC06E93F,
-     $FC187A52,
-     $FC29E484,
-     $FC3B27D4,
-     $FC4C443D,
-     $FC5D39BE,
-     $FC6E0855,
-     $FC7EAFFD,
-     $FC8F30B6,
-     $FC9F8A7C,
-     $FCAFBD4D,
-     $FCBFC926,
-     $FCCFAE05,
-     $FCDF6BE8,
-     $FCEF02CB,
-     $FCFE72AD,
-     $FD0DBB8C,
-     $FD1CDD64,
-     $FD2BD833,
-     $FD3AABF8,
-     $FD4958B0,
-     $FD57DE58,
-     $FD663CEF,
-     $FD747472,
-     $FD8284DF,
-     $FD906E34,
-     $FD9E306F,
-     $FDABCB8D,
-     $FDB93F8C,
-     $FDC68C6B,
-     $FDD3B228,
-     $FDE0B0BF,
-     $FDED8830,
-     $FDFA3878,
-     $FE06C196,
-     $FE132387,
-     $FE1F5E4A,
-     $FE2B71DC,
-     $FE375E3C,
-     $FE432368,
-     $FE4EC15E,
-     $FE5A381D,
-     $FE6587A2,
-     $FE70AFEB,
-     $FE7BB0F8,
-     $FE868AC7,
-     $FE913D55,
-     $FE9BC8A1,
-     $FEA62CAA,
-     $FEB0696D,
-     $FEBA7EEA,
-     $FEC46D1F,
-     $FECE3409,
-     $FED7D3A9,
-     $FEE14BFB,
-     $FEEA9D00,
-     $FEF3C6B4,
-     $FEFCC918,
-     $FF05A429,
-     $FF0E57E6,
-     $FF16E44E,
-     $FF1F495F,
-     $FF278719,
-     $FF2F9D79,
-     $FF378C80,
-     $FF3F542A,
-     $FF46F478,
-     $FF4E6D68,
-     $FF55BEF9,
-     $FF5CE92A,
-     $FF63EBF9,
-     $FF6AC766,
-     $FF717B6F,
-     $FF780814,
-     $FF7E6D54,
-     $FF84AB2C,
-     $FF8AC19E,
-     $FF90B0A7,
-     $FF967847,
-     $FF9C187C,
-     $FFA19147,
-     $FFA6E2A6,
-     $FFAC0C97,
-     $FFB10F1C,
-     $FFB5EA32,
-     $FFBA9DD9,
-     $FFBF2A10,
-     $FFC38ED7,
-     $FFC7CC2C,
-     $FFCBE210,
-     $FFCFD082,
-     $FFD39780,
-     $FFD7370B,
-     $FFDAAF21,
-     $FFDDFFC3,
-     $FFE128F0,
-     $FFE42AA6,
-     $FFE704E7,
-     $FFE9B7B1,
-     $FFEC4304,
-     $FFEEA6E0,
-     $FFF0E344,
-     $FFF2F82F,
-     $FFF4E5A2,
-     $FFF6AB9D,
-     $FFF84A1E,
-     $FFF9C126,
-     $FFFB10B5,
-     $FFFC38CA,
-     $FFFD3965,
-     $FFFE1286,
-     $FFFEC42C,
-     $FFFF4E59,
-     $FFFFB10B,
-     $FFFFEC43,
-    $100000000
-     );
--- a/hedgewars/VGSHandlers.inc	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/VGSHandlers.inc	Tue Nov 30 22:46:47 2010 +0100
@@ -16,7 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  *)
 procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
-var sign: float;
+var sign: real;
 begin
 if vobCount = 0 then exit;
 
@@ -59,8 +59,8 @@
         begin
         if round(X) < cLeftScreenBorder then X:= X + cScreenSpace else
         if round(X) > cRightScreenBorder then X:= X - cScreenSpace;
-        // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + float(25); // For if flag is set for flakes rising upwards?
-        if round(Y) - 75 > LAND_HEIGHT then Y:= Y - float(1024 + 150); // TODO - configure in theme (jellies for example could use limited range)
+        // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards?
+        if round(Y) - 75 > LAND_HEIGHT then Y:= Y - (1024 + 150); // TODO - configure in theme (jellies for example could use limited range)
         Timer:= 0;
         tdX:= 0;
         tdY:= 0
@@ -81,7 +81,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepCloud(Gear: PVisualGear; Steps: Longword);
 var s: Longword;
-    t: float;
+    t: real;
 begin
 Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX) * Steps;
 
@@ -444,16 +444,16 @@
 begin
 if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0;
 
-if (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then
+if (Gear^.Hedgehog^.Gear <> nil) then
     begin
-    Gear^.X:= PHedgehog(Gear^.Hedgehog)^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2  - Gear^.FrameTicks);
-    Gear^.Y:= PHedgehog(Gear^.Hedgehog)^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h);
+    Gear^.X:= Gear^.Hedgehog^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2  - Gear^.FrameTicks);
+    Gear^.Y:= Gear^.Hedgehog^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h);
     end;
 
 if Gear^.Timer = 0 then
     begin
-    if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then
-        PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil;
+    if Gear^.Hedgehog^.SpeechGear = Gear then
+        Gear^.Hedgehog^.SpeechGear:= nil;
     DeleteVisualGear(Gear)
     end;
 end;
@@ -462,10 +462,10 @@
 begin
 Steps:= Steps; // avoid compiler hint
 
-with PHedgehog(Gear^.Hedgehog)^ do
+with Gear^.Hedgehog^ do
     if SpeechGear <> nil then SpeechGear^.Timer:= 0;
 
-PHedgehog(Gear^.Hedgehog)^.SpeechGear:= Gear;
+Gear^.Hedgehog^.SpeechGear:= Gear;
 
 Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000);
 
@@ -479,7 +479,7 @@
 
 Gear^.doStep:= @doStepSpeechBubbleWork;
 
-Gear^.Y:= Gear^.Y - float(Gear^.Tex^.h)
+Gear^.Y:= Gear^.Y - Gear^.Tex^.h
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -512,7 +512,7 @@
 
 str(Gear^.State, s);
 if Gear^.Hedgehog <> nil then
-    Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16)
+    Gear^.Tex:= RenderStringTex(s, Gear^.Hedgehog^.Team^.Clan^.Color, fnt16)
 else
     Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16);
 
@@ -521,7 +521,7 @@
 else
     Gear^.doStep:= @doStepHealthTagWorkUnderWater;
 
-Gear^.Y:= Gear^.Y - float(Gear^.Tex^.h);
+Gear^.Y:= Gear^.Y - Gear^.Tex^.h;
 
 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
 end;
@@ -627,3 +627,25 @@
   else
       dec(Gear^.FrameTicks, Steps);
 end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepCircle(Gear: PVisualGear; Steps: Longword);
+var tmp: byte;
+    i: LongWord;
+begin
+with Gear^ do
+    if Frame <> 0 then
+        for i:= 1 to Steps do
+            begin
+            inc(FrameTicks);
+            if (FrameTicks mod Frame) = 0 then
+                begin
+                tmp:= Gear^.Tint and $FF;
+                if tdY >= 0 then inc(tmp)
+                else dec(tmp);
+                if tmp < round(dX) then tdY:= 1;
+                if tmp > round(dY) then tdY:= -1;
+                Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or tmp
+                end
+            end
+end;
--- a/hedgewars/hwengine.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/hwengine.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -30,7 +30,8 @@
 {$ENDIF}
 
 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound,
-     uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile, sysutils;
+     uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, uMobile,
+     sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers;
 
 var isTerminated: boolean = false;
     alsoShutdownFrontend: boolean = false;
@@ -55,6 +56,7 @@
     case GameState of
         gsLandGen: begin
                 GenMap;
+                ParseCommand('sendlanddigest', true);
                 GameState:= gsStart;
                 end;
         gsStart: begin
@@ -111,6 +113,7 @@
         flagMakeCapture:= false;
         s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks);
         WriteLnToConsole('Saving ' + s + '...');
+        playSound(sndShutter);
         MakeScreenshot(s);
         //SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1)
     end;
@@ -123,7 +126,6 @@
     FreeActionsList();
     StoreRelease();
     ControllerClose();
-    SendKB();
     CloseIPC();
     TTF_Quit();
 {$IFDEF SDL13}
@@ -317,8 +319,12 @@
     Randomize();
 
     // uConsts does not need initialization as they are all consts
+    uUtils.initModule;
     uMisc.initModule;
+    uVariables.initModule;
     uConsole.initModule;    // MUST happen after uMisc
+    uCommands.initModule;
+    uCommandHandlers.initModule;
 
     uLand.initModule;
     uIO.initModule;
@@ -349,6 +355,7 @@
         uTeams.initModule;
         uVisualGears.initModule;
         uWorld.initModule;
+        uCaptions.initModule;
     end;
 end;
 
@@ -356,6 +363,7 @@
 begin
     if complete then
     begin
+        uCaptions.freeModule;
         uWorld.freeModule;
         uVisualGears.freeModule;
         uTeams.freeModule;
@@ -385,7 +393,11 @@
     uIO.freeModule;             //stub
     uLand.freeModule;
 
+    uCommandHandlers.freeModule;
+    uCommands.freeModule;
     uConsole.freeModule;
+    uVariables.freeModule;
+    uUtils.freeModule;
     uMisc.freeModule;           // uMisc closes the debug log.
 end;
 
--- a/hedgewars/uAI.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uAI.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -29,8 +29,9 @@
 procedure FreeActionsList;
 
 implementation
-uses uTeams, uConsts, SDLh, uAIMisc, uGears, uAIAmmoTests, uAIActions, uMisc,
-     uAmmos, uConsole, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF};
+uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions,
+     uAmmos, SysUtils{$IFDEF UNIX}, cthreads{$ENDIF}, uTypes,
+     uVariables, uCommands, uUtils, uDebug;
 
 var BestActions: TActions;
     CanUseAmmo: array [TAmmoType] of boolean;
@@ -65,7 +66,7 @@
     Score, i: LongInt;
     a, aa: TAmmoType;
 begin
-BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel;
+BotLevel:= Me^.Hedgehog^.BotLevel;
 
 for i:= 0 to Pred(Targets.Count) do
     if (Targets.ar[i].Score >= 0) and (not StopThinking) then
@@ -194,18 +195,18 @@
 Actions.Pos:= 0;
 Actions.Score:= 0;
 Stack.Count:= 0;
-BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel;
+BotLevel:= Me^.Hedgehog^.BotLevel;
 
 tmp:= random(2) + 1;
 Push(0, Actions, Me^, tmp);
 Push(0, Actions, Me^, tmp xor 3);
 
-if (Me^.State and gstAttacked) = 0 then maxticks:= max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel))
+if (Me^.State and gstAttacked) = 0 then maxticks:= Max(0, TurnTimeLeft - 5000 - LongWord(4000 * BotLevel))
                                    else maxticks:= TurnTimeLeft;
 
 if (Me^.State and gstAttacked) = 0 then TestAmmos(Actions, Me, false);
 BestRate:= RatePlace(Me);
-BaseRate:= max(BestRate, 0);
+BaseRate:= Max(BestRate, 0);
 
 while (Stack.Count > 0) and (not StopThinking) and (GameFlags and gfArtillery = 0) do
     begin
@@ -321,7 +322,7 @@
 
 FillBonuses((Me^.State and gstAttacked) <> 0);
 for a:= Low(TAmmoType) to High(TAmmoType) do
-    CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(PHedgehog(Me^.Hedgehog)^, a);
+    CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(Me^.Hedgehog^, a);
 {$IFDEF DEBUGFILE}AddFileLog('Enter Think Thread');{$ENDIF}
 BeginThread(@Think, Me, ThinkThread)
 end;
--- a/hedgewars/uAIActions.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uAIActions.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -20,7 +20,7 @@
 
 unit uAIActions;
 interface
-uses uGears, uFloat;
+uses uFloat, uTypes;
 
 const MAXACTIONS     = 96;
       aia_none       = 0;
@@ -62,7 +62,7 @@
 procedure ProcessAction(var Actions: TActions; Me: PGear);
 
 implementation
-uses uMisc, uConsts, uConsole, uAIMisc, uAI, uAmmos;
+uses uAIMisc, uAI, uAmmos, uVariables, uCommands, uUtils, uDebug, uIO;
 
 const ActionIdToStr: array[0..6] of string[16] = (
 {aia_none}           '',
@@ -95,8 +95,8 @@
 else begin
    WriteLnToConsole('AI action: '+SpecActionIdToStr[Action.Action]);
    if (Action.Action = aia_WaitXL) or (Action.Action = aia_WaitXR) then
-      WriteLnToConsole('AI action Wait X = '+inttostr(Action.Param)+', current X = '+inttostr(hwRound(Me^.X)))
-   else if (Action.Action = aia_AwareExpl) then WriteLnToConsole('Aware X = ' + inttostr(Action.X) + ', Y = ' + inttostr(Action.Y));
+      WriteLnToConsole('AI action Wait X = '+IntToStr(Action.Param)+', current X = '+IntToStr(hwRound(Me^.X)))
+   else if (Action.Action = aia_AwareExpl) then WriteLnToConsole('Aware X = ' + IntToStr(Action.X) + ', Y = ' + IntToStr(Action.Y));
    end
 end;
 {$ENDIF}
@@ -199,7 +199,7 @@
              aim_push: s:= '+' + s;
           aim_release: s:= '-' + s;
              end
-          else if Param <> 0 then s:= s + ' ' + inttostr(Param);
+          else if Param <> 0 then s:= s + ' ' + IntToStr(Param);
         ParseCommand(s, true)
         end
      end;
--- a/hedgewars/uAIAmmoTests.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uAIAmmoTests.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -20,7 +20,7 @@
 
 unit uAIAmmoTests;
 interface
-uses SDLh, uGears, uConsts, uFloat;
+uses SDLh, uConsts, uFloat, uTypes;
 const amtest_OnTurn = $00000001;
 
 type TAttackParams = record
@@ -108,7 +108,7 @@
 const BadTurn = Low(LongInt) div 4;
 
 implementation
-uses uMisc, uAIMisc, uLand;
+uses uAIMisc, uVariables, uUtils;
 
 function Metric(x1, y1, x2, y2: LongInt): LongInt;
 begin
@@ -539,7 +539,7 @@
     or (y.Round > LongWord(LAND_HEIGHT))
     or (d > 200);
 
-if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= max(0, (4 - d div 50) * 7 * 1024)
+if Abs(Targ.X - hwRound(x)) + Abs(Targ.Y - hwRound(y)) < 3 then valueResult:= Max(0, (4 - d div 50) * 7 * 1024)
                                                            else valueResult:= BadTurn;
 TestDesertEagle:= valueResult
 end;
--- a/hedgewars/uAIMisc.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uAIMisc.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -20,7 +20,7 @@
 
 unit uAIMisc;
 interface
-uses SDLh, uConsts, uGears, uFloat;
+uses SDLh, uConsts, uFloat, uTypes;
 
 const MAXBONUS = 1024;
 
@@ -68,8 +68,7 @@
              end;
 
 implementation
-uses uTeams, uMisc, uLand, uCollisions;
-
+uses uCollisions, uVariables, uUtils, uDebug;
 
 const KillScore = 200;
 
@@ -131,7 +130,7 @@
 
 begin
 bonuses.Count:= 0;
-MyClan:= PHedgehog(ThinkingHH^.Hedgehog)^.Team^.Clan;
+MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan;
 Gear:= GearsList;
 while Gear <> nil do
     begin
@@ -150,7 +149,7 @@
                           AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 60, -25)
                       else
                           if isAfterAttack and (ThinkingHH^.Hedgehog <> Gear^.Hedgehog) then
-                              if (MyClan = PHedgehog(Gear^.Hedgehog)^.Team^.Clan) then
+                              if (MyClan = Gear^.Hedgehog^.Team^.Clan) then
                                   AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 150, -3) // hedgehog-friend
                               else
                                   AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 100, 3)
--- a/hedgewars/uAmmos.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uAmmos.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -20,7 +20,7 @@
 
 unit uAmmos;
 interface
-uses uConsts, uTeams;
+uses uConsts, uTypes;
 
 procedure initModule;
 procedure freeModule;
@@ -47,7 +47,7 @@
 var StoreCnt: Longword;
 
 implementation
-uses uMisc, uGears, uWorld, uLocale, uConsole, uMobile;
+uses uLocale, uMobile, uVariables, uCommands, uUtils, uCaptions, uDebug;
 
 type TAmmoCounts = array[TAmmoType] of Longword;
 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
@@ -326,7 +326,7 @@
             if (Count <> AMMO_INFINITE) and not (Hedgehog.Team^.ExtDriven or (Hedgehog.BotLevel > 0)) then
                 s:= s + ' (' + IntToStr(Count) + ')';
             if (Propz and ammoprop_Timerable) <> 0 then
-                s:= s + ', ' + inttostr(Timer div 1000) + ' ' + trammo[sidSeconds];
+                s:= s + ', ' + IntToStr(Timer div 1000) + ' ' + trammo[sidSeconds];
             AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo);
             end;
         if (Propz and ammoprop_NeedTarget) <> 0
@@ -418,8 +418,22 @@
     if Ammoz[a].SkipTurns >= 10000 then dec(Ammoz[a].SkipTurns,10000)
 end;
 
+
+
+procedure chAddAmmoStore(var descr: shortstring);
+begin
+descr:= ''; // avoid compiler hint
+AddAmmoStore
+end;
+
 procedure initModule;
 begin
+    RegisterVariable('ammloadt', vtCommand, @SetAmmoLoadout, false);
+    RegisterVariable('ammdelay', vtCommand, @SetAmmoDelay, false);
+    RegisterVariable('ammprob',  vtCommand, @SetAmmoProbability, false);
+    RegisterVariable('ammreinf', vtCommand, @SetAmmoReinforcement, false);
+    RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
+
     StoreCnt:= 0;
     ammoLoadout:= '';
     ammoProbability:= '';
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uCaptions.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -0,0 +1,75 @@
+unit uCaptions;
+
+interface
+uses uTypes;
+
+procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
+procedure DrawCaptions;
+
+procedure initModule;
+procedure freeModule;
+
+implementation
+uses uTextures, uRenderUtils, uVariables, uRender, uConsts;
+
+type TCaptionStr = record
+                   Tex: PTexture;
+                   EndTime: LongWord;
+                   end;
+var
+    Captions: array[TCapGroup] of TCaptionStr;
+
+procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
+begin
+    if Captions[Group].Tex <> nil then
+        FreeTexture(Captions[Group].Tex);
+    Captions[Group].Tex:= nil;
+
+    Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
+
+    case Group of
+        capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200
+    else
+        Captions[Group].EndTime:= RealTicks + 1400 + LongWord(Captions[Group].Tex^.w) * 3;
+    end;
+end;
+
+procedure DrawCaptions;
+var
+    grp: TCapGroup;
+    offset: LongInt;
+begin
+    {$IFDEF IPHONEOS}
+    offset:= 40;
+    {$ELSE}
+    if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then
+        offset:= 48
+    else
+        offset:= 8;
+    {$ENDIF}
+
+    for grp:= Low(TCapGroup) to High(TCapGroup) do
+        with Captions[grp] do
+            if Tex <> nil then
+            begin
+                DrawCentered(0, offset, Tex);
+                inc(offset, Tex^.h + 2);
+                if EndTime <= RealTicks then
+                begin
+                    FreeTexture(Tex);
+                    Tex:= nil;
+                    EndTime:= 0
+                end;
+            end;
+end;
+
+procedure initModule;
+begin
+    FillChar(Captions, sizeof(Captions), 0)
+end;
+
+procedure freeModule;
+begin
+end;
+
+end.
--- a/hedgewars/uChat.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uChat.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -34,7 +34,7 @@
     showAll: boolean;
 
 implementation
-uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams;
+uses SDLh, uKeys, uTypes, uVariables, uCommands, uUtils, uTextures, uRender, uIO;
 
 const MaxStrIndex = 27;
 
@@ -308,8 +308,64 @@
     end
 end;
 
+procedure chChatMessage(var s: shortstring);
+begin
+    AddChatString(s)
+end;
+
+procedure chSay(var s: shortstring);
+begin
+    SendIPC('s' + s);
+
+    if copy(s, 1, 4) = '/me ' then
+        s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
+    else
+        s:= #1 + UserNick + ': ' + s;
+
+    AddChatString(s)
+end;
+
+procedure chTeamSay(var s: shortstring);
+begin
+    SendIPC('b' + s);
+
+    s:= #4 + '[Team] ' + UserNick + ': ' + s;
+
+    AddChatString(s)
+end;
+
+procedure chHistory(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    uChat.showAll:= not uChat.showAll
+end;
+
+procedure chChat(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    GameState:= gsChat;
+    if length(s) = 0 then
+        KeyPressChat(27)
+    else
+        begin
+        KeyPressChat(27);
+        KeyPressChat(47);
+        KeyPressChat(116);
+        KeyPressChat(101);
+        KeyPressChat(97);
+        KeyPressChat(109);
+        KeyPressChat(32)
+        end
+end;
+
 procedure initModule;
 begin
+    RegisterVariable('chatmsg', vtCommand, @chChatMessage, true);
+    RegisterVariable('say', vtCommand, @chSay, true);
+    RegisterVariable('team', vtCommand, @chTeamSay, true);
+    RegisterVariable('history', vtCommand, @chHistory, true );
+    RegisterVariable('chat', vtCommand, @chChat, true );
+
     lastStr:= 0;
     visibleCount:= 0;
     showAll:= false;
--- a/hedgewars/uCollisions.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uCollisions.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -20,7 +20,7 @@
 
 unit uCollisions;
 interface
-uses uGears, uFloat;
+uses uFloat, uTypes;
 
 const cMaxGearArrayInd = 255;
 
@@ -52,7 +52,7 @@
 function  calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean;
 
 implementation
-uses uMisc, uConsts, uLand, uLandGraphics;
+uses uConsts, uLandGraphics, uVariables, uDebug;
 
 type TCollisionEntry = record
             X, Y, Radius: LongInt;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uCommandHandlers.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -0,0 +1,598 @@
+{$INCLUDE "options.inc"}
+unit uCommandHandlers;
+
+interface
+
+procedure initModule;
+procedure freeModule;
+
+implementation
+uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uMobile, uRandom;
+
+procedure chQuit(var s: shortstring);
+const prevGState: TGameState = gsConfirm;
+begin
+s:= s; // avoid compiler hint
+if GameState <> gsConfirm then
+        begin
+        prevGState:= GameState;
+        GameState:= gsConfirm
+        end else
+        GameState:= prevGState
+end;
+
+procedure chConfirm(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if GameState = gsConfirm then
+    begin
+    SendIPC('Q');
+    GameState:= gsExit
+    end
+else
+    ParseCommand('chat team', true);
+end;
+
+procedure chCheckProto(var s: shortstring);
+var i, c: LongInt;
+begin
+if isDeveloperMode then
+begin
+val(s, i, c);
+if (c <> 0) or (i = 0) then exit;
+TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true);
+TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true)
+end
+end;
+
+procedure chTeamLocal(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if not isDeveloperMode then exit;
+if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/rdriven"', true);
+CurrentTeam^.ExtDriven:= true
+end;
+
+procedure chGrave(var s: shortstring);
+begin
+if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/grave"', true);
+if s[1]='"' then Delete(s, 1, 1);
+if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
+CurrentTeam^.GraveName:= s
+end;
+
+procedure chFort(var s: shortstring);
+begin
+if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/fort"', true);
+if s[1]='"' then Delete(s, 1, 1);
+if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
+CurrentTeam^.FortName:= s
+end;
+
+procedure chFlag(var s: shortstring);
+begin
+if CurrentTeam = nil then OutError(errmsgIncorrectUse + ' "/flag"', true);
+if s[1]='"' then Delete(s, 1, 1);
+if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
+CurrentTeam^.flag:= s
+end;
+
+procedure chScript(var s: shortstring);
+begin
+if s[1]='"' then Delete(s, 1, 1);
+if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
+ScriptLoad(s)
+end;
+
+procedure chSetHat(var s: shortstring);
+begin
+if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
+with CurrentTeam^ do
+    begin
+    if not CurrentHedgehog^.King then
+    if (s = '') or
+        (((GameFlags and gfKing) <> 0) and (s = 'crown')) or
+        ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
+        CurrentHedgehog^.Hat:= 'NoHat'
+    else
+        CurrentHedgehog^.Hat:= s
+    end;
+end;
+
+procedure chCurU_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementY:= -1;
+end;
+
+procedure chCurU_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementY:= 0;
+end;
+
+procedure chCurD_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementY:= 1;
+end;
+
+procedure chCurD_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementY:= 0;
+end;
+
+procedure chCurL_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementX:= -1;
+end;
+
+procedure chCurL_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementX:= 0;
+end;
+
+procedure chCurR_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementX:= 1;
+end;
+
+procedure chCurR_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+CursorMovementX:= 0;
+end;
+
+procedure chLeft_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('L');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmLeft
+end;
+
+procedure chLeft_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('l');
+with CurrentHedgehog^.Gear^ do
+    Message:= Message and not gmLeft
+end;
+
+procedure chRight_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('R');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmRight
+end;
+
+procedure chRight_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('r');
+with CurrentHedgehog^.Gear^ do
+    Message:= Message and not gmRight
+end;
+
+procedure chUp_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('U');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmUp
+end;
+
+procedure chUp_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('u');
+with CurrentHedgehog^.Gear^ do
+    Message:= Message and not gmUp
+end;
+
+procedure chDown_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('D');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmDown
+end;
+
+procedure chDown_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('d');
+with CurrentHedgehog^.Gear^ do
+    Message:= Message and not gmDown
+end;
+
+procedure chPrecise_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('Z');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmPrecise
+end;
+
+procedure chPrecise_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('z');
+with CurrentHedgehog^.Gear^ do
+    Message:= Message and not gmPrecise
+end;
+
+procedure chLJump(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('j');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmLJump
+end;
+
+procedure chHJump(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('J');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmHJump
+end;
+
+procedure chAttack_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    begin
+    {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
+    if ((State and gstHHDriven) <> 0) then
+        begin
+        FollowGear:= CurrentHedgehog^.Gear;
+        if not CurrentTeam^.ExtDriven then SendIPC('A');
+        Message:= Message or gmAttack
+        end
+    end
+end;
+
+procedure chAttack_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then exit;
+with CurrentHedgehog^.Gear^ do
+    begin
+    if not CurrentTeam^.ExtDriven and
+        ((Message and gmAttack) <> 0) then SendIPC('a');
+    Message:= Message and not gmAttack
+    end
+end;
+
+procedure chSwitch(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('S');
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gmSwitch
+end;
+
+procedure chNextTurn(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    TryDo(AllInactive, '/nextturn called when not all gears are inactive', true);
+
+    if not CurrentTeam^.ExtDriven then SendIPC('N');
+{$IFDEF DEBUGFILE}
+    AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));
+{$ENDIF}
+    perfExt_NewTurnBeginning();
+end;
+
+procedure chTimer(var s: shortstring);
+begin
+if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit;
+
+if not CurrentTeam^.ExtDriven then SendIPC(s);
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    begin
+    Message:= Message or gmTimer;
+    MsgParam:= byte(s[1]) - ord('0')
+    end
+end;
+
+procedure chSlot(var s: shortstring);
+var slot: LongWord;
+begin
+if (s[0] <> #1) or CheckNoTeamOrHH then exit;
+slot:= byte(s[1]) - 49;
+if slot > cMaxSlotIndex then exit;
+if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+bShowFinger:= false;
+with CurrentHedgehog^.Gear^ do
+    begin
+    Message:= Message or gmSlot;
+    MsgParam:= slot
+    end
+end;
+
+procedure chSetWeapon(var s: shortstring);
+begin
+    if (s[0] <> #1) or CheckNoTeamOrHH then exit;
+
+    if TAmmoType(s[1]) > High(TAmmoType) then exit;
+
+    if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
+
+    with CurrentHedgehog^.Gear^ do
+    begin
+        Message:= Message or gmWeapon;
+        MsgParam:= byte(s[1]);
+    end;
+end;
+
+procedure chTaunt(var s: shortstring);
+begin
+if (s[0] <> #1) or CheckNoTeamOrHH then exit;
+
+if TWave(s[1]) > High(TWave) then exit;
+
+if not CurrentTeam^.ExtDriven then SendIPC('t' + s);
+
+with CurrentHedgehog^.Gear^ do
+    begin
+    Message:= Message or gmAnimate;
+    MsgParam:= byte(s[1])
+    end
+end;
+
+procedure chPut(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    doPut(0, 0, false);
+end;
+
+procedure chCapture(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+flagMakeCapture:= true
+end;
+
+procedure chSetMap(var s: shortstring);
+begin
+if isDeveloperMode then
+begin
+Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
+InitStepsFlags:= InitStepsFlags or cifMap
+end
+end;
+
+procedure chSetTheme(var s: shortstring);
+begin
+if isDeveloperMode then
+begin
+Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s;
+InitStepsFlags:= InitStepsFlags or cifTheme
+end
+end;
+
+procedure chSetSeed(var s: shortstring);
+begin
+if isDeveloperMode then
+begin
+SetRandomSeed(s);
+cSeed:= s;
+InitStepsFlags:= InitStepsFlags or cifRandomize
+end
+end;
+
+procedure chAmmoMenu(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then
+    bShowAmmoMenu:= true
+else
+    begin
+    with CurrentTeam^ do
+        with Hedgehogs[CurrHedgehog] do
+            begin
+            bSelected:= false;
+
+            if bShowAmmoMenu then bShowAmmoMenu:= false
+            else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or
+                    ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or
+                    ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
+            end;
+    if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1
+    end
+end;
+
+procedure chVol_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+inc(cVolumeDelta, 3)
+end;
+
+procedure chVol_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+dec(cVolumeDelta, 3)
+end;
+
+procedure chFindhh(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH or isPaused then exit;
+bShowFinger:= true;
+FollowGear:= CurrentHedgehog^.Gear
+end;
+
+procedure chPause(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
+if gameType <> gmtNet then
+    isPaused:= not isPaused;
+SDL_ShowCursor(ord(isPaused))
+end;
+
+procedure chRotateMask(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if ((GameFlags and gfInvulnerable) = 0) then cTagsMask:= cTagsMasks[cTagsMask] else cTagsMask:= cTagsMasksNoHealth[cTagsMask];
+end;
+
+procedure chSpeedup_p(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+isSpeed:= true
+end;
+
+procedure chSpeedup_m(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+isSpeed:= false
+end;
+
+procedure chZoomIn(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    if ZoomValue < cMinZoomLevel then
+        ZoomValue:= ZoomValue + cZoomDelta;
+end;
+
+procedure chZoomOut(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    if ZoomValue > cMaxZoomLevel then
+        ZoomValue:= ZoomValue - cZoomDelta;
+end;
+
+procedure chZoomReset(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    ZoomValue:= cDefaultZoomLevel;
+end;
+
+
+procedure initModule;
+begin
+    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
+    RegisterVariable('script'  , vtCommand, @chScript       , false);
+    RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
+    RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
+    RegisterVariable('capture' , vtCommand, @chCapture      , true );
+    RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
+    RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
+    RegisterVariable('map'     , vtCommand, @chSetMap       , false);
+    RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
+    RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
+    RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
+    RegisterVariable('mapgen'  , vtLongInt, @cMapGen        , false);
+    RegisterVariable('maze_size',vtLongInt, @cMazeSize      , false);
+    RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
+    RegisterVariable('ready'   , vtLongInt, @cReadyDelay    , false);
+    RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
+    RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
+    RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
+    RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
+    RegisterVariable('waterrise', vtLongInt, @cWaterRise    , false);
+    RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
+    RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
+    RegisterVariable('ropepct' , vtLongInt, @cRopePercent   , false);
+    RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
+    RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
+    RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
+    RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
+    RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
+    RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
+    RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
+    RegisterVariable('fort'    , vtCommand, @chFort         , false);
+    RegisterVariable('grave'   , vtCommand, @chGrave        , false);
+    RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
+    RegisterVariable('quit'    , vtCommand, @chQuit         , true );
+    RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
+    RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
+    RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
+    RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
+    RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
+    RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
+    RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
+    RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
+    RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
+    RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
+    RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
+    RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
+    RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
+    RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
+    RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
+    RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
+    RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
+    RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
+    RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
+    RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
+    RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
+    RegisterVariable('timer'   , vtCommand, @chTimer        , false);
+    RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
+    RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
+    RegisterVariable('slot'    , vtCommand, @chSlot         , false);
+    RegisterVariable('put'     , vtCommand, @chPut          , false);
+    RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
+    RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
+    RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
+    RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
+    RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
+    RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
+    RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
+    RegisterVariable('pause'   , vtCommand, @chPause        , true );
+    RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
+    RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
+    RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
+    RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
+    RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
+    RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
+    RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
+    RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
+end;
+
+procedure freeModule;
+begin
+end;
+
+end.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uCommands.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -0,0 +1,135 @@
+{$INCLUDE "options.inc"}
+
+unit uCommands;
+
+interface
+
+var isDeveloperMode: boolean;
+type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
+     TCommandHandler = procedure (var params: shortstring);
+
+procedure initModule;
+procedure freeModule;
+procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean);
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
+procedure StopMessages(Message: Longword);
+
+implementation
+uses Types, uConsts, uVariables, uConsole, uUtils, uDebug;
+
+type  PVariable = ^TVariable;
+      TVariable = record
+                     Next: PVariable;
+                     Name: string[15];
+                    VType: TVariableType;
+                  Handler: pointer;
+                  Trusted: boolean;
+                  end;
+
+var
+      Variables: PVariable;
+
+procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean);
+var value: PVariable;
+begin
+New(value);
+TryDo(value <> nil, 'RegisterVariable: value = nil', true);
+FillChar(value^, sizeof(TVariable), 0);
+value^.Name:= Name;
+value^.VType:= VType;
+value^.Handler:= p;
+value^.Trusted:= Trusted;
+
+if Variables = nil then Variables:= value
+                   else begin
+                        value^.Next:= Variables;
+                        Variables:= value
+                        end;
+end;
+
+
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
+var ii: LongInt;
+    s: shortstring;
+    t: PVariable;
+    c: char;
+begin
+//WriteLnToConsole(CmdStr);
+if CmdStr[0]=#0 then exit;
+{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
+c:= CmdStr[1];
+if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
+s:= '';
+SplitBySpace(CmdStr, s);
+t:= Variables;
+while t <> nil do
+      begin
+      if t^.Name = CmdStr then
+         begin
+         if TrustedSource or t^.Trusted then
+            case t^.VType of
+              vtCommand: if c='/' then
+                         begin
+                         TCommandHandler(t^.Handler)(s);
+                         end;
+              vtLongInt: if c='$' then
+                         if s[0]=#0 then
+                            begin
+                            str(PLongInt(t^.Handler)^, s);
+                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+                            end else val(s, PLongInt(t^.Handler)^);
+              vthwFloat: if c='$' then
+                         if s[0]=#0 then
+                            begin
+                            //str(PhwFloat(t^.Handler)^:4:6, s);
+                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+                            end else; //val(s, PhwFloat(t^.Handler)^, i);
+             vtBoolean: if c='$' then
+                         if s[0]=#0 then
+                            begin
+                            str(ord(boolean(t^.Handler^)), s);
+                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
+                            end else
+                            begin
+                            val(s, ii);
+                            boolean(t^.Handler^):= not (ii = 0)
+                            end;
+              end;
+         exit
+         end else t:= t^.Next
+      end;
+case c of
+     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
+     else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
+end;
+
+
+procedure StopMessages(Message: Longword);
+begin
+if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else
+if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else
+if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else
+if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else
+if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true)
+end;
+
+procedure initModule;
+begin
+    Variables:= nil;
+    isDeveloperMode:= true;
+end;
+
+procedure freeModule;
+var t, tt: PVariable;
+begin
+    tt:= Variables;
+    Variables:= nil;
+    while tt <> nil do
+    begin
+        t:= tt;
+        tt:= tt^.Next;
+        Dispose(t)
+    end;
+end;
+
+end.
--- a/hedgewars/uConsts.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uConsts.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -21,7 +21,7 @@
 unit uConsts;
 interface
 
-uses    SDLh, uFloat, uLocale, GLunit;
+uses    SDLh, uFloat, GLunit;
 
 
 {$INCLUDE "config.inc"}
@@ -29,170 +29,6 @@
 // typed const is a variable despite const qualifier
 // in freepascal you may actually use var for the same purpose
 
-type
-    HwColor4f = record
-        r, g, b, a: byte
-        end;
-
-    TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit);
-
-    TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax);
-
-    TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
-            ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
-            ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps);
-
-    TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
-            sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
-            sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
-            sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower,
-            sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont,
-            sprHorizontL, sprHorizontR, sprSky, sprSkyL,
-            sprSkyR, sprAMBorderHorizontal, sprAMBorderVertical, sprAMSlot, sprAMAmmos,
-            sprAMSlotKeys, sprAMCorners, sprFinger, sprAirBomb,
-            sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask,
-            sprSwitch, sprParachute, sprTarget, sprRopeNode,
-            sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR,
-            sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun,
-            sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
-            sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
-            sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
-            sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
-            sprHurrah, sprLemonade, sprShrug, sprJuggle, sprExplPart, sprExplPart2,
-            sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon,
-            sprEvilTrace, sprHellishBomb, sprSeduction, sprDress,
-            sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls,
-            sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprVampiric, sprGirder,
-            sprSpeechCorner, sprSpeechEdge, sprSpeechTail,
-            sprThoughtCorner, sprThoughtEdge, sprThoughtTail,
-            sprShoutCorner, sprShoutEdge, sprShoutTail,
-            sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
-            sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll,
-            sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction,
-            sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster,
-            sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
-            sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee,
-            sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal,
-            sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
-            sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
-            sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
-            sprBulletHit
-            );
-
-    // Gears that interact with other Gears and/or Land
-    TGearType = (gtBomb, gtHedgehog, gtShell, gtGrave, gtBee, // 4
-            gtShotgunShot, gtPickHammer, gtRope, gtMine, gtCase, // 9
-            gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 14
-            gtFlame, gtFirePunch, gtATStartGame, gtATSmoothWindCh, // 18
-            gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
-            gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 28
-            gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34
-            gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40
-            gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45
-            gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
-            gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56
-            gtNapalmBomb); // 57
-
-    // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
-    TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
-            vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
-            vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
-            vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
-            vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
-            vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail,
-            vgtBulletHit);
-
-    TGearsType = set of TGearType;
-
-    TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison);
-
-    TSound = (sndNone,
-            sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease,
-            sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact,
-            sndMineTick, sndPickhammer, sndGun, sndBee, sndJump1, sndJump2,
-            sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming,
-            sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye,
-            sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret,
-            sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze,
-            sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2,
-            sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6,
-            sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack,
-            sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat,
-            sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter,
-            sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops,
-            sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
-            sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity,
-            sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
-            sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
-            sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
-            sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8,
-            sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
-            sndComeonthen, sndParachute, sndBump, sndResurrector);
-
-    TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
-            amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
-            amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18
-            amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24
-            amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30
-            amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
-            amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
-            amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
-            amResurrector, amDrillStrike);
-
-    TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
-
-    THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF});
-
-    TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume,
-            capgrpMessage, capgrpAmmostate);
-
-    TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
-            siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
-            siMaxTeamKills, siMaxTurnSkips );
-
-    TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
-
-    THHFont = record
-            Handle: PTTF_Font;
-            Height: LongInt;
-            style: LongInt;
-            Name: string[21];
-            end;
-
-    PAmmo = ^TAmmo;
-    TAmmo = record
-            Propz: LongWord;
-            Count: LongWord;
-(* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
-For example, say, a mode where the weaponset is reset each turn, or on sudden death *)
-            NumPerTurn: LongWord;
-            Timer: LongWord;
-            Pos: LongWord;
-            AmmoType: TAmmoType;
-            AttackVoice: TSound;
-            end;
-
-    TVertex2f = record
-        X, Y: GLfloat;
-        end;
-
-    TVertex2i = record
-        X, Y: GLint;
-        end;
-
-    PTexture = ^TTexture;
-    TTexture = record
-            id: GLuint;
-            w, h, scale: LongInt;
-            rx, ry: GLfloat;
-            priority: GLfloat;
-            vb, tb: array [0..3] of TVertex2f;
-            PrevTexture, NextTexture: PTexture;
-            end;
-
-    THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected);
-
-    TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite);
 const
     sfMax = 1000;
     cDefaultParamNum = 16;
@@ -267,6 +103,7 @@
     cPowerDivisor = 1500;
 
     MAXNAMELEN = 192;
+    MAXROPEPOINTS = 3840;
 
     // some opengl headers do not have these macros
     GL_BGR              = $80E0;
@@ -287,7 +124,7 @@
 
     cTransparentColor: Longword = $00000000;
 
-    cMaxTeams        = 6;
+    cMaxTeams        = 8;
     cMaxHHIndex      = 7;
     cMaxHHs          = 48;
     cMaxSpawnPoints  = 1024;
@@ -442,1847 +279,7 @@
     htHealth      = $04;
     htTransparent = $08;
 
-    cHHFileName = 'Hedgehog';
-    cCHFileName = 'Crosshair';
-    cThemeCFGFilename = 'theme.cfg';
 
-    FontBorder = 2;
-    cPathz: array[TPathType] of shortstring = (
-        '',                              // ptNone
-        '',                              // ptData
-        'Graphics',                      // ptGraphics
-        'Themes',                        // ptThemes
-        'Themes/avematan',               // ptCurrTheme
-        'Teams',                         // ptTeams
-        'Maps',                          // ptMaps
-        '',                              // ptMapCurrent
-        'Demos',                         // ptDemos
-        'Sounds',                        // ptSounds
-        'Graphics/Graves',               // ptGraves
-        'Fonts',                         // ptFonts
-        'Forts',                         // ptForts
-        'Locale',                        // ptLocale
-        'Graphics/AmmoMenu',             // ptAmmoMenu
-        'Graphics/Hedgehog',             // ptHedgehog
-        'Sounds/voices',                 // ptVoices
-        'Graphics/Hats',                 // ptHats
-        'Graphics/Flags',                // ptFlags
-        'Missions/Maps'                  // ptMissionMaps
-    );
-
-    cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
-    cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0);
-
-    Fontz: array[THWFont] of THHFont = (
-            (Handle: nil;
-            Height: 12;
-            style: TTF_STYLE_NORMAL;
-            Name: 'DejaVuSans-Bold.ttf'),
-            (Handle: nil;
-            Height: 24;
-            style: TTF_STYLE_NORMAL;
-            Name: 'DejaVuSans-Bold.ttf'),
-            (Handle: nil;
-            Height: 10;
-            style: TTF_STYLE_NORMAL;
-            Name: 'DejaVuSans-Bold.ttf')
-            {$IFNDEF IPHONEOS}, // remove chinese fonts for now
-            (Handle: nil;
-            Height: 12;
-            style: TTF_STYLE_NORMAL;
-            Name: 'wqy-zenhei.ttc'),
-            (Handle: nil;
-            Height: 24;
-            style: TTF_STYLE_NORMAL;
-            Name: 'wqy-zenhei.ttc'),
-            (Handle: nil;
-            Height: 10;
-            style: TTF_STYLE_NORMAL;
-            Name: 'wqy-zenhei.ttc')
-            {$ENDIF}
-            );
-
-    SpritesData: array[TSprite] of record
-            FileName: String[16];
-            Path, AltPath: TPathType;
-            Texture: PTexture;
-            Surface: PSDL_Surface;
-            Width, Height, imageWidth, imageHeight: LongInt;
-            saveSurf: boolean;
-            priority: GLfloat;
-            getDimensions, getImageDimensions: boolean;
-            end = (
-            (FileName:  'BlueWater'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: true; getImageDimensions: true),// sprWater
-            (FileName:     'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
-            Width: 256; Height:128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCloud
-            (FileName:       'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBomb
-            (FileName:  'BigDigits'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBigDigit
-            (FileName:      'Frame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   4; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprFrame
-            (FileName:        'Lag'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  65; Height: 65; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprLag
-            (FileName:      'Arrow'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCursor
-            (FileName:'BazookaShell'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBazookaShell
-            (FileName:    'Targetp'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTargetP
-            (FileName:        'Bee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBee
-            (FileName: 'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmokeTrace
-            (FileName:   'RopeHook'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprRopeHook
-            (FileName:     'Expl50'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosion50
-            (FileName:    'MineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineOff
-            (FileName:     'MineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineOn
-            (FileName:     'MineDead'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMineDead
-            (FileName:       'Case'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprCase
-            (FileName:   'FirstAid'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprFAid
-            (FileName:   'dynamite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDynamite
-            (FileName:      'Power'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprPower
-            (FileName:     'ClBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprClusterBomb
-            (FileName: 'ClParticle'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprClusterParticle
-            (FileName:      'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlame
-            (FileName:   'horizont'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
-            (FileName:  'horizontL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
-            (FileName:  'horizontR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprHorizont
-            (FileName:        'Sky'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
-            (FileName:       'SkyL'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
-            (FileName:       'SkyR'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   0; Height:  0; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: true; getImageDimensions: true),// sprSky
-            (FileName:  'BorderHorizontal'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 33; Height:  2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderHorizontal
-            (FileName:  'BorderVertical'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 2; Height: 33; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprAMBorderVertical
-            (FileName:   'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 33; Height: 33; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlot
-            (FileName:      'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMAmmos
-            (FileName:   'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMSlotKeys
-            (FileName:  'Corners'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  2; Height: 2; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAMCorners
-            (FileName:     'Finger'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprFinger
-            (FileName:    'AirBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirBomb
-            (FileName:   'Airplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 254; Height: 101; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAirplane
-            (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmAirplane
-            (FileName:   'amGirder'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 160; Height:160; imageWidth: 0; imageHeight: 0; saveSurf:  true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmGirder
-            (FileName:     'hhMask'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf:  true; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHHTelepMask
-            (FileName:     'Switch'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSwitch
-            (FileName:  'Parachute'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprParachute
-            (FileName:     'Target'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTarget
-            (FileName:   'RopeNode'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   6; Height:  6; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprRopeNode
-            (FileName:   'thinking'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprQuestion
-            (FileName:   'PowerBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 256; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPowerBar
-            (FileName:    'WindBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 151; Height: 17; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindBar
-            (FileName:      'WindL'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindL
-            (FileName:      'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  80; Height: 13; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWindR
-            (FileName:      'Flake'; Path:ptCurrTheme; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFlake
-            (FileName:     'amRope'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandRope
-            (FileName:  'amBazooka'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBazooka
-            (FileName:  'amShotgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandShotgun
-            (FileName:   'amDEagle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDEagle
-            (FileName:'amAirAttack'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandAirAttack
-            (FileName: 'amBaseball'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBaseball
-            (FileName:     'Hammer'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPHammer
-            (FileName: 'amBTorch_i'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBlowTorch
-            (FileName: 'amBTorch_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBlowTorch
-            (FileName:   'Teleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTeleport
-            (FileName:    'HHDeath'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprHHDeath
-            (FileName:'amShotgun_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprShotgun
-            (FileName: 'amDEagle_w'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDEagle
-            (FileName:       'Idle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprHHIdle
-            (FileName:     'Mortar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMortar
-            (FileName:  'TurnsLeft'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTurnsLeft
-            (FileName: 'amKamikaze'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 256; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprKamikaze
-            (FileName:     'amWhip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWhip
-            (FileName:     'Kowtow'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprKowtow
-            (FileName:        'Sad'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSad
-            (FileName:       'Wave'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprWave
-            (FileName:     'Hurrah'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprHurrah
-            (FileName:'ILoveLemonade';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprLemonade
-            (FileName:      'Shrug'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 32;  Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShrug
-            (FileName:     'Juggle'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 32;  Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprJuggle
-            (FileName:   'ExplPart'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplPart
-            (FileName:  'ExplPart2'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplPart2
-            (FileName:  'Cake_walk'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCakeWalk
-            (FileName:  'Cake_down'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCakeDown
-            (FileName:   'Ammos_bw'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprAMAmmosBW
-            (FileName: 'Watermelon'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprWatermelon
-            (FileName:  'EvilTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprEvilTrace
-            (FileName:'HellishBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHellishBomb
-            (FileName:  'Seduction'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSeduction
-            (FileName:    'HHDress'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprDress
-            (FileName:   'Censored'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprCensored
-            (FileName:      'Drill'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprDrill
-            (FileName:    'amDrill'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDrill
-            (FileName:  'amBallgun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBallgun
-            (FileName:      'Balls'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBalls
-            (FileName:    'RCPlane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPlane
-            (FileName:  'amRCPlane'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandPlane
-            (FileName:    'Utility'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprUtility
-            (FileName:'Invulnerable';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprInvulnerable
-            (FileName:   'Vampiric'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprVampiric
-            (FileName:   'amGirder'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 512; Height:512; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprGirder
-            (FileName:'SpeechCorner';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  12; Height: 9; imageWidth: 0; imageHeight: 0; saveSurf:  true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechCorner
-            (FileName: 'SpeechEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  25; Height: 9; imageWidth: 0; imageHeight: 0; saveSurf:  true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechEdge
-            (FileName: 'SpeechTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  25; Height: 26; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprSpeechTail
-            (FileName:'ThoughtCorner';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  49; Height: 37; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtCorner
-            (FileName:'ThoughtEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  23; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtEdge
-            (FileName:'ThoughtTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  45; Height: 65; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprThoughtTail
-            (FileName:'ShoutCorner'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  34; Height: 23; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutCorner
-            (FileName:  'ShoutEdge'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  30; Height: 20; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutEdge
-            (FileName:  'ShoutTail'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  30; Height: 37; imageWidth: 0; imageHeight: 0; saveSurf: true; priority: tpLowest; getDimensions: false; getImageDimensions: true),// sprShoutTail
-            (FileName:'amSniperRifle';Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSniperRifle
-            (FileName:    'Bubbles'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprBubbles
-            (FileName:  'amJetpack'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprJetpack
-            (FileName:  'Health'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprHealth
-            (FileName:  'amMolotov'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),//sprHandMolotov
-            (FileName:  'Molotov'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprMolotov
-            (FileName: 'Smoke'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmoke
-            (FileName: 'SmokeWhite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprSmokeWhite
-            (FileName: 'Shells'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: true),// sprShell
-            (FileName: 'Dust'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
-            Width:  22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprDust
-            (FileName: 'Explosives'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosives
-            (FileName: 'ExplosivesRoll'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprExplosivesRoll
-            (FileName: 'amTeleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprAmTeleport
-            (FileName: 'Splash'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
-            Width:  80; Height: 50; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSplash
-            (FileName: 'Droplet'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprDroplet
-            (FileName: 'Birdy'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  75; Height: 75; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBirdy
-            (FileName:  'amCake'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCake
-            (FileName:  'amConstruction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandConstruction
-            (FileName:  'amGrenade'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandGrenade
-            (FileName:  'amMelon'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMelon
-            (FileName:  'amMortar'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMortar
-            (FileName:  'amSkip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSkip
-            (FileName:  'amCluster'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCluster
-            (FileName:  'amDynamite'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandDynamite
-            (FileName:  'amHellish'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandHellish
-            (FileName:  'amMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandMine
-            (FileName:  'amSeduction'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSeduction
-            (FileName:  'amVamp'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandVamp
-            (FileName:  'BigExplosion'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  385; Height: 385; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprBigExplosion
-            (FileName:  'SmokeRing'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  200; Height: 200; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSmokeRing
-            (FileName:  'BeeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHigh; getDimensions: false; getImageDimensions: true),// sprBeeTrace
-            (FileName:  'Egg'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprEgg
-            (FileName:  'TargetBee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprTargetBee
-            (FileName:  'amBee'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandBee
-            (FileName:  'Feather'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  15; Height: 25; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpHighest; getDimensions: false; getImageDimensions: true),// sprFeather
-            (FileName:  'Piano'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPiano
-            (FileName:  'amSineGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSineGun
-            (FileName:  'amPortalGun'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 128; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPortalGun
-            (FileName:  'Portal'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprPortal
-            (FileName:  'cheese'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprCheese
-            (FileName:  'amCheese'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCheese
-            (FileName:  'amFlamethrower'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandFlamethrower
-            (FileName:  'Chunk'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprChunk
-            (FileName:  'Note'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprNote
-            (FileName:   'SMineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOff
-            (FileName:    'SMineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:   8; Height:  8; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprSMineOn
-            (FileName:   'amSMine'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width:  64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandSMine
-            (FileName:  'amHammer'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-            Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true), // sprWhip
-            (FileName: 'amResurrector'; Path: ptHedgehog; AltPath: ptNone;
-                Texture: nil; Surface: nil; Width: 32; Height: 32;
-                imageWidth: 0; imageHeight: 0; saveSurf: false; priority:
-                tpMedium; getDimensions: false; getImageDimensions: true),
-            //sprHandResurrector
-            (FileName: 'Cross'; Path: ptGraphics; altPath: ptNone;
-                Texture: nil; Surface: nil; Width: 108; Height: 138;
-                imageWidth: 0; imageHeight: 0; saveSurf: false; priority:
-                tpMedium; getDimensions: false; getImageDimensions: true),
-            //sprCross
-            (FileName:  'AirDrill'; Path: ptGraphics; AltPath: ptNone;
-                Texture: nil; Surface: nil; Width:  16; Height: 16;
-                imageWidth: 0; imageHeight: 0; saveSurf: false; priority:
-                tpMedium; getDimensions: false; getImageDimensions: true),
-            // sprAirDrill
-            (FileName:  'NapalmBomb'; Path: ptGraphics; AltPath: ptNone;
-                Texture: nil; Surface: nil; Width:  16; Height: 16;
-                imageWidth: 0; imageHeight: 0; saveSurf: false; priority:
-                tpMedium; getDimensions: false; getImageDimensions: true),
-            // sprNapalmBomb
-            (FileName:  'BulletHit'; Path: ptGraphics; AltPath: ptNone;
-                Texture: nil; Surface: nil; Width:  32; Height: 32;
-                imageWidth: 0; imageHeight: 0; saveSurf: false; priority:
-                tpMedium; getDimensions: false; getImageDimensions: true)
-            // sprNapalmBomb
-            );
-
-
-    Wavez: array [TWave] of record
-            Sprite: TSprite;
-            FramesCount: Longword;
-            Interval: Longword;
-            cmd: String[20];
-            Voice: TSound;
-            VoiceDelay: LongWord;
-            end = (
-            (Sprite:   sprKowtow; FramesCount: 12; Interval: 125; cmd: '/rollup'; Voice: sndNone; VoiceDelay: 0),
-            (Sprite:      sprSad; FramesCount: 14; Interval: 125; cmd: '/sad'; Voice: sndNone; VoiceDelay: 0),
-            (Sprite:     sprWave; FramesCount: 16; Interval: 125; cmd: '/wave'; Voice: sndHello; VoiceDelay: 5),
-            (Sprite:   sprHurrah; FramesCount: 14; Interval: 125; cmd: '/hurrah'; Voice: sndNone; VoiceDelay: 0),
-            (Sprite: sprLemonade; FramesCount: 24; Interval: 125; cmd: '/ilovelotsoflemonade'; Voice: sndNone; VoiceDelay: 0),
-            (Sprite:    sprShrug; FramesCount: 24; Interval: 125; cmd: '/shrug'; Voice: sndNone; VoiceDelay: 0),
-            (Sprite:   sprJuggle; FramesCount: 49; Interval:  38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0)
-            );
-
-    Soundz: array[TSound] of record
-            FileName: String[25];
-            Path    : TPathType;
-            end = (
-            (FileName:                         ''; Path: ptNone  ),// sndNone
-            (FileName:        'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact
-            (FileName:            'explosion.ogg'; Path: ptSounds),// sndExplosion
-            (FileName:         'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp
-            (FileName:         'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease
-            (FileName:               'splash.ogg'; Path: ptSounds),// sndSplash
-            (FileName:        'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload
-            (FileName:          'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire
-            (FileName:          'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact
-            (FileName:             'minetick.ogg'; Path: ptSounds),// sndMineTicks
-            (FileName:           'pickhammer.ogg'; Path: ptSounds),// sndPickhammer
-            (FileName:                  'gun.ogg'; Path: ptSounds),// sndGun
-            (FileName:                  'bee.ogg'; Path: ptSounds),// sndBee
-            (FileName:                'Jump1.ogg'; Path: ptVoices),// sndJump1
-            (FileName:                'Jump2.ogg'; Path: ptVoices),// sndJump2
-            (FileName:                'Jump3.ogg'; Path: ptVoices),// sndJump3
-            (FileName:               'Yessir.ogg'; Path: ptVoices),// sndYesSir
-            (FileName:                'Laugh.ogg'; Path: ptVoices),// sndLaugh
-            (FileName:            'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
-            (FileName:             'Incoming.ogg'; Path: ptVoices),// sndIncoming
-            (FileName:               'Missed.ogg'; Path: ptVoices),// sndMissed
-            (FileName:               'Stupid.ogg'; Path: ptVoices),// sndStupid
-            (FileName:           'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
-            (FileName:               'Boring.ogg'; Path: ptVoices),// sndBoring
-            (FileName:               'Byebye.ogg'; Path: ptVoices),// sndByeBye
-            (FileName:             'Sameteam.ogg'; Path: ptVoices),// sndSameTeam
-            (FileName:               'Nutter.ogg'; Path: ptVoices),// sndNutter
-            (FileName:       'Reinforcements.ogg'; Path: ptVoices),// sndReinforce
-            (FileName:              'Traitor.ogg'; Path: ptVoices),// sndTraitor
-            (FileName:      'Youllregretthat.ogg'; Path: ptVoices),// sndRegret
-            (FileName:            'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown
-            (FileName:               'Coward.ogg'; Path: ptVoices),// sndCoward
-            (FileName:                'Hurry.ogg'; Path: ptVoices),// sndHurry
-            (FileName:              'Watchit.ogg'; Path: ptVoices),// sndWatchIt
-            (FileName:             'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze
-            (FileName:                'cake2.ogg'; Path: ptSounds),// sndCake
-            (FileName:                  'Ow1.ogg'; Path: ptVoices),// sndOw1
-            (FileName:                  'Ow2.ogg'; Path: ptVoices),// sndOw2
-            (FileName:                  'Ow3.ogg'; Path: ptVoices),// sndOw3
-            (FileName:                  'Ow4.ogg'; Path: ptVoices),// sndOw4
-            (FileName:           'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1
-            (FileName:           'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2
-            (FileName:           'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3
-            (FileName:           'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4
-            (FileName:           'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5
-            (FileName:           'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6
-            (FileName:                'Melon.ogg'; Path: ptVoices),// sndMelon
-            (FileName:              'Hellish.ogg'; Path: ptSounds),// sndHellish
-            (FileName:               'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo
-            (FileName:              'rcplane.ogg'; Path: ptSounds),// sndRCPlane
-            (FileName:            'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack
-            (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds),// sndRideOfTheValkyries
-            (FileName:               'denied.ogg'; Path: ptSounds),// sndDenied
-            (FileName:               'placed.ogg'; Path: ptSounds),// sndPlaced
-            (FileName:          'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat
-            (FileName:                'steam.ogg'; Path: ptSounds),// sndVaporize
-            (FileName:                 'warp.ogg'; Path: ptSounds),// sndWarp
-            (FileName:          'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath
-            (FileName:               'mortar.ogg'; Path: ptSounds),// sndMortar
-            (FileName:         'shutterclick.ogg'; Path: ptSounds),// sndShutter
-            (FileName:              'homerun.ogg'; Path: ptSounds),// sndHomerun
-            (FileName:              'molotov.ogg'; Path: ptSounds),// sndMolotov
-            (FileName:            'Takecover.ogg'; Path: ptVoices),// sndCover
-            (FileName:                'Uh-oh.ogg'; Path: ptVoices),// sndUhOh
-            (FileName:                 'Oops.ogg'; Path: ptVoices),// sndOops
-            (FileName:                 'Nooo.ogg'; Path: ptVoices),// sndNooo
-            (FileName:                'Hello.ogg'; Path: ptVoices),// sndHello
-            (FileName:             'ropeshot.ogg'; Path: ptSounds),// sndRopeShot
-            (FileName:           'ropeattach.ogg'; Path: ptSounds),// sndRopeAttach
-            (FileName:          'roperelease.ogg'; Path: ptSounds),// sndRopeRelease
-            (FileName:            'switchhog.ogg'; Path: ptSounds),// sndSwitchHog
-            (FileName:              'victory.ogg'; Path: ptVoices),// sndVictory
-            (FileName:         'sniperreload.ogg'; Path: ptSounds),// sndSniperReload
-            (FileName:                'steps.ogg'; Path: ptSounds),// sndSteps
-            (FileName:           'lowgravity.ogg'; Path: ptSounds),// sndLowGravity
-            (FileName:           'hell_growl.ogg'; Path: ptSounds),// sndHellishImpact1
-            (FileName:            'hell_ooff.ogg'; Path: ptSounds),// sndHellishImpact2
-            (FileName:              'hell_ow.ogg'; Path: ptSounds),// sndHellishImpact3
-            (FileName:             'hell_ugh.ogg'; Path: ptSounds),// sndHellishImpact4
-            (FileName:          'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact
-            (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndDroplet1
-            (FileName:             'Droplet2.ogg'; Path: ptSounds),// sndDroplet2
-            (FileName:             'Droplet3.ogg'; Path: ptSounds),// sndDroplet3
-            (FileName:                  'egg.ogg'; Path: ptSounds),// sndEggBreak
-            (FileName:             'drillgun.ogg'; Path: ptSounds),// sndDrillRocket
-            (FileName:          'PoisonCough.ogg'; Path: ptVoices),// sndPoisonCough
-            (FileName:           'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan
-            (FileName:             'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay
-            (FileName:              'Whistle.ogg'; Path: ptSounds),// sndWhistle
-            (FileName:             'beewater.ogg'; Path: ptSounds),// sndBeeWater
-            (FileName:                   '1C.ogg'; Path: ptSounds),// sndPiano0
-            (FileName:                   '2D.ogg'; Path: ptSounds),// sndPiano1
-            (FileName:                   '3E.ogg'; Path: ptSounds),// sndPiano2
-            (FileName:                   '4F.ogg'; Path: ptSounds),// sndPiano3
-            (FileName:                   '5G.ogg'; Path: ptSounds),// sndPiano4
-            (FileName:                   '6A.ogg'; Path: ptSounds),// sndPiano5
-            (FileName:                   '7B.ogg'; Path: ptSounds),// sndPiano6
-            (FileName:                   '8C.ogg'; Path: ptSounds),// sndPiano7
-            (FileName:                   '9D.ogg'; Path: ptSounds),// sndPiano8
-            (FileName:                 'skip.ogg'; Path: ptSounds),// sndSkip
-            (FileName:          'shotgunfire.ogg'; Path: ptSounds),// sndSineGun
-            (FileName:                'Ooff1.ogg'; Path: ptVoices),// sndOoff1
-            (FileName:                'Ooff2.ogg'; Path: ptVoices),// sndOoff2
-            (FileName:                'Ooff3.ogg'; Path: ptVoices),// sndOoff3
-            (FileName:            'whipcrack.ogg'; Path: ptSounds),// sndWhack
-            (FileName:           'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen
-            (FileName:            'parachute.ogg'; Path: ptSounds),// sndParachute
-            (FileName:                 'bump.ogg'; Path: ptSounds),// sndBump
-            (FileName: 'hogchant3.ogg'; Path: ptSounds) // sndResurrector
-            );
-
-    Ammoz: array [TAmmoType] of record
-            NameId: TAmmoStrId;
-            NameTex: PTexture;
-            Probability, NumberInCase: Longword;
-            Ammo: TAmmo;
-            Slot: 0..cMaxSlotIndex;
-            TimeAfterTurn: Longword;
-            minAngle, maxAngle: Longword;
-            isDamaging: boolean;
-            SkipTurns: Longword;
-            PosCount: Longword;
-            PosSprite: TSprite;
-            ejectX, ejectY: Longint;
-            end = (
-            (NameId: sidNothing;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 0;
-            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Effect;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amNothing;
-                AttackVoice: sndNone);
-            Slot: 0;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 9999;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Grenade
-            (NameId: sidGrenade;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 3000;
-                Pos: 0;
-                AmmoType: amGrenade;
-                AttackVoice: sndCover);
-            Slot: 1;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// ClusterBomb
-            (NameId: sidClusterBomb;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 3;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
-                Count: 5;
-                NumPerTurn: 0;
-                Timer: 3000;
-                Pos: 0;
-                AmmoType: amClusterBomb;
-                AttackVoice: sndCover);
-            Slot: 1;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Bazooka
-            (NameId: sidBazooka;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amBazooka;
-                AttackVoice: sndNone);
-            Slot: 0;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //20;
-            ejectY: -6),
-
-// Bee
-            (NameId: sidBee;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget or ammoprop_DontHold;
-                Count: 2;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amBee;
-                AttackVoice: sndNone);
-            Slot: 0;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //16;
-            ejectY: 0),
-
-// Shotgun
-            (NameId: sidShotgun;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 1;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amShotgun;
-                AttackVoice: sndNone);
-            Slot: 2;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //26;
-            ejectY: -6),
-
-// PickHammer
-            (NameId: sidPickHammer;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_NoCrosshair or ammoprop_DontHold;
-                Count: 2;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amPickHammer;
-                AttackVoice: sndNone);
-            Slot: 6;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Skip
-            (NameId: sidSkip;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amSkip;
-                AttackVoice: sndNone);
-            Slot: 9;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Rope
-            (NameId: sidRope;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 3;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_ForwMsgs or
-                          ammoprop_AttackInMove or
-                          ammoprop_Utility or
-                          ammoprop_AltAttack;
-                    Count: 5;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amRope;
-                    AttackVoice: sndNone);
-            Slot: 7;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: cMaxAngle div 2;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Mine
-            (NameId: sidMine;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
-                Count: 2;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amMine;
-                AttackVoice: sndLaugh);
-            Slot: 4;
-            TimeAfterTurn: 5000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// DEagle
-            (NameId: sidDEagle;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 2;
-            Ammo: (Propz: 0;
-                Count: 3;
-                NumPerTurn: 3;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amDEagle;
-                AttackVoice: sndNone);
-            Slot: 2;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //23;
-            ejectY: -6),
-
-// Dynamite
-            (NameId: sidDynamite;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amDynamite;
-                AttackVoice: sndLaugh);
-            Slot: 4;
-            TimeAfterTurn: 5000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// FirePunch
-            (NameId: sidFirePunch;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInMove;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amFirePunch;
-                AttackVoice: sndNone);
-            Slot: 3;
-            TimeAfterTurn: 3000;
-            MinAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Whip
-            (NameId: sidWhip;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amWhip;
-                AttackVoice: sndNone);
-            Slot: 3;
-            TimeAfterTurn: 3000;
-            MinAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// BaseballBat
-            (NameId: sidBaseballBat;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_DontHold;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amBaseballBat;
-                AttackVoice: sndNone);
-            Slot: 3;
-            TimeAfterTurn: 5000;
-            minAngle: 0;
-            maxAngle: cMaxAngle div 2;
-            isDamaging: true;
-            SkipTurns: 2;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Parachute
-            (NameId: sidParachute;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_ForwMsgs or
-                          ammoprop_AttackInMove or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_Utility or
-                          ammoprop_AltAttack;
-                Count: 2;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amParachute;
-                AttackVoice: sndNone);
-            Slot: 7;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// AirAttack
-            (NameId: sidAirAttack;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or
-                            ammoprop_NeedTarget or
-                            ammoprop_AttackingPut or
-                            ammoprop_DontHold or
-                            ammoprop_NotBorder;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amAirAttack;
-                AttackVoice: sndIncoming);
-            Slot: 5;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 5;
-            PosCount: 2;
-            PosSprite: sprAmAirplane;
-            ejectX: 0;
-            ejectY: 0),
-
-// MineStrike
-            (NameId: sidMineStrike;
-            NameTex: nil;
-            Probability: 200;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or
-                            ammoprop_NeedTarget or
-                            ammoprop_AttackingPut or
-                            ammoprop_DontHold or
-                            ammoprop_NotBorder;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amMineStrike;
-                AttackVoice: sndIncoming);
-            Slot: 5;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 5;
-            PosCount: 2;
-            PosSprite: sprAmAirplane;
-            ejectX: 0;
-            ejectY: 0),
-
-// BlowTorch
-            (NameId: sidBlowTorch;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 2;
-            Ammo: (Propz: ammoprop_ForwMsgs;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amBlowTorch;
-                AttackVoice: sndNone);
-            Slot: 6;
-            TimeAfterTurn: 3000;
-            minAngle: 768;
-            maxAngle: 1280;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Girder
-            (NameId: sidGirder;
-            NameTex: nil;
-            Probability: 150;
-            NumberInCase: 3;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_NeedTarget or
-                          ammoprop_Utility or
-                          ammoprop_AttackingPut;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amGirder;
-                    AttackVoice: sndNone);
-            Slot: 6;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 8;
-            PosSprite: sprAmGirder;
-            ejectX: 0;
-            ejectY: 0),
-
-// Teleport
-            (NameId: sidTeleport;
-            NameTex: nil;
-            Probability: 200;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or
-                          ammoprop_NoCrosshair or
-                          ammoprop_NeedTarget or
-                          ammoprop_AttackingPut or
-                          ammoprop_Utility or
-                          ammoprop_DontHold;
-                Count: 2;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amTeleport;
-                AttackVoice: sndNone);
-            Slot: 7;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 2;
-            PosSprite: sprAmTeleport;
-            ejectX: 0;
-            ejectY: 0),
-
-// Switch
-            (NameId: sidSwitch;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_ForwMsgs or
-                          ammoprop_NoCrosshair or
-                          ammoprop_Utility or
-                          ammoprop_DontHold;
-                    Count: 3;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amSwitch;
-                    AttackVoice: sndNone);
-            Slot: 9;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Mortar
-            (NameId: sidMortar;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 4;
-            Ammo: (Propz: 0;
-                Count: 4;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amMortar;
-                AttackVoice: sndNone);
-            Slot: 0;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //20;
-            ejectY: -6),
-
-// Kamikaze
-            (NameId: sidKamikaze;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_AttackInMove;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amKamikaze;
-                AttackVoice: sndNone);
-            Slot: 3;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Cake
-            (NameId: sidCake;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amCake;
-                AttackVoice: sndLaugh);
-            Slot: 4;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 4;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Seduction
-            (NameId: sidSeduction;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amSeduction;
-                AttackVoice: sndNone);
-            Slot: 3;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Watermelon
-            (NameId: sidWatermelon;
-            NameTex: nil;
-            Probability: 400;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
-                Count: 0;
-                NumPerTurn: 0;
-                Timer: 3000;
-                Pos: 0;
-                AmmoType: amWatermelon;
-                AttackVoice: sndMelon);
-            Slot: 1;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// HellishBomb ("Hellish Hand-Grenade")
-            (NameId: sidHellishBomb;
-            NameTex: nil;
-            Probability: 400;
-            NumberInCase: 1;
-            Ammo: (Propz:  ammoprop_Power or ammoprop_AltUse;
-                Count: 0;
-                NumPerTurn: 0;
-                Timer: 5000;
-                Pos: 0;
-                AmmoType: amHellishBomb;
-                AttackVoice: sndNone);
-            Slot: 1;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Napalm
-            (NameId: sidNapalm;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or
-                            ammoprop_NeedTarget or
-                            ammoprop_AttackingPut or
-                            ammoprop_DontHold or
-                            ammoprop_NotBorder;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amNapalm;
-                AttackVoice: sndIncoming);
-            Slot: 5;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 7;
-            PosCount: 2;
-            PosSprite: sprAmAirplane;
-            ejectX: 0;
-            ejectY: 0),
-
-// Drill ("Drill Rocket")
-            (NameId: sidDrill;
-            NameTex: nil;
-            Probability: 300;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amDrill;
-                AttackVoice: sndNone);
-            Slot: 0;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprDrill;
-            ejectX: 0; //20;
-            ejectY: -6),
-
-// Ballgun
-            (NameId: sidBallgun;
-            NameTex: nil;
-            Probability: 400;
-            NumberInCase: 1;
-            Ammo: (Propz:  ammoprop_ForwMsgs or ammoprop_DontHold;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 5001;
-                Pos: 0;
-                AmmoType: amBallgun;
-                AttackVoice: sndNone);
-            Slot: 4;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //20;
-            ejectY: -3),
-
-// RC-Plane
-            (NameId: sidRCPlane;
-            NameTex: nil;
-            Probability: 200;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs{ or
-                            ammoprop_DontHold or
-                            ammoprop_AltAttack};
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amRCPlane;
-                AttackVoice: sndNone);
-            Slot: 4;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 4;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// LowGravity
-            (NameId: sidLowGravity;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_AltUse or
-                          ammoprop_Utility or
-                          ammoprop_Effect;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amLowGravity;
-                    AttackVoice: sndNone);
-            Slot: 9;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// ExtraDamage
-            (NameId: sidExtraDamage;
-            NameTex: nil;
-            Probability: 15;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_AltUse or
-                          ammoprop_Utility or
-                          ammoprop_Effect;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amExtraDamage;
-                    AttackVoice: sndNone);
-            Slot: 9;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Invulnerable
-            (NameId: sidInvulnerable;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_AltUse or
-                          ammoprop_Utility or
-                          ammoprop_Effect;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amInvulnerable;
-                    AttackVoice: sndNone);
-            Slot: 8;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// ExtraTime
-            (NameId: sidExtraTime;
-            NameTex: nil;
-            Probability: 30;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_AltUse or
-                          ammoprop_Utility or
-                          ammoprop_Effect;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amExtraTime;
-                    AttackVoice: sndNone);
-            Slot: 9;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// LaserSight
-            (NameId: sidLaserSight;
-            NameTex: nil;
-            Probability: 15;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_AltUse or
-                          ammoprop_Utility or
-                          ammoprop_Effect;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amLaserSight;
-                    AttackVoice: sndNone);
-            Slot: 8;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Vampiric
-            (NameId: sidVampiric;
-            NameTex: nil;
-            Probability: 15;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_AltUse or
-                          ammoprop_Utility or
-                          ammoprop_Effect;
-                    Count: 1;
-                    NumPerTurn: 0;
-                    Timer: 0;
-                    Pos: 0;
-                    AmmoType: amVampiric;
-                    AttackVoice: sndNone);
-            Slot: 8;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// SniperRifle
-            (NameId: sidSniperRifle;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 2;
-            Ammo: (Propz: 0;
-                Count: 2;
-                NumPerTurn: 1;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amSniperRifle;
-                AttackVoice: sndNone);
-            Slot: 2;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //40;
-            ejectY: -5),
-
-// Jetpack ("Flying Saucer")
-            (NameId: sidJetpack;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_ForwMsgs or
-                          ammoprop_AttackInMove or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold or
-                          ammoprop_Utility or
-                          ammoprop_AltAttack;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amJetpack;
-                AttackVoice: sndNone);
-            Slot: 7;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Molotov
-            (NameId: sidMolotov;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 3000;
-                Pos: 0;
-                AmmoType: amMolotov;
-                AttackVoice: sndNone);
-            Slot: 1;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Birdy
-            (NameId: sidBirdy;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_ForwMsgs or
-                          ammoprop_NoCrosshair or
-                          ammoprop_DontHold;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amBirdy;
-                AttackVoice: sndNone);
-            Slot: 7;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// PortalGun
-            (NameId: sidPortalGun;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoRoundEnd or
-                          ammoprop_AttackInMove or
-                          ammoprop_DontHold or
-                          ammoprop_Utility;
-                Count: 1;
-                NumPerTurn: 3;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amPortalGun;
-                AttackVoice: sndNone);
-            Slot: 6;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: false;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: -5; //29;
-            ejectY: -7),
-
-// Piano
-            (NameId: sidPiano;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or
-                            ammoprop_NeedTarget or
-                            ammoprop_AttackingPut or
-                            ammoprop_DontHold or
-                            ammoprop_NotBorder;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amPiano;
-                AttackVoice: sndIncoming);
-            Slot: 5;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 7;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// GasBomb
-            (NameId: sidGasBomb;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
-                Count: AMMO_INFINITE;
-                NumPerTurn: 0;
-                Timer: 3000;
-                Pos: 0;
-                AmmoType: amGasBomb;
-                AttackVoice: sndCover);
-            Slot: 1;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// SineGun
-            (NameId: sidSineGun;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 2;
-            Ammo: (Propz: ammoprop_AttackInMove;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amSineGun;
-                AttackVoice: sndNone);
-            Slot: 2;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Flamethrower
-            (NameId: sidFlamethrower;
-            NameTex: nil;
-            Probability: 20;
-            NumberInCase: 1;
-            Ammo: (Propz:  ammoprop_ForwMsgs or ammoprop_DontHold;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 5001;
-                Pos: 0;
-                AmmoType: amFlamethrower;
-                AttackVoice: sndNone);
-            Slot: 2;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0; //20;
-            ejectY: -3),
-
-// Sticky Mine
-            (NameId: sidSMine;
-            NameTex: nil;
-            Probability: 100;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Power; //FIXME: enable multishoot at altuse, until then removed ammoprop_AltUse
-                Count: 1;
-                NumPerTurn: 1;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amSMine;
-                AttackVoice: sndLaugh);
-            Slot: 4;
-            TimeAfterTurn: 5000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Hammer
-            (NameId: sidHammer;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amHammer;
-                AttackVoice: sndNone);
-            Slot: 3;
-            TimeAfterTurn: 1000;
-            MinAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// Ressurrector
-        (NameId: sidResurrector;
-            NameTex: nil;
-            Probability: 0;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or 
-                          ammoprop_Utility or
-                          ammoprop_NoRoundEnd;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amResurrector;
-                AttackVoice: sndNone);
-            Slot: 8;
-            TimeAfterTurn: 3000;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 0;
-            PosCount: 1;
-            PosSprite: sprWater;
-            ejectX: 0;
-            ejectY: 0),
-
-// DrillStrike
-            (NameId: sidDrillStrike;
-            NameTex: nil;
-            Probability: 200;
-            NumberInCase: 1;
-            Ammo: (Propz: ammoprop_NoCrosshair or
-                            ammoprop_NeedTarget or
-                            ammoprop_AttackingPut or
-                            ammoprop_DontHold or
-                            ammoprop_NotBorder;
-                Count: 1;
-                NumPerTurn: 0;
-                Timer: 0;
-                Pos: 0;
-                AmmoType: amDrillStrike;
-                AttackVoice: sndIncoming);
-            Slot: 5;
-            TimeAfterTurn: 0;
-            minAngle: 0;
-            maxAngle: 0;
-            isDamaging: true;
-            SkipTurns: 6;
-            PosCount: 2;
-            PosSprite: sprAmAirplane;
-            ejectX: 0;
-            ejectY: 0)
-        );
-
-
-
-    conversionFormat: TSDL_PixelFormat = (
-        palette: nil;
-        BitsPerPixel : 32;
-        BytesPerPixel: 4;
-        Rloss : 0;
-        Gloss : 0;
-        Bloss : 0;
-        Aloss : 0;
-{$IFDEF ENDIAN_LITTLE}
-        Rshift: 0;
-        Gshift: 8;
-        Bshift: 16;
-        Ashift: 24;
-{$ELSE}
-        Rshift: 24;
-        Gshift: 16;
-        Bshift: 8;
-        Ashift: 0;
-{$ENDIF}
-        RMask : RMask;
-        GMask : GMask;
-        BMask : BMask;
-        AMask : AMask;
-        colorkey: 0;
-        alpha : 255
-    );
 
 implementation
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uDebug.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -0,0 +1,35 @@
+{$INCLUDE "options.inc"}
+
+unit uDebug;
+
+interface
+
+procedure OutError(Msg: shortstring; isFatalError: boolean);
+procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
+procedure SDLTry(Assert: boolean; isFatal: boolean);
+
+implementation
+uses SDLh, uConsole, uCommands;
+
+procedure OutError(Msg: shortstring; isFatalError: boolean);
+begin
+WriteLnToConsole(Msg);
+if isFatalError then
+    begin
+    ParseCommand('fatal ' + GetLastConsoleLine, true);
+    SDL_Quit;
+    halt(1)
+    end
+end;
+
+procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
+begin
+if not Assert then OutError(Msg, isFatal)
+end;
+
+procedure SDLTry(Assert: boolean; isFatal: boolean);
+begin
+if not Assert then OutError(SDL_GetError, isFatal)
+end;
+
+end.
\ No newline at end of file
--- a/hedgewars/uFloat.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uFloat.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -62,6 +62,7 @@
 function AngleSin(const Angle: Longword): hwFloat;
 function AngleCos(const Angle: Longword): hwFloat;
 function SignAs(const num, signum: hwFloat): hwFloat; inline;
+function hwSign(r: hwFloat): LongInt; inline;
 
 {$IFDEF FPC}
 {$J-}
@@ -147,7 +148,7 @@
 {$ENDIF}
 
 implementation
-//uses uMisc;
+uses uSinTable;
 
 
 {$IFDEF FPC}
@@ -342,7 +343,12 @@
 SignAs.isNegative:= signum.isNegative
 end;
 
-{$INCLUDE "SinTable.inc"}
+function hwSign(r: hwFloat): LongInt;
+begin
+// yes, we have negative zero for a reason
+if r.isNegative then hwSign:= -1 else hwSign:= 1
+end;
+
 
 function AngleSin(const Angle: Longword): hwFloat;
 begin
--- a/hedgewars/uGame.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uGame.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -26,7 +26,7 @@
 ////////////////////
    implementation
 ////////////////////
-uses uMisc, uConsts, uKeys, uTeams, uIO, uAI, uGears, uScript, uSound, uMobile, uVisualGears;
+uses uKeys, uTeams, uIO, uAI, uGears, uScript, uSound, uMobile, uVisualGears, uTypes, uVariables;
 
 procedure DoGameTick(Lag: LongInt);
 var i: LongInt;
@@ -45,7 +45,6 @@
 i:= 1;
 while (GameState <> gsExit) and (i <= Lag) do
     begin
-    ScriptCall('onGameTick');
     if not CurrentTeam^.ExtDriven then
        begin
        if CurrentHedgehog^.BotLevel <> 0 then ProcessBot;
--- a/hedgewars/uGears.pas	Mon Nov 29 09:11:31 2010 +0100
+++ b/hedgewars/uGears.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -20,63 +20,7 @@
 
 unit uGears;
 interface
-uses SDLh, uConsts, uFloat, Math;
-
-
-type
-    PGear = ^TGear;
-    TGearStepProcedure = procedure (Gear: PGear);
-    TGear = record
-            NextGear, PrevGear: PGear;
-            Active: Boolean;
-            AdvBounce: Longword;
-            Invulnerable: Boolean;
-            RenderTimer: Boolean;
-            AmmoType : TAmmoType;
-            State : Longword;
-            X : hwFloat;
-            Y : hwFloat;
-            dX: hwFloat;
-            dY: hwFloat;
-            Kind: TGearType;
-            Pos: Longword;
-            doStep: TGearStepProcedure;
-            Radius: LongInt;
-            Angle, Power : Longword;
-            DirAngle: real;
-            Timer : LongWord;
-            Elasticity: hwFloat;
-            Friction  : hwFloat;
-            Message, MsgParam : Longword;
-            Hedgehog: pointer;
-            Health, Damage, Karma: LongInt;
-            CollisionIndex: LongInt;
-            Tag: LongInt;
-            Tex: PTexture;
-            Z: Longword;
-            IntersectGear: PGear;
-            FlightTime: Longword;
-            uid: Longword;
-            ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
-            nImpactSounds: Word; // count of ImpactSounds
-            SoundChannel: LongInt;
-            PortalCounter: LongWord  // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
-        end;
-    TPGearArray = Array of PGear;
-
-var AllInactive: boolean;
-    PrvInactive: boolean;
-    CurAmmoGear: PGear;
-    GearsList: PGear;
-    KilledHHs: Longword;
-    SuddenDeathDmg: Boolean;
-    SpeechType: Longword;
-    SpeechText: shortstring;
-    TrainingTargetGear: PGear;
-    skipFlag: boolean;
-    PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress
-    StepSoundTimer: LongInt;
-    StepSoundChannel: LongInt;
+uses SDLh, uConsts, uFloat, uTypes;
 
 procedure initModule;
 procedure freeModule;
@@ -97,24 +41,13 @@
 procedure RemoveGearFromList(Gear: PGear);
 function  ModifyDamage(dmg: Longword; Gear: PGear): Longword;
 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt);
-function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
-function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
+
 
 implementation
-uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
-     uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile;
+uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
+     uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
+     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug;
 
-const MAXROPEPOINTS = 384;
-var RopePoints: record
-                Count: Longword;
-                HookAngle: GLfloat;
-                ar: array[0..MAXROPEPOINTS] of record
-                                  X, Y: hwFloat;
-                                  dLen: hwFloat;
-                                  b: boolean;
-                                  end;
-                rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
-                end;
 
 procedure DeleteGear(Gear: PGear); forward;
 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward;
@@ -133,22 +66,6 @@
 procedure HHSetWeapon(Gear: PGear); forward;
 procedure doStepCase(Gear: PGear); forward;
 
-function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
-begin
-    if (Ammoz[at].ejectX <> 0) or (Ammoz[at].ejectY <> 0) then
-        GetLaunchX:= sign(dir) * (8 + hwRound(AngleSin(angle) * Ammoz[at].ejectX) + hwRound(AngleCos(angle) * Ammoz[at].ejectY))
-    else
-        GetLaunchX:= 0
-end;
-
-function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
-begin
-    if (Ammoz[at].ejectX <> 0) or (Ammoz[at].ejectY <> 0) then
-        GetLaunchY:= hwRound(AngleSin(angle) * Ammoz[at].ejectY) - hwRound(AngleCos(angle) * Ammoz[at].ejectX) - 2
-    else
-        GetLaunchY:= 0
-end;
-
 {$INCLUDE "GSHandlers.inc"}
 {$INCLUDE "HHHandlers.inc"}
 
@@ -253,7 +170,7 @@
 begin
 tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
 if (tag <> nil) then
-    tag^.Hedgehog:= PHedgehog(HHGear^.Hedgehog); // the tag needs the tag to determine the text color
+    tag^.Hedgehog:= HHGear^.Hedgehog; // the tag needs the tag to determine the text color
 AllInactive:= false;
 HHGear^.Active:= true;
 end;
@@ -323,8 +240,8 @@
                 gear^.Angle:= cMaxAngle div 2;
                 gear^.Z:= cHHZ;
                 if (GameFlags and gfAISurvival) <> 0 then
-                    if PHedgehog(gear^.Hedgehog)^.BotLevel > 0 then
-                        PHedgehog(gear^.Hedgehog)^.Effects[heResurrectable] := true;
+                    if gear^.Hedgehog^.BotLevel > 0 then
+                        gear^.Hedgehog^.Effects[heResurrectable] := true;
                 end;
        gtShell: begin
                 gear^.Radius:= 4;
@@ -356,7 +273,7 @@
                 end;
         gtRope: begin
                 gear^.Radius:= 3;
-                gear^.Friction:= _450;
+                gear^.Friction:= _450 * _0_01 * cRopePercent;
                 RopePoints.Count:= 0;
                 end;
         gtMine: begin
@@ -599,12 +516,12 @@
             uStats.HedgehogDamaged(Gear)
             end;
 
-        team:= PHedgehog(Gear^.Hedgehog)^.Team;
+        team:= Gear^.Hedgehog^.Team;
         if CurrentHedgehog^.Gear = Gear then
             FreeActionsList; // to avoid ThinkThread on drawned gear
 
-        PHedgehog(Gear^.Hedgehog)^.Gear:= nil;
-        if PHedgehog(Gear^.Hedgehog)^.King then
+        Gear^.Hedgehog^.Gear:= nil;
+        if Gear^.Hedgehog^.King then
             begin
             // are there any other kings left? Just doing nil check.  Presumably a mortally wounded king will get reaped soon enough
             k:= false;
@@ -655,17 +572,17 @@
             else
                 dec(Gear^.Health, dmg);
 
-            if (PHedgehog(Gear^.Hedgehog)^.Team = CurrentTeam) and
+            if (Gear^.Hedgehog^.Team = CurrentTeam) and
                (Gear^.Damage <> Gear^.Karma) and
-                not PHedgehog(Gear^.Hedgehog)^.King and
-                not PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] and
+                not Gear^.Hedgehog^.King and
+                not Gear^.Hedgehog^.Effects[hePoisoned] and
                 not SuddenDeathDmg then
                 Gear^.State:= Gear^.State or gstLoser;
 
             spawnHealthTagForHH(Gear, dmg);
 
-            RenderHealth(PHedgehog(Gear^.Hedgehog)^);
-            RecountTeamHealth(PHedgehog(Gear^.Hedgehog)^.Team);
+            RenderHealth(Gear^.Hedgehog^);
+            RecountTeamHealth(Gear^.Hedgehog^.Team);
 
             end;
         if (not isInMultiShoot) then Gear^.Karma:= 0;
@@ -689,20 +606,20 @@
         if Gear^.Kind = gtHedgehog then
             begin
             tmp:= 0;
-            if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then
+            if Gear^.Hedgehog^.Effects[hePoisoned] then
                 begin
                 inc(tmp, ModifyDamage(5, Gear));
-                if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth)  // does not need a minimum check since <= 1 basically disables it
+                if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth)  // does not need a minimum check since <= 1 basically disables it
                 end;
             if (TotalRounds > cSuddenDTurns - 1) then
                 begin
                 inc(tmp, cHealthDecrease);
-                if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, cHealthDecrease)
+                if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth, cHealthDecrease)
                 end;
-            if PHedgehog(Gear^.Hedgehog)^.King then
+            if Gear^.Hedgehog^.King then
                 begin
                 flag:= false;
-                team:= PHedgehog(Gear^.Hedgehog)^.Team;
+                team:= Gear^.Hedgehog^.Team;
                 for i:= 0 to Pred(team^.HedgehogsNumber) do
                     if (team^.Hedgehogs[i].Gear <> nil) and
                         (not team^.Hedgehogs[i].King) and
@@ -711,7 +628,7 @@
                 if not flag then
                     begin
                     inc(tmp, 5);
-                    if (GameFlags and gfResetHealth) <> 0 then dec(PHedgehog(Gear^.Hedgehog)^.InitialHealth, 5)
+                    if (GameFlags and gfResetHealth) <> 0 then dec(Gear^.Hedgehog^.InitialHealth, 5)
                     end
                 end;
             if tmp > 0 then 
@@ -939,6 +856,7 @@
         inc(hiTicks) // we do not recieve a message for this
     end;
 
+ScriptCall('onGameTick');
 inc(GameTicks)
 end;
 
@@ -985,10 +903,10 @@
     while t <> nil do
         begin
         t^.PortalCounter:= 0;
-        if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < PHedgehog(t^.Hedgehog)^.InitialHealth) then
+        if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < t^.Hedgehog^.InitialHealth) then
             begin
-            t^.Health:= PHedgehog(t^.Hedgehog)^.InitialHealth;
-            RenderHealth(PHedgehog(t^.Hedgehog)^);
+            t^.Health:= t^.Hedgehog^.InitialHealth;
+            RenderHealth(t^.Hedgehog^);
             end;
         t:= t^.NextGear
         end;
@@ -1009,7 +927,7 @@
     if (Gear^.Kind = gtHedgehog) and (Damage>=1) then
     begin
     HHHurt(Gear^.Hedgehog, Source);
-    AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color);
+    AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), Damage, Gear^.Hedgehog^.Team^.Clan^.Color);
     tmpDmg:= min(Damage, max(0,Gear^.Health-Gear^.Damage));
     if (Gear <> CurrentHedgehog^.Gear) and (CurrentHedgehog^.Gear <> nil) and (tmpDmg >= 1) then
         begin
@@ -1072,151 +990,21 @@
     end
 end;
 
-procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt);
+
+procedure DrawGears;
+var Gear: PGear;
+    x, y: LongInt;
 begin
-with PHedgehog(Gear^.Hedgehog)^ do
+Gear:= GearsList;
+while Gear <> nil do
     begin
-    if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
-        exit;
-    DrawTexture(sx + 16, sy + 16, ropeIconTex);
-    DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
+    x:= hwRound(Gear^.X) + WorldDx;
+    y:= hwRound(Gear^.Y) + WorldDy;
+    RenderGear(Gear, x, y);
+    Gear:= Gear^.NextGear
     end;
 end;
 
-procedure DrawRopeLinesRQ(Gear: PGear);
-begin
-with RopePoints do
-    begin
-    rounded[Count].X:= hwRound(Gear^.X);
-    rounded[Count].Y:= hwRound(Gear^.Y);
-    rounded[Count + 1].X:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X);
-    rounded[Count + 1].Y:= hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y);
-    end;
-
-if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
-    begin
-    glDisable(GL_TEXTURE_2D);
-    //glEnable(GL_LINE_SMOOTH);
-
-    glPushMatrix;
-
-    glTranslatef(WorldDx, WorldDy, 0);
-
-    glLineWidth(4.0);
-
-    Tint($C0, $C0, $C0, $FF);
-
-    glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]);
-    glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2);
-    Tint($FF, $FF, $FF, $FF);
-
-    glPopMatrix;
-
-    glEnable(GL_TEXTURE_2D);
-    //glDisable(GL_LINE_SMOOTH)
-    end
-end;
-
-procedure DrawRope(Gear: PGear);
-var roplen: LongInt;
-    i: Longword;
-
-    procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt);
-    var  eX, eY, dX, dY: LongInt;
-        i, sX, sY, x, y, d: LongInt;
-        b: boolean;
-    begin
-    if (X1 = X2) and (Y1 = Y2) then
-    begin
-    //OutError('WARNING: zero length rope line!', false);
-    exit
-    end;
-    eX:= 0;
-    eY:= 0;
-    dX:= X2 - X1;
-    dY:= Y2 - Y1;
-
-    if (dX > 0) then sX:= 1
-    else
-    if (dX < 0) then
-        begin
-        sX:= -1;
-        dX:= -dX
-        end else sX:= dX;
-
-    if (dY > 0) then sY:= 1
-    else
-    if (dY < 0) then
-        begin
-        sY:= -1;
-        dY:= -dY
-        end else sY:= dY;
-
-        if (dX > dY) then d:= dX
-                    else d:= dY;
-
-        x:= X1;
-        y:= Y1;
-
-        for i:= 0 to d do
-            begin
-            inc(eX, dX);
-            inc(eY, dY);
-            b:= false;
-            if (eX > d) then
-                begin
-                dec(eX, d);
-                inc(x, sX);
-                b:= true
-                end;
-            if (eY > d) then
-                begin
-                dec(eY, d);
-                inc(y, sY);
-                b:= true
-                end;
-            if b then
-                begin
-                inc(roplen);
-                if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
-                end
-        end
-    end;
-begin
-    if (cReducedQuality and rqSimpleRope) <> 0 then
-        DrawRopeLinesRQ(Gear)
-    else
-        begin
-        roplen:= 0;
-        if RopePoints.Count > 0 then
-            begin
-            i:= 0;
-            while i < Pred(RopePoints.Count) do
-                    begin
-                    DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
-                                hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy);
-                    inc(i)
-                    end;
-            DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
-                        hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy);
-            DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
-                        hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy);
-            end else
-            if Gear^.Elasticity.QWordValue > 0 then
-            DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
-                        hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.X) + WorldDx, hwRound(PHedgehog(Gear^.Hedgehog)^.Gear^.Y) + WorldDy);
-        end;
-
-
-if RopePoints.Count > 0 then
-    DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle)
-    else
-    if Gear^.Elasticity.QWordValue > 0 then
-        DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
-end;
-
-{$INCLUDE "GearDrawing.inc"}
-
 procedure FreeGearsList;
 var t, tt: PGear;
 begin
@@ -1349,7 +1137,7 @@
                                 if Gear^.Kind <> gtFlame then FollowGear:= Gear
                                 end;
                             if ((Mask and EXPLPoisoned) <> 0) and (Gear^.Kind = gtHedgehog) then
-                                PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] := true;
+                                Gear^.Hedgehog^.Effects[hePoisoned] := true;
                             end;
 
                         end;
@@ -1473,7 +1261,7 @@
                     if (Gear^.Kind = gtExplosives) and (Ammo^.Kind = gtBlowtorch) then ApplyDamage(Gear, tmpDmg * 100, dsUnknown); // crank up damage for explosives + blowtorch
 
                     DeleteCI(Gear);
-                    if (Gear^.Kind = gtHedgehog) and PHedgehog(Gear^.Hedgehog)^.King then
+                    if (Gear^.Kind = gtHedgehog) and Gear^.Hedgehog^.King then
                         begin
                         Gear^.dX:= Ammo^.dX * Power * _0_005;
                         Gear^.dY:= Ammo^.dY * Power * _0_005
@@ -1669,11 +1457,11 @@
         if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
         Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
     end;
-    tempTeam := PHedgehog(gear^.Hedgehog)^.Team;
+    tempTeam := gear^.Hedgehog^.Team;
     DeleteCI(gear);
     FindPlace(gear, false, 0, LAND_WIDTH); 
     if gear <> nil then begin
-        RenderHealth(PHedgehog(gear^.Hedgehog)^);
+        RenderHealth(gear^.Hedgehog^);
         ScriptCall('onGearResurrect', gear^.uid);
     end;
     RecountTeamHealth(tempTeam);
@@ -1887,7 +1675,7 @@
     else
     begin
     OutError('Can''t find place for Gear', false);
-    if Gear^.Kind = gtHedgehog then PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] := false;
+    if Gear^.Kind = gtHedgehog then Gear^.Hedgehog^.Effects[heResurrectable] := false;
     DeleteGear(Gear);
     Gear:= nil
     end
@@ -1902,7 +1690,7 @@
 *)
 i:= _1;
 if (CurrentHedgehog <> nil) and CurrentHedgehog^.King then i:= _1_5;
-if (Gear^.Hedgehog <> nil) and (PHedgehog(Gear^.Hedgehog)^.King) then
+if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.King) then
    ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent * _0_5)
 else
    ModifyDamage:= hwRound(_0_01 * cDamageModifier * dmg * i * cDamagePercent)
@@ -1924,8 +1712,51 @@
     end
 end;
 
+
+procedure chSkip(var s: shortstring);
+begin
+s:= s; // avoid compiler hint
+if not CurrentTeam^.ExtDriven then SendIPC(',');
+uStats.Skipped;
+skipFlag:= true
+end;
+
+procedure chHogSay(var s: shortstring);
+var Gear: PVisualGear;
+    text: shortstring;
+begin
+    text:= copy(s, 2, Length(s) - 1);
+    if CheckNoTeamOrHH
+    or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
+        begin
+        ParseCommand('say ' + text, true);
+        exit
+        end;
+
+    if not CurrentTeam^.ExtDriven then SendIPC('h' + s);
+
+    if byte(s[1]) < 4 then
+        begin
+        Gear:= AddVisualGear(0, 0, vgtSpeechBubble);
+        if Gear <> nil then
+            begin
+            Gear^.Hedgehog:= CurrentHedgehog;
+            Gear^.Text:= text;
+            Gear^.FrameTicks:= byte(s[1])
+            end
+        end
+    else
+        begin
+        SpeechType:= byte(s[1])-3;
+        SpeechText:= text
+        end;
+end;
+
 procedure initModule;
 begin
+    RegisterVariable('skip', vtCommand, @chSkip, false);
+    RegisterVariable('hogsay', vtCommand, @chHogSay, true );
+
     CurAmmoGear:= nil;
     GearsList:= nil;
     KilledHHs:= 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uGearsRender.pas	Tue Nov 30 22:46:47 2010 +0100
@@ -0,0 +1,1022 @@
+{$INCLUDE "options.inc"}
+unit uGearsRender;
+
+interface
+uses uTypes, uConsts, GLunit, uFloat;
+
+procedure RenderGear(Gear: PGear; x, y: LongInt);
+
+var RopePoints: record
+                Count: Longword;
+                HookAngle: GLfloat;
+                ar: array[0..MAXROPEPOINTS] of record
+                                  X, Y: hwFloat;
+                                  dLen: hwFloat;
+                                  b: boolean;
+                                  end;
+                rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
+                end;
+
+implementation
+uses uRender, uUtils, uVariables, uAmmos, Math;
+
+procedure DrawRopeLinesRQ(Gear: PGear);
+begin
+with RopePoints do
+    begin
+    rounded[Count].X:= hwRound(Gear^.X);
+    rounded[Count].Y:= hwRound(Gear^.Y);
+    rounded[Count + 1].X:= hwRound(Gear^.Hedgehog^.Gear^.X);
+    rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y);
+    end;
+
+if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
+    begin
+    glDisable(GL_TEXTURE_2D);
+    //glEnable(GL_LINE_SMOOTH);
+
+    glPushMatrix;
+
+    glTranslatef(WorldDx, WorldDy, 0);
+
+    glLineWidth(4.0);
+
+    Tint($C0, $C0, $C0, $FF);
+
+    glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]);
+    glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2);
+    Tint($FF, $FF, $FF, $FF);
+
+    glPopMatrix;
+
+    glEnable(GL_TEXTURE_2D);
+    //glDisable(GL_LINE_SMOOTH)
+    end
+end;
+
+
+procedure DrawRope(Gear: PGear);
+var roplen: LongInt;
+    i: Longword;
+
+    procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt);
+    var  eX, eY, dX, dY: LongInt;
+        i, sX, sY, x, y, d: LongInt;
+        b: boolean;
+    begin
+    if (X1 = X2) and (Y1 = Y2) then
+    begin
+    //OutError('WARNING: zero length rope line!', false);
+    exit
+    end;
+    eX:= 0;
+    eY:= 0;
+    dX:= X2 - X1;
+    dY:= Y2 - Y1;
+
+    if (dX > 0) then sX:= 1
+    else
+    if (dX < 0) then
+        begin
+        sX:= -1;
+        dX:= -dX
+        end else sX:= dX;
+
+    if (dY > 0) then sY:= 1
+    else
+    if (dY < 0) then
+        begin
+        sY:= -1;
+        dY:= -dY
+        end else sY:= dY;
+
+        if (dX > dY) then d:= dX
+                    else d:= dY;
+
+        x:= X1;
+        y:= Y1;
+
+        for i:= 0 to d do
+            begin
+            inc(eX, dX);
+            inc(eY, dY);
+            b:= false;
+            if (eX > d) then
+                begin
+                dec(eX, d);
+                inc(x, sX);
+                b:= true
+                end;
+            if (eY > d) then
+                begin
+                dec(eY, d);
+                inc(y, sY);
+                b:= true
+                end;
+            if b then
+                begin
+                inc(roplen);
+                if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
+                end
+        end
+    end;
+begin
+    if (cReducedQuality and rqSimpleRope) <> 0 then
+        DrawRopeLinesRQ(Gear)
+    else
+        begin
+        roplen:= 0;
+        if RopePoints.Count > 0 then
+            begin
+            i:= 0;
+            while i < Pred(RopePoints.Count) do
+                    begin
+                    DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
+                                hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy);
+                    inc(i)
+                    end;
+            DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
+                        hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy);
+            DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
+                        hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy);
+            end else
+            if Gear^.Elasticity.QWordValue > 0 then
+            DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
+                        hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy);
+        end;
+
+
+if RopePoints.Count > 0 then
+    DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle)
+    else
+    if Gear^.Elasticity.QWordValue > 0 then
+        DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
+end;
+
+
+procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt);
+begin
+with Gear^.Hedgehog^ do
+    begin
+    if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
+        exit;
+    DrawTexture(sx + 16, sy + 16, ropeIconTex);
+    DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
+    end;
+end;
+
+
+procedure DrawHH(Gear: PGear; ox, oy: LongInt);
+var i, t: LongInt;
+    amt: TAmmoType;
+    sign, hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
+    dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real;  // laser, change
+    defaultPos, HatVisible: boolean;
+    HH: PHedgehog;
+    CurWeapon: PAmmo;
+begin
+    HH:= Gear^.Hedgehog;
+    if HH^.Unplaced then exit;
+    m:= 1;
+    if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1;
+    sx:= ox + 1; // this offset is very common
+    sy:= oy - 3;
+    sign:= hwSign(Gear^.dX);
+
+    if (Gear^.State and gstHHDeath) <> 0 then
+        begin
+        DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos);
+        Tint(HH^.Team^.Clan^.Color);
+        DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos + 8);
+        Tint($FF, $FF, $FF, $FF);
+        exit
+        end
+    else if (Gear^.State and gstHHGone) <> 0 then
+        begin
+        DrawRotatedF(sprTeleport, sx, sy, Gear^.Pos, sign, 0);
+        exit
+        end;
+
+    defaultPos:= true;
+    HatVisible:= false;
+
+
+    if HH^.Effects[hePoisoned] then
+        begin
+        Tint($00, $FF, $40, $40);
+        DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360);
+        Tint($FF, $FF, $FF, $FF)
+        end;
+
+    if ((Gear^.State and gstWinner) <> 0) and
+    ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then
+        begin
+        DrawHedgehog(sx, sy,
+                sign,
+                2,
+                0,
+                0);
+        defaultPos:= false
+        end;
+    if (Gear^.State and gstDrowning) <> 0 then
+        begin
+        DrawHedgehog(sx, sy,
+                sign,
+                1,
+                7,
+                0);
+        defaultPos:= false
+        end else
+    if (Gear^.State and gstLoser) <> 0 then
+        begin
+        DrawHedgehog(sx, sy,
+                sign,
+                2,
+                3,
+                0);
+        defaultPos:= false
+        end else
+
+    if (Gear^.State and gstHHDriven) <> 0 then
+        begin
+        if ((Gear^.State and gstHHThinking) = 0) and
+        (ShowCrosshair  or ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtRope))) and
+        ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then
+            begin
+    (* These calculations are a little complex for a few reasons:
+    1: I need to draw the laser from weapon origin to nearest land
+    2: I need to start the beam outside the hedgie for attractiveness.
+    3: I need to extend the beam beyond land.
+    This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
+    *)
+            dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle);
+            dy:= -Cos(Gear^.Angle * pi / cMaxAngle);
+            if cLaserSighting then
+                begin
+                lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle);
+                ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle);
+
+                // ensure we start outside the hedgehog (he's solid after all)
+                while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do
+                    begin
+                    lx:= lx + dx;
+                    ly:= ly + dy
+                    end;
+
+                // add hog's position
+                lx:= lx + ox - WorldDx;
+                ly:= ly + oy - WorldDy;
+
+                // decrease number of iterations required
+                ax:= dx * 4;
+                ay:= dy * 4;
+
+                tx:= round(lx);
+                ty:= round(ly);
+                hx:= tx;
+                hy:= ty;
+                while ((ty and LAND_HEIGHT_MASK) = 0) and
+                    ((tx and LAND_WIDTH_MASK) = 0) and
+                    (Land[ty, tx] = 0) do // TODO: check for constant variable instead
+                    begin
+                    lx:= lx + ax;
+                    ly:= ly + ay;
+                    tx:= round(lx);
+                    ty:= round(ly)
+                    end;
+                // reached edge of land. assume infinite beam. Extend it way out past camera
+                if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then
+                    begin
+                    tx:= round(lx + ax * (LAND_WIDTH div 4));
+                    ty:= round(ly + ay * (LAND_WIDTH div 4));
+                    end;
+
+                //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then
+                    begin
+                    DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0);
+                    end;
+                end;
+            // draw crosshair
+            cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
+            cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
+            DrawRotatedTex(HH^.Team^.CrosshairTex,
+                    12, 12, cx + WorldDx, cy + WorldDy, 0,
+                    sign * (Gear^.Angle * 180.0) / cMaxAngle);
+            end;
+        hx:= ox + 8 * sign;
+        hy:= oy - 2;
+        aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
+        if CurAmmoGear <> nil then
+        begin
+            case CurAmmoGear^.Kind of
+                gtShotgunShot: begin
+                        if (CurAmmoGear^.State and gstAnimation <> 0) then
+                            DrawRotated(sprShotgun, hx, hy, sign, aangle)
+                        else
+                            DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
+                    end;
+                gtDEagleShot: DrawRotated(sprDEagle, hx, hy, sign, aangle);
+                gtSniperRifleShot: begin
+                        if (CurAmmoGear^.State and gstAnimation <> 0) then
+                            DrawRotatedF(sprSniperRifle, hx, hy, 1, sign, aangle)
+                        else
+                            DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle)
+                    end;
+                gtBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
+                gtRCPlane: begin
+                    DrawRotated(sprHandPlane, hx, hy, sign, 0);
+                    defaultPos:= false
+                    end;
+                gtRope: begin
+                    if Gear^.X < CurAmmoGear^.X then
+                        begin
+                        dAngle:= 0;
+                        hAngle:= 180;
+                        i:= 1
+                        end else
+                        begin
+                        dAngle:= 180;
+                        hAngle:= 0;
+                        i:= -1
+                        end;
+                if ((Gear^.State and gstWinner) = 0) then
+                    begin
+                    DrawHedgehog(ox, oy,
+                            i,
+                            1,
+                            0,
+                            DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
+                    with HH^ do
+                        if (HatTex <> nil) then
+                            begin
+                            DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
+                                i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
+                            if HatTex^.w > 64 then
+                                begin
+                                Tint(HH^.Team^.Clan^.Color);
+                                DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
+                                    i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
+                                Tint($FF, $FF, $FF, $FF)
+                                end
+                            end
+                    end;
+                    DrawAltWeapon(Gear, ox, oy);
+                    defaultPos:= false
+                    end;
+                gtBlowTorch: begin
+                    DrawRotated(sprBlowTorch, hx, hy, sign, aangle);
+                    DrawHedgehog(sx, sy,
+                            sign,
+                            3,
+                            HH^.visStepPos div 2,
+                            0);
+                    with HH^ do
+                        if (HatTex <> nil) then
+                            begin
+                            DrawTextureF(HatTex,
+                                1,
+                                sx,
+                                sy - 5,
+                                0,
+                                sign,
+                                32,
+                                32);
+                            if HatTex^.w > 64 then
+                                begin
+                                Tint(HH^.Team^.Clan^.Color);
+                                DrawTextureF(HatTex,
+                                    1,
+                                    sx,
+                                    sy - 5,
+                                    32,
+                                    sign,
+                                    32,
+                                    32);
+                                Tint($FF, $FF, $FF, $FF)
+                                end
+                            end;
+                    defaultPos:= false
+                    end;
+                gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180);
+                gtFirePunch: begin
+                    DrawHedgehog(sx, sy,
+                            sign,
+                            1,
+                            4,
+                            0);
+                    defaultPos:= false
+                    end;
+                gtPickHammer: begin
+                    defaultPos:= false;
+                    dec(sy,20);
+                    end;
+                gtTeleport: defaultPos:= false;
+                gtWhip: begin
+                    DrawRotatedF(sprWhip,
+                            sx,
+                            sy,
+                            1,
+                            sign,
+                            0);
+                    defaultPos:= false
+                    end;
+                gtHammer: begin
+                    DrawRotatedF(sprHammer,
+                            sx,
+                            sy,
+                            1,
+                            sign,
+                            0);
+                    defaultPos:= false
+                    end;
+                gtResurrector: begin
+                    DrawRotated(sprHandResurrector, sx, sy, 0, 0);
+                    defaultPos:= false
+                    end;
+                gtKamikaze: begin
+                    if CurAmmoGear^.Pos = 0 then
+                        DrawHedgehog(sx, sy,
+                                sign,
+                                1,
+                                6,
+                                0)
+                    else
+                        DrawRotatedF(sprKamikaze,
+                                ox, oy,
+                                CurAmmoGear^.Pos - 1,
+                                sign,
+                                aangle);
+                    defaultPos:= false
+                    end;
+                gtSeduction: begin
+                    if CurAmmoGear^.Pos >= 6 then
+                        DrawHedgehog(sx, sy,
+                                sign,
+                                2,
+                                2,
+                                0)
+                    else
+                        begin
+                        DrawRotatedF(sprDress,
+                                ox, oy,
+                                CurAmmoGear^.Pos,
+                                sign,
+                                0);
+                        DrawSprite(sprCensored, ox - 32, oy - 20, 0)
+                        end;
+                    defaultPos:= false
+                    end;
+                gtFlamethrower: begin
+                    DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
+                    if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
+                    end;
+            end;
+
+            case CurAmmoGear^.Kind of
+                gtShotgunShot,
+                gtDEagleShot,
+                gtSniperRifleShot,
+                gtShover: begin
+                    DrawHedgehog(sx, sy,
+                            sign,
+                            0,
+                            4,
+                            0);
+                    defaultPos:= false;
+                    HatVisible:= true
+                end
+            end
+        end else
+
+        if ((Gear^.State and gstHHJumping) <> 0) then
+        begin
+        DrawHedgehog(sx, sy,
+            sign*m,
+            1,
+            1,
+            0);
+        HatVisible:= true;
+        defaultPos:= false
+        end else
+
+        if (Gear^.Message and (gmLeft or gmRight) <> 0) and (not isCursorVisible) then
+            begin
+            DrawHedgehog(sx, sy,
+                sign,
+                0,
+                HH^.visStepPos div 2,
+                0);
+            defaultPos:= false;
+            HatVisible:= true
+            end
+        else
+
+        if ((Gear^.State and gstAnimation) <> 0) then
+            begin
+            if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then
+                begin
+                Gear^.State:= Gear^.State and not gstAnimation;
+                end
+            else
+                begin
+                DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite,
+                        sx,
+                        sy,
+                        Gear^.Pos,
+                        sign,
+                        0.0);
+                defaultPos:= false
+                end
+            end
+        else
+        if ((Gear^.State and gstAttacked) = 0) then
+            begin
+            if HH^.Timer > 0 then
+                begin
+                // There must be a tidier way to do this. Anyone?
+                if aangle <= 90 then aangle:= aangle+360;
+                if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10)