- Get rid of old frontend
authorunc0rr
Tue, 06 Dec 2005 19:46:40 +0000
changeset 25 27aa8030322b
parent 24 79c411363184
child 26 e32fa14529f8
- Get rid of old frontend - additions to avematan theme - many work on frontend
QTfrontend/QTfrontend.pro
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/gamecmds.cpp
QTfrontend/gamecmds.h
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/hwform.ui
QTfrontend/team.cpp
QTfrontend/team.h
hedgewars/Data/Themes/avematan/inf.png
hedgewars/Data/Themes/avematan/ksi.png
hedgewars/Data/Themes/avematan/sqrt.png
hedgewars/Data/Themes/avematan/theme.cfg
hedgewars/Data/Themes/themes.cfg
hedgewars/Hedge.dpr
hedgewars/Hedge.res
hedgewars/fConsts.pas
hedgewars/fGUI.pas
hedgewars/fGame.pas
hedgewars/fIPC.pas
hedgewars/fMisc.pas
hedgewars/fNet.pas
hedgewars/fOptionsGUI.pas
hedgewars/uLandTemplates.pas
--- a/QTfrontend/QTfrontend.pro	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/QTfrontend.pro	Tue Dec 06 19:46:40 2005 +0000
@@ -10,6 +10,6 @@
 QT += network
 
 # Input
-HEADERS += binds.h game.h hwform.h sdlkeys.h team.h rndstr.h sha1.h
+HEADERS += binds.h game.h hwform.h sdlkeys.h team.h rndstr.h sha1.h gamecmds.h
 FORMS += hwform.ui
-SOURCES += game.cpp main.cpp hwform.cpp team.cpp rndstr.cpp sha1.cpp
+SOURCES += game.cpp main.cpp hwform.cpp team.cpp rndstr.cpp sha1.cpp gamecmds.cpp
--- a/QTfrontend/game.cpp	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/game.cpp	Tue Dec 06 19:46:40 2005 +0000
@@ -1,198 +1,266 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <QMessageBox>
-#include <QProcess>
-#include <QTimer>
-#include <QFile>
-#include <QString>
-#include <QByteArray>
-#include <QTextStream>
-#include "game.h"
-#include "hwconsts.h"
-
-HWGame::HWGame()
-{
-	IPCServer = new QTcpServer(this);
-	IPCServer->setMaxPendingConnections(1);
-	if (!IPCServer->listen(QHostAddress("127.0.0.1"), IPC_PORT)) 
-	{
-		QMessageBox::critical(this, tr("Error"),
-				tr("Unable to start the server: %1.")
-				.arg(IPCServer->errorString()));
-	}
-	connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
-	IPCSocket = 0;
-	TeamCount = 0;
-	seed = "seed";
-}
-
-void HWGame::NewConnection()
-{
-	QTcpSocket * client = IPCServer->nextPendingConnection();
-	if(!IPCSocket)
-	{
-		IPCSocket = client;
-		connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
-		connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
-		msgsize = 0;
-	} else
-	{
-		client->disconnectFromHost();
-		delete client;
-	}
-}
-
-void HWGame::ClientDisconnect()
-{
-	IPCSocket = 0;
-	delete this;
-}
-
-void HWGame::SendTeamConfig(int index)
-{
-	QFile teamcfg(teams[index]);
-	if (!teamcfg.open(QIODevice::ReadOnly))
-	{
-		return ;
-	}
-	QTextStream stream(&teamcfg);
-	stream.setCodec("UTF-8");	
-	QString str;
-	
-	while (!stream.atEnd())
-	{
-		str = stream.readLine();
-		if (str.startsWith(";")) continue;
-		str.prepend("e");
-		SendIPC(str.toLocal8Bit());
-	}
-	teamcfg.close();
-}
-
-void HWGame::SendConfig()
-{
-	SENDIPC("TL");
-	SENDIPC("e$gmflags 0");
-	SENDIPC("eaddteam");
-	SendTeamConfig(0);
-	SENDIPC("ecolor 65535");
-	SENDIPC("eadd hh0 0");
-	SENDIPC("eadd hh1 0");
-	SENDIPC("eadd hh2 0");
-	SENDIPC("eadd hh3 0");
-	SENDIPC("eaddteam");
-	SendTeamConfig(1);
-	SENDIPC("ecolor 16776960");
-	SENDIPC("eadd hh0 1");
-	SENDIPC("eadd hh1 1");
-	SENDIPC("eadd hh2 1");
-	SENDIPC("eadd hh3 1");
-}
-
-void HWGame::ParseMessage()
-{
-	switch(msgsize) {
-		case 1: switch(msgbuf[0]) {
-			case '?': {
-				SENDIPC("!");
-				break;
-			}
-		}
-		case 5: switch(msgbuf[0]) {
-			case 'C': {
-				SendConfig();
-				break;
-			}
-		}
-	}
-}
-
-void HWGame::SendIPC(const char* msg, unsigned char len)
-{
-	IPCSocket->write((char *)&len, 1);
-	IPCSocket->write(msg, len);
-}
-
-void HWGame::SendIPC(const QByteArray buf)
-{
-	if (buf.size() > 255) return;
-	unsigned char len = buf.size();
-	IPCSocket->write((char *)&len, 1);
-	IPCSocket->write(buf);
-}
-
-void HWGame::ClientRead()
-{
-	qint64 readbytes = 1;
-	while (readbytes > 0) 
-	{
-		if (msgsize == 0) 
-		{
-			msgbufsize = 0;
-			readbytes = IPCSocket->read((char *)&msgsize, 1);
-		} else
-		{
-			msgbufsize += 
-			readbytes = IPCSocket->read((char *)&msgbuf[msgbufsize], msgsize - msgbufsize);
-			if (msgbufsize = msgsize)
-			{
-				ParseMessage();
-				msgsize = 0;
-			}
-		}
-	}
-}
-
-void HWGame::Start(int Resolution, bool Fullscreen)
-{
-	if (TeamCount < 2) return;
-	QProcess * process;
-	QStringList arguments;
-	seedgen.GenRNDStr(seed, 10);
-	process = new QProcess;
-	arguments << resolutions[0][Resolution];
-	arguments << resolutions[1][Resolution];
-	arguments << "avematan";
-	arguments << "46631";
-	arguments << seed;
-	arguments << (Fullscreen ? "1" : "0");
-	process->start("hw", arguments);
-}
-
-void HWGame::AddTeam(const QString & teamname)
-{
-	if (TeamCount == 5) return;
-	teams[TeamCount] = teamname;
-	TeamCount++;
-}
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * Distributed under the terms of the BSD-modified licence:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <QMessageBox>
+#include <QProcess>
+#include <QTimer>
+#include <QString>
+#include <QByteArray>
+#include <QTextStream>
+#include <QFile>
+#include "game.h"
+#include "hwconsts.h"
+
+HWGame::HWGame()
+{
+	IPCServer = new QTcpServer(this);
+	IPCServer->setMaxPendingConnections(1);
+	if (!IPCServer->listen(QHostAddress("127.0.0.1"), IPC_PORT))
+	{
+		QMessageBox::critical(this, tr("Error"),
+				tr("Unable to start the server: %1.")
+				.arg(IPCServer->errorString()));
+	}
+	connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
+	IPCSocket = 0;
+	TeamCount = 0;
+	seed = "seed";
+}
+
+void HWGame::NewConnection()
+{
+	QTcpSocket * client = IPCServer->nextPendingConnection();
+	if(!IPCSocket)
+	{
+		IPCSocket = client;
+		connect(client, SIGNAL(disconnected()), this, SLOT(ClientDisconnect()));
+		connect(client, SIGNAL(readyRead()), this, SLOT(ClientRead()));
+		msgsize = 0;
+	} else
+	{
+		client->disconnectFromHost();
+		delete client;
+	}
+}
+
+void HWGame::ClientDisconnect()
+{
+	IPCSocket = 0;
+	SaveDemo("demo.hwd_1");
+	delete this;
+}
+
+void HWGame::SendTeamConfig(int index)
+{
+	QFile teamcfg(teams[index]);
+	if (!teamcfg.open(QIODevice::ReadOnly))
+	{
+		return ;
+	}
+	QTextStream stream(&teamcfg);
+	stream.setCodec("UTF-8");
+	QString str;
+
+	while (!stream.atEnd())
+	{
+		str = stream.readLine();
+		if (str.startsWith(";") || (str.length() > 254)) continue;
+		str.prepend("e");
+		SendIPC(str.toLocal8Bit());
+	}
+	teamcfg.close();
+}
+
+void HWGame::SendConfig()
+{
+	SENDIPC("TL");
+	SENDIPC("e$gmflags 0");
+	SENDIPC("eaddteam");
+	SendTeamConfig(0);
+	SENDIPC("ecolor 65535");
+	SENDIPC("eadd hh0 0");
+	SENDIPC("eadd hh1 0");
+	SENDIPC("eadd hh2 0");
+	SENDIPC("eadd hh3 0");
+	SENDIPC("eaddteam");
+	SendTeamConfig(1);
+	SENDIPC("ecolor 16776960");
+	SENDIPC("eadd hh0 1");
+	SENDIPC("eadd hh1 1");
+	SENDIPC("eadd hh2 1");
+	SENDIPC("eadd hh3 1");
+}
+
+void HWGame::ParseMessage()
+{
+	switch(msgbuf[0])
+	{
+		case '?':
+		{
+			SENDIPC("!");
+			break;
+		}
+		case 'C':
+		{
+			SendConfig();
+			break;
+		}
+		case '+':
+		{
+			break;
+		}
+		default:
+		{
+			demo->append(msgsize);
+			demo->append(QByteArray::fromRawData(msgbuf, msgsize));
+		}
+	}
+}
+
+void HWGame::SendIPC(const char * msg, quint8 len)
+{
+	IPCSocket->write((char *)&len, 1);
+	IPCSocket->write(msg, len);
+	if ((len > 5) && !((msg[0] == 'e') && (msg[1] == 'b')))
+	{
+		demo->append(len);
+		demo->append(QByteArray::fromRawData(msg, len));
+	}
+}
+
+void HWGame::SendIPC(const QByteArray & buf)
+{
+	if (buf.size() > 255) return;
+	quint8 len = buf.size();
+	IPCSocket->write((char *)&len, 1);
+	IPCSocket->write(buf);
+	demo->append(len);
+	demo->append(buf);
+}
+
+void HWGame::ClientRead()
+{
+	qint64 readbytes = 1;
+	while (readbytes > 0)
+	{
+		if (msgsize == 0)
+		{
+			msgbufsize = 0;
+			readbytes = IPCSocket->read((char *)&msgsize, 1);
+		} else
+		{
+			msgbufsize +=
+			readbytes = IPCSocket->read((char *)&msgbuf[msgbufsize], msgsize - msgbufsize);
+			if (msgbufsize = msgsize)
+			{
+				ParseMessage();
+				msgsize = 0;
+			}
+		}
+	}
+}
+
+void HWGame::Start(int Resolution, bool Fullscreen)
+{
+	if (TeamCount < 2) return;
+	QProcess * process;
+	QStringList arguments;
+	seedgen.GenRNDStr(seed, 10);
+	process = new QProcess;
+	arguments << resolutions[0][Resolution];
+	arguments << resolutions[1][Resolution];
+	arguments << GetThemeBySeed();
+	arguments << "46631";
+	arguments << seed;
+	arguments << (Fullscreen ? "1" : "0");
+	process->start("hw", arguments);
+	demo = new QByteArray;
+	demo->append(seed.toLocal8Bit());
+	demo->append(10);
+}
+
+void HWGame::AddTeam(const QString & teamname)
+{
+	if (TeamCount == 5) return;
+	teams[TeamCount] = teamname;
+	TeamCount++;
+}
+
+QString HWGame::GetThemeBySeed()
+{
+	QFile themesfile("Data/Themes/themes.cfg");
+	QStringList themes;
+	if (themesfile.open(QIODevice::ReadOnly))
+	{
+		QTextStream stream(&themesfile);
+		QString str;
+		while (!stream.atEnd())
+		{
+			themes << stream.readLine();
+		}
+		themesfile.close();
+	}
+	quint32 len = themes.size();
+	if (len == 0)
+	{
+		QMessageBox::critical(this, "Error", "Cannot access themes.cfg or bad data", "OK");
+		return "avematan";
+	}
+	if (seed.isEmpty())
+	{
+		QMessageBox::critical(this, "Error", "seed not defined", "OK");
+		return "avematan";
+	}
+	quint32 k = 0;
+	for (int i = 0; i < seed.length(); i++)
+	{
+		k += seed[i].unicode();
+	}
+	return themes[k % len];
+}
+
+void HWGame::SaveDemo(const QString & filename)
+{
+	QFile demofile(filename);
+	if (!demofile.open(QIODevice::WriteOnly))
+	{
+		QMessageBox::critical(this,
+				tr("Error"),
+				tr("Cannot save demo to file %s").arg(filename),
+				tr("Quit"));
+		return ;
+	}
+	QDataStream stream(&demofile);
+	stream.writeRawData(demo->constData(), demo->size());
+	demofile.close();
+}
--- a/QTfrontend/game.h	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/game.h	Tue Dec 06 19:46:40 2005 +0000
@@ -1,80 +1,84 @@
-/*
- * Hedgewars, a worms-like game
- * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GAME_H
-#define GAME_H
-
-#include <QObject>
-#include <QDialog>
-#include <QTcpServer>
-#include <QTcpSocket>
-#include <QByteArray>
-#include "team.h"
-#include "rndstr.h"
-
-#define IPC_PORT 46631
-#define MAXMSGCHARS 255
-#define SENDIPC(a) SendIPC(a, sizeof(a) - 1)
-
-class HWGame : public QDialog
-{
-	Q_OBJECT
-public:
-	HWGame();
-	void Start(int Resolution, bool Fullscreen);
-	void AddTeam(const QString & team);
-	
-private:
-	QTcpServer * IPCServer;
-	QTcpSocket * IPCSocket;
-	char msgbuf[MAXMSGCHARS];
-	unsigned char msgbufsize; 
-	unsigned char msgsize;
-	QString teams[5];
-	QString seed;
-	int TeamCount;
-	RNDStr seedgen;
-	
-	void SendConfig();
-	void SendTeamConfig(int index);
-	void ParseMessage();
-	void SendIPC(const char* msg, unsigned char len);
-	void SendIPC(const QByteArray buf);
-
-private slots:
-	void NewConnection();
-	void ClientDisconnect();
-	void ClientRead();
-};
-
-#endif
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * Distributed under the terms of the BSD-modified licence:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GAME_H
+#define GAME_H
+
+#include <QObject>
+#include <QDialog>
+#include <QTcpServer>
+#include <QTcpSocket>
+#include <QByteArray>
+#include <QString>
+#include "team.h"
+#include "rndstr.h"
+
+#define IPC_PORT 46631
+#define MAXMSGCHARS 255
+#define SENDIPC(a) SendIPC(a, sizeof(a) - 1)
+
+class HWGame : public QDialog
+{
+	Q_OBJECT
+public:
+	HWGame();
+	void Start(int Resolution, bool Fullscreen);
+	void AddTeam(const QString & team);
+
+private:
+	QTcpServer * IPCServer;
+	QTcpSocket * IPCSocket;
+	char msgbuf[MAXMSGCHARS];
+	quint8 msgbufsize;
+	quint8 msgsize;
+	QString teams[5];
+	QString seed;
+	int TeamCount;
+	RNDStr seedgen;
+	QByteArray * demo;
+
+	void SendConfig();
+	void SendTeamConfig(int index);
+	void ParseMessage();
+	void SendIPC(const char * msg, quint8 len);
+	void SendIPC(const QByteArray & buf);
+	void SaveDemo(const QString & filename);
+	QString GetThemeBySeed();
+
+private slots:
+	void NewConnection();
+	void ClientDisconnect();
+	void ClientRead();
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/gamecmds.cpp	Tue Dec 06 19:46:40 2005 +0000
@@ -0,0 +1,40 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * Distributed under the terms of the BSD-modified licence:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gamecmds.h"
+
+GameCMDs::GameCMDs(QWidget * parent)
+    : QWidget(parent)
+{
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/gamecmds.h	Tue Dec 06 19:46:40 2005 +0000
@@ -0,0 +1,51 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * Distributed under the terms of the BSD-modified licence:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * with the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GAMECMDS_H
+#define GAMECMDS_H
+
+#include <QWidget>
+
+class GameCMDs : public QWidget
+{
+	Q_OBJECT
+
+public:
+	GameCMDs(QWidget * parent = 0);
+
+private:
+	
+
+};
+
+#endif
--- a/QTfrontend/hwform.cpp	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/hwform.cpp	Tue Dec 06 19:46:40 2005 +0000
@@ -44,6 +44,7 @@
 #include "hwform.h"
 #include "sdlkeys.h"
 #include "hwconsts.h"
+//#include "gamecmds.h"
 
 HWForm::HWForm(QWidget *parent)
 	: QMainWindow(parent)
@@ -58,13 +59,13 @@
 		HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20));
 		HHNameEdit[i]->setMaxLength(15);
 	}
-	
+
 	QStringList binds;
 	for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++)
 	{
 		binds << sdlkeys[i][1];
 	}
-	
+
 	for(int i = 0; i < BINDS_NUMBER; i++)
 	{
 		LBind[i] = new QLabel(ui.GBoxBinds);
@@ -75,14 +76,14 @@
 		CBBind[i]->setGeometry(QRect(80, 20 + i * 30, 80, 20));
 		CBBind[i]->addItems(binds);
 	}
-	
+
 	QDir tmpdir;
 	tmpdir.cd(DATA_PATH);
 	tmpdir.cd("Forts");
 	tmpdir.setFilter(QDir::Files);
-	
+
 	ui.CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1"));
-	
+
 	tmpdir.cd("../Graphics/Graves");
 	QStringList list = tmpdir.entryList(QStringList("*.png"));
 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
@@ -95,7 +96,7 @@
 	{
 		if (!cfgdir.mkdir(".hedgewars"))
 		{
-			QMessageBox::critical(this, 
+			QMessageBox::critical(this,
 					tr("Error"),
 					tr("Cannot create directory %s").arg("/.hedgewars"),
 					tr("Quit"));
@@ -103,43 +104,44 @@
 		return ;
 	}
 	cfgdir.cd(".hedgewars");
-	
+
 	list = cfgdir.entryList(QStringList("*.cfg"));
 	for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
 	{
 		ui.CBTeamName->addItem((*it).replace(QRegExp("^(.*).cfg"), "\\1"));
 	}
-	
-	
+
+
 	QFile settings(cfgdir.absolutePath() + "/options");
-	if (!settings.open(QIODevice::ReadOnly))
-	{
-		return ;
-	}
-	QTextStream stream(&settings);
-	stream.setCodec("UTF-8");	
-	QString str;
-	
-	while (!stream.atEnd())
+	if (settings.open(QIODevice::ReadOnly))
 	{
-		str = stream.readLine();
-		if (str.startsWith(";")) continue;
-		if (str.startsWith("resolution "))
+		QTextStream stream(&settings);
+		stream.setCodec("UTF-8");
+		QString str;
+
+		while (!stream.atEnd())
 		{
-			str.remove(0, 11);
-			ui.CBResolution->setCurrentIndex(str.toLong());
-		} else
-		if (str.startsWith("fullscreen "))
-		{
-			str.remove(0, 11);
-			ui.CBFullscreen->setChecked(str.toLong());
+			str = stream.readLine();
+			if (str.startsWith(";")) continue;
+			if (str.startsWith("resolution "))
+			{
+				str.remove(0, 11);
+				ui.CBResolution->setCurrentIndex(str.toLong());
+			} else
+			if (str.startsWith("fullscreen "))
+			{
+				str.remove(0, 11);
+				ui.CBFullscreen->setChecked(str.toLong());
+			}
 		}
+		settings.close();
 	}
-	settings.close();
 	connect(ui.BtnSPBack, SIGNAL(clicked()), this, SLOT(GoToMain()));
 	connect(ui.BtnSetupBack, SIGNAL(clicked()), this, SLOT(GoToMain()));
+	connect(ui.BtnMPBack, SIGNAL(clicked()), this, SLOT(GoToMain()));
 	connect(ui.BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer()));
 	connect(ui.BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup()));
+	connect(ui.BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
 	connect(ui.BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam()));
 	connect(ui.BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam()));
 	connect(ui.BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave()));
@@ -166,9 +168,13 @@
 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
 }
 
+void HWForm::GoToMultiplayer()
+{
+	ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER);
+}
 void HWForm::NewTeam()
 {
-	tmpTeam = new HWTeam();
+	tmpTeam = new HWTeam("unnamed");
 	tmpTeam->SetCfgDir(cfgdir.absolutePath());
 	tmpTeam->SetToPage(this);
 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
@@ -176,7 +182,7 @@
 
 void HWForm::EditTeam()
 {
-	tmpTeam = new HWTeam();
+	tmpTeam = new HWTeam(ui.CBTeamName->currentText());
 	tmpTeam->SetCfgDir(cfgdir.absolutePath());
 	tmpTeam->LoadFromFile();
 	tmpTeam->SetToPage(this);
@@ -185,7 +191,6 @@
 
 void HWForm::TeamSave()
 {
-	tmpTeam = new HWTeam();
 	tmpTeam->GetFromPage(this);
 	tmpTeam->SaveToFile();
 	delete tmpTeam;
@@ -222,7 +227,7 @@
 	QFile settings(cfgdir.absolutePath() + "/options");
 	if (!settings.open(QIODevice::WriteOnly))
 	{
-		QMessageBox::critical(this, 
+		QMessageBox::critical(this,
 				tr("Error"),
 				tr("Cannot save options to file %s").arg(settings.fileName()),
 				tr("Quit"));
--- a/QTfrontend/hwform.h	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/hwform.h	Tue Dec 06 19:46:40 2005 +0000
@@ -57,6 +57,7 @@
 	void GoToMain();
 	void GoToSinglePlayer();
 	void GoToSetup();
+	void GoToMultiplayer();
 	void NewTeam();
 	void EditTeam();
 	void TeamSave();
@@ -79,5 +80,6 @@
 #define ID_PAGE_SINGLEPLAYER 0
 #define ID_PAGE_SETUP 2
 #define ID_PAGE_SETUP_TEAM 1
+#define ID_PAGE_MULTIPLAYER 3
 
 #endif
--- a/QTfrontend/hwform.ui	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/hwform.ui	Tue Dec 06 19:46:40 2005 +0000
@@ -50,7 +50,7 @@
      </size>
     </property>
     <property name="currentIndex" >
-     <number>1</number>
+     <number>4</number>
     </property>
     <widget class="QWidget" name="page" >
      <widget class="QPushButton" name="BtnSPBack" >
@@ -555,7 +555,7 @@
       <property name="geometry" >
        <rect>
         <x>240</x>
-        <y>180</y>
+        <y>340</y>
         <width>161</width>
         <height>41</height>
        </rect>
@@ -581,13 +581,56 @@
        <bool>false</bool>
       </property>
      </widget>
+     <widget class="QListWidget" name="listWidget" >
+      <property name="geometry" >
+       <rect>
+        <x>160</x>
+        <y>50</y>
+        <width>221</width>
+        <height>211</height>
+       </rect>
+      </property>
+      <property name="modelColumn" >
+       <number>0</number>
+      </property>
+     </widget>
     </widget>
     <widget class="QWidget" name="pageMain" >
+     <widget class="QPushButton" name="BtnSinglePlayer" >
+      <property name="geometry" >
+       <rect>
+        <x>230</x>
+        <y>70</y>
+        <width>161</width>
+        <height>41</height>
+       </rect>
+      </property>
+      <property name="font" >
+       <font>
+        <family>MS Shell Dlg</family>
+        <pointsize>14</pointsize>
+        <weight>50</weight>
+        <italic>false</italic>
+        <bold>false</bold>
+        <underline>false</underline>
+        <strikeout>false</strikeout>
+       </font>
+      </property>
+      <property name="text" >
+       <string>Single Player</string>
+      </property>
+      <property name="checkable" >
+       <bool>false</bool>
+      </property>
+      <property name="checked" >
+       <bool>false</bool>
+      </property>
+     </widget>
      <widget class="QPushButton" name="BtnMultiplayer" >
       <property name="geometry" >
        <rect>
         <x>230</x>
-        <y>160</y>
+        <y>120</y>
         <width>161</width>
         <height>41</height>
        </rect>
@@ -613,11 +656,41 @@
        <bool>false</bool>
       </property>
      </widget>
+     <widget class="QPushButton" name="BtnSetup" >
+      <property name="geometry" >
+       <rect>
+        <x>230</x>
+        <y>220</y>
+        <width>161</width>
+        <height>41</height>
+       </rect>
+      </property>
+      <property name="font" >
+       <font>
+        <family>MS Shell Dlg</family>
+        <pointsize>14</pointsize>
+        <weight>50</weight>
+        <italic>false</italic>
+        <bold>false</bold>
+        <underline>false</underline>
+        <strikeout>false</strikeout>
+       </font>
+      </property>
+      <property name="text" >
+       <string>Setup</string>
+      </property>
+      <property name="checkable" >
+       <bool>false</bool>
+      </property>
+      <property name="checked" >
+       <bool>false</bool>
+      </property>
+     </widget>
      <widget class="QPushButton" name="BtnDemos" >
       <property name="geometry" >
        <rect>
         <x>230</x>
-        <y>260</y>
+        <y>270</y>
         <width>161</width>
         <height>41</height>
        </rect>
@@ -643,41 +716,11 @@
        <bool>false</bool>
       </property>
      </widget>
-     <widget class="QPushButton" name="BtnSetup" >
-      <property name="geometry" >
-       <rect>
-        <x>230</x>
-        <y>210</y>
-        <width>161</width>
-        <height>41</height>
-       </rect>
-      </property>
-      <property name="font" >
-       <font>
-        <family>MS Shell Dlg</family>
-        <pointsize>14</pointsize>
-        <weight>50</weight>
-        <italic>false</italic>
-        <bold>false</bold>
-        <underline>false</underline>
-        <strikeout>false</strikeout>
-       </font>
-      </property>
-      <property name="text" >
-       <string>Setup</string>
-      </property>
-      <property name="checkable" >
-       <bool>false</bool>
-      </property>
-      <property name="checked" >
-       <bool>false</bool>
-      </property>
-     </widget>
      <widget class="QPushButton" name="BtnExit" >
       <property name="geometry" >
        <rect>
         <x>230</x>
-        <y>310</y>
+        <y>320</y>
         <width>161</width>
         <height>41</height>
        </rect>
@@ -703,11 +746,11 @@
        <bool>false</bool>
       </property>
      </widget>
-     <widget class="QPushButton" name="BtnSinglePlayer" >
+     <widget class="QPushButton" name="BtnNetwork" >
       <property name="geometry" >
        <rect>
         <x>230</x>
-        <y>110</y>
+        <y>170</y>
         <width>161</width>
         <height>41</height>
        </rect>
@@ -724,7 +767,7 @@
        </font>
       </property>
       <property name="text" >
-       <string>Single Player</string>
+       <string>Net game</string>
       </property>
       <property name="checkable" >
        <bool>false</bool>
--- a/QTfrontend/team.cpp	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/team.cpp	Tue Dec 06 19:46:40 2005 +0000
@@ -36,9 +36,9 @@
 #include "team.h"
 #include "hwform.h"
 
-HWTeam::HWTeam()
+HWTeam::HWTeam(const QString & teamname)
 {
-	TeamName = "unnamed";
+	TeamName = teamname;
 	for (int i = 0; i < 8; i++) HHName[i].sprintf("hedgehog %d", i);
 	Grave = "Simple";
 	Fort = "Barrelhouse";
@@ -126,36 +126,36 @@
 
 void HWTeam::SetToPage(HWForm * hwform)
 {
-	form->TeamNameEdit->setText(TeamName);
+	hwform->TeamNameEdit->setText(TeamName);
 	for(int i = 0; i < 8; i++)
 	{
-		form->HHNameEdit[i]->setText(HHName[i]);
+		hwform->HHNameEdit[i]->setText(HHName[i]);
 	}
-	form->ui.CBGrave->setCurrentIndex(form->ui.CBGrave->findText(Grave));
-	form->CBGrave_activated(Grave);
+	hwform->ui.CBGrave->setCurrentIndex(hwform->ui.CBGrave->findText(Grave));
+	hwform->CBGrave_activated(Grave);
 	
-	form->ui.CBFort->setCurrentIndex(form->ui.CBFort->findText(Fort));
-	form->CBFort_activated(Fort);
+	hwform->ui.CBFort->setCurrentIndex(hwform->ui.CBFort->findText(Fort));
+	hwform->CBFort_activated(Fort);
 	
 	for(int i = 0; i < BINDS_NUMBER; i++)
 	{
-		form->CBBind[i]->setCurrentIndex(form->CBBind[i]->findText(binds[i].strbind));
+		hwform->CBBind[i]->setCurrentIndex(hwform->CBBind[i]->findText(binds[i].strbind));
 	}
 }
 
 void HWTeam::GetFromPage(HWForm * hwform)
 {
-	TeamName  = form->TeamNameEdit->text();
+	TeamName  = hwform->TeamNameEdit->text();
 	for(int i = 0; i < 8; i++)
 	{
-		HHName[i] = form->HHNameEdit[i]->text();
+		HHName[i] = hwform->HHNameEdit[i]->text();
 	}
 	
-	Grave = form->ui.CBGrave->currentText();
-	Fort = form->ui.CBFort->currentText();
+	Grave = hwform->ui.CBGrave->currentText();
+	Fort = hwform->ui.CBFort->currentText();
 	for(int i = 0; i < 8; i++)
 	{
-		binds[i].strbind = form->CBBind[i]->currentText();
+		binds[i].strbind = hwform->CBBind[i]->currentText();
 	}
 }
 
--- a/QTfrontend/team.h	Mon Dec 05 21:46:15 2005 +0000
+++ b/QTfrontend/team.h	Tue Dec 06 19:46:40 2005 +0000
@@ -41,9 +41,8 @@
 class HWTeam
 {
 	public:
-		HWTeam();
+		HWTeam(const QString & teamname);
 		
-		HWForm * form;
 		QString TeamName;
 		QString HHName[8];
 		QString	Grave;
Binary file hedgewars/Data/Themes/avematan/inf.png has changed
Binary file hedgewars/Data/Themes/avematan/ksi.png has changed
Binary file hedgewars/Data/Themes/avematan/sqrt.png has changed
--- a/hedgewars/Data/Themes/avematan/theme.cfg	Mon Dec 05 21:46:15 2005 +0000
+++ b/hedgewars/Data/Themes/avematan/theme.cfg	Tue Dec 06 19:46:40 2005 +0000
@@ -1,6 +1,10 @@
 8388608
-2
+4
 a
 186 221 65 220 45 1 1 0 0 186 180
 e
 150 181 56 180 33 1 2 0 65 117 90 65 0 95 118
+inf
+248 112 220 5 22 18 1 0 0 205 112
+sqrt
+264 249 2 191 7 25 3 25 183 82 66 68 54 81 131 117 2 146 55
\ No newline at end of file
--- a/hedgewars/Data/Themes/themes.cfg	Mon Dec 05 21:46:15 2005 +0000
+++ b/hedgewars/Data/Themes/themes.cfg	Tue Dec 06 19:46:40 2005 +0000
@@ -1,4 +1,3 @@
-7
 avematan
 bubbles
 ethereal
--- a/hedgewars/Hedge.dpr	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-program Hedge;
-
-uses
-  windows,
-  messages,
-  WinSock,
-  IniFiles,
-  SysUtils,
-  uRandom,
-  fNet in 'fNet.pas',
-  fGUI in 'fGUI.pas',
-  fConsts in 'fConsts.pas',
-  fIPC in 'fIPC.pas',
-  fMisc in 'fMisc.pas',
-  fGame in 'fGame.pas',
-  fOptionsGUI in 'fOptionsGUI.pas';
-
-{$R Hedge.res}
-
-begin
-DoCreateMainWindow;
-DoCreateOptionsWindow;
-InitWSA;
-LoadGraphics;
-DoCreateControls;
-DoCreateOptionsControls;
-DoInit;
-repeat
-ProcessMessages;
-until isTerminated
-end.
-
Binary file hedgewars/Hedge.res has changed
--- a/hedgewars/fConsts.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fConsts;
-interface
-
-const cAppName  = '†Hedge Wars Logon†';
-      cAppTitle = 'HEDGEWARS';
-      cOptionsName  = 'Team Options';
-      cOptionsTitle = 'Team Options';
-      cGFXPath  = 'Data\front\';
-
-      cLocalGameBtn = 1001;
-      cNetGameBtn   = 1002;
-      cDemoBtn      = 1003;
-      cSettingsBtn  = 1004;
-      cExitGameBtn  = 1005;
-
-      cNetIpEdit    = 1021;
-      cNetIpStatic  = 1022;
-      cNetNameEdit  = 1023;
-      cNetNameStatic= 1024;
-      cNetConnStatic= 1024;
-      cNetJoinBtn   = 1025;
-      cNetBeginBtn  = 1026;
-      cNetBackBtn   = 1027;
-
-      cDemoList     = 1031;
-      cDemoBeginBtn = 1032;
-      cDemoBackBtn  = 1033;
-      cDemoAllBtn   = 1034;
-
-      cSetResEdit   = 1041;
-      cSetFScrCheck = 1042;
-      cSetDemoCheck = 1043;
-      cSetSndCheck  = 1044;
-      cSetSaveBtn   = 1045;
-      cSetBackBtn   = 1046;
-      cSetShowTeamOptions = 1047;
-
-      cBGStatic     = 1199;
-      cOptBGStatic  = 1198;
-
-      cOptTeamName  = 1201;
-      cOptHedgeName : array[0..7] of integer = (1202,1203,1204,1205,1206,1207,1208,1209); 
-
-      cDemoSeedSeparator = #10;
-
-
-implementation
-
-end.
--- a/hedgewars/fGUI.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fGUI;
-interface
-uses Windows;
-
-procedure ProcessMessages;
-function GetWindowTextStr(hwnd: HWND): string;
-procedure DoControlPress(wParam: WPARAM;  lParam: LPARAM);
-procedure DoDrawButton(idCtl: UINT; lpmis: PDrawItemStruct);
-procedure LoadGraphics;
-procedure DoDestroy;
-procedure DoCreateControls;
-procedure DoCreateMainWindow;
-
-
-var hwndMain,hwndOptions: HWND;
-var isTerminated: boolean = false;
-var //main menu
-    bitmap       ,optbmp        ,localbmp      ,netbmp      ,demobmp    ,exitbmp      ,setsbmp      : HBITMAP;
-    BackGroundDC ,OptBGroundDC  ,DCLocalGame   ,DCNetGame   ,DCDemoPlay ,DCExitGame   ,DCSettings   : HDC;
-                  HLocalGameBtn ,HNetGameBtm ,HDemoBtn   ,HExitGameBtn ,HSettingsBtn, HBGStatic : HWND;
-    //other
-    HNetIPEdit,HNetIPStatic: HWND;
-    HNetNameEdit,HNetNameStatic,HNetConnectionStatic: HWND;
-    HNetJoinBtn,HNetBeginBtn,HNetBackBtn:HWND;
-    HDemoList,HDemoBeginBtn,HDemoBackBtn,HDemoAllBtn:HWND;
-    HSetResEdit,HFullScrCheck,HSetDemoCheck,HSetSndCheck,HSetSaveBtn,HSetBackBtn,HSetShowTeamOptionsBtn:HWND;
-    scrx, scry: real;
-
-
-implementation
-uses fConsts, Messages, SysUtils, uConsts, fGame, fNet, fMisc, fOptionsGUI;
-
-function GetWindowTextStr(hwnd: HWND): string;
-var i: integer;
-begin
-i:= GetWindowTextLength(hwnd);
-SetLength(Result, i);
-GetWindowText(hwnd, PChar(Result), Succ(i))
-end;
-
-
-procedure ProcessMessages;
-var Message: Windows.MSG;
-begin
-if PeekMessage(Message,0,0,0,PM_REMOVE) then
-  if Message.message <> WM_QUIT then
-    begin
-    TranslateMessage(Message);
-    DispatchMessage(Message)
-    end else isTerminated:= true
-end;
-
-procedure HideMain;
-begin
-ShowWindow(HLocalGameBtn,SW_HIDE);
-ShowWindow(HNetGameBtm,SW_HIDE);
-ShowWindow(HDemoBtn,SW_HIDE);
-ShowWindow(HSettingsBtn,SW_HIDE);
-ShowWindow(HExitGameBtn,SW_HIDE)
-end;
-
-procedure ShowMain;
-begin
-ShowWindow(HLocalGameBtn,SW_SHOW);
-ShowWindow(HNetGameBtm,SW_SHOW);
-ShowWindow(HDemoBtn,SW_SHOW);
-ShowWindow(HSettingsBtn,SW_SHOW);
-ShowWindow(HExitGameBtn,SW_SHOW);
-SetFocus(HLocalGameBtn)
-end;
-
-
-
-procedure ShowNetGameMenu;
-begin
-HideMain;
-ShowWindow(HNetIPStatic,SW_SHOW);
-ShowWindow(HNetIPEdit,SW_SHOW);
-ShowWindow(HNetNameStatic,SW_SHOW);
-ShowWindow(HNetNameEdit,SW_SHOW);  
-ShowWindow(HNetConnectionStatic,SW_SHOW);
-ShowWindow(HNetJoinBtn,SW_SHOW);
-ShowWindow(HNetBeginBtn,SW_SHOW);
-ShowWindow(HNetBackBtn,SW_SHOW);
-SetFocus(HNetJoinBtn)
-end;
-
-
-procedure ShowMainFromNetMenu;
-begin
-ShowWindow(HNetIPEdit,SW_HIDE);
-ShowWindow(HNetIPStatic,SW_HIDE);
-ShowWindow(HNetNameEdit,SW_HIDE);
-ShowWindow(HNetNameStatic,SW_HIDE);
-ShowWindow(HNetConnectionStatic,SW_HIDE);
-ShowWindow(HNetJoinBtn,SW_HIDE);
-ShowWindow(HNetBeginBtn,SW_HIDE);
-ShowWindow(HNetBackBtn,SW_HIDE);
-ShowMain
-end;
-
-
-procedure ShowDemoMenu;
-var i: integer;
-    sr: TSearchRec;
-begin
-SendMessage(HDemoList, LB_RESETCONTENT, 0, 0);
-i:= FindFirst(format('%s*.hwd_%d',[Pathz[ptDemos], cNetProtoVersion]), faAnyFile and not faDirectory, sr);
-while i = 0 do
-      begin
-      SendMessage(HDemoList, LB_ADDSTRING, 0, LPARAM(PChar(sr.Name)));
-      i:= FindNext(sr)
-      end;
-FindClose(sr);
-
-HideMain;
-
-ShowWindow(HDemoList,SW_SHOW);
-ShowWindow(HDemoBeginBtn,SW_SHOW);
-ShowWindow(HDemoAllBtn,SW_SHOW);
-ShowWindow(HDemoBackBtn,SW_SHOW);
-SetFocus(HDemoList)
-end;
-
-procedure ShowMainFromDemoMenu;
-begin
-ShowWindow(HDemoList,SW_HIDE);
-ShowWindow(HDemoBeginBtn,SW_HIDE);
-ShowWindow(HDemoAllBtn,SW_HIDE);
-ShowWindow(HDemoBackBtn,SW_HIDE);
-ShowMain
-end;
-
-procedure ShowSettingsMenu;
-begin
-HideMain;
-ShowWindow(HSetResEdit,SW_SHOW);
-ShowWindow(HFullScrCheck,SW_SHOW);
-ShowWindow(HSetDemoCheck,SW_SHOW);
-ShowWindow(HSetSndCheck,SW_SHOW);
-ShowWindow(HSetSaveBtn,SW_SHOW);
-ShowWindow(HSetBackBtn,SW_SHOW);
-ShowWindow(HSetShowTeamOptionsBtn,SW_SHOW);
-SetFocus(HSetResEdit)
-end;
-
-procedure ShowMainFromSettings;
-begin
-ShowWindow(HSetResEdit,SW_HIDE);
-ShowWindow(HFullScrCheck,SW_HIDE);
-ShowWindow(HSetDemoCheck,SW_HIDE);
-ShowWindow(HSetSndCheck,SW_HIDE);
-ShowWindow(HSetSaveBtn,SW_HIDE);
-ShowWindow(HSetBackBtn,SW_HIDE);
-ShowWindow(HSetShowTeamOptionsBtn,SW_HIDE);
-ShowMain
-end;
-
-procedure DoControlPress(wParam: WPARAM;  lParam: LPARAM);
-begin
-case LOWORD(wParam) of
-    cLocalGameBtn : StartLocalGame;
-    cNetGameBtn   : ShowNetGameMenu;
-    cDemoBtn      : ShowDemoMenu;
-    cSettingsBtn  : ShowSettingsMenu;
-    cExitGameBtn  : Halt;
-    cNetBackBtn   : ShowMainFromNetMenu;
-    cNetJoinBtn   : NetConnect;
-    cNetBeginBtn  : StartNetGame;
-    cDemoBackBtn  : ShowMainFromDemoMenu;
-    cDemoAllBtn   : MessageBeep(0);//PlayAllDemos;
-    cDemoBeginBtn : StartDemoView;
-    cSetSaveBtn   : SaveSettings;
-    cSetBackBtn   : ShowMainFromSettings;
-    cSetShowTeamOptions : ShowOptionsWindow;
-    end
-end;
-
-procedure DoDrawButton(idCtl: UINT; lpmis: PDrawItemStruct);
-begin
-case lpmis.CtlID of
-  cLocalGameBtn: StretchBlt(lpmis.hDC,0,0,trunc(309*scrx),trunc(22*scry),DCLocalGame,0,0,309,22,SRCCOPY);
-    cNetGameBtn: StretchBlt(lpmis.hDC,0,0,trunc(272*scrx),trunc(22*scry),DCNetGame  ,0,0,272,22,SRCCOPY);
-       cDemoBtn: StretchBlt(lpmis.hDC,0,0,trunc(181*scrx),trunc(22*scry),DCDemoPlay ,0,0,181,22,SRCCOPY);
-   cSettingsBtn: StretchBlt(lpmis.hDC,0,0,trunc(147*scrx),trunc(22*scry),DCSettings ,0,0,147,22,SRCCOPY);
-   cExitGameBtn: StretchBlt(lpmis.hDC,0,0,trunc(272*scrx),trunc(22*scry),DCExitGame ,0,0,272,22,SRCCOPY);
-      cBGStatic: StretchBlt(lpmis.hDC,0,0,trunc(1024*scrx),trunc(768*scry),BackGroundDC,0,0,1024,768,SRCCOPY);
-   cOptBGStatic: StretchBlt(lpmis.hDC,0,0,trunc(1024*scrx),trunc(768*scry),OptBGroundDC,0,0,1024,768,SRCCOPY);
-     end
-end;
-
-procedure LoadGraphics;
-begin
-scrx :=  GetSystemMetrics(SM_CXSCREEN)/1024;
-scry :=  GetSystemMetrics(SM_CYSCREEN)/768;
-LoadOwnerBitmap(bitmap, cGFXPath + 'front.bmp',      BackGroundDC,hwndMain);
-LoadOwnerBitmap(optbmp, cGFXPath + 'TeamSettings.bmp',OptBGroundDC,hwndOptions);
-LoadOwnerBitmap(localbmp,cGFXPath + 'startlocal.bmp', DCLocalGame,cLocalGameBtn);
-LoadOwnerBitmap(netbmp,  cGFXPath + 'startnet.bmp',   DCNetGame,  cNetGameBtn);
-LoadOwnerBitmap(demobmp, cGFXPath + 'playdemo.bmp',   DCDemoPlay, cDemoBtn);
-LoadOwnerBitmap(setsbmp, cGFXPath + 'settings.bmp',   DCSettings, cSettingsBtn);
-LoadOwnerBitmap(exitbmp, cGFXPath + 'exit.bmp',       DCExitGame, cExitGameBtn);
-end;
-
-procedure DoDestroy;
-begin
-DeleteObject(localbmp);
-DeleteObject(optbmp);
-DeleteObject(bitmap);
-DeleteObject(netbmp);
-DeleteObject(demobmp);
-DeleteObject(setsbmp);
-DeleteObject(bitmap);
-DeleteDC(DCLocalGame);
-DeleteDC(DCNetGame);
-DeleteDC(DCDemoPlay);
-DeleteDC(DCSettings);
-DeleteDC(BackGroundDC);
-DeleteDC(OptBGroundDC)
-end;
-
-procedure DoCreateControls;
-begin
-HBGStatic      := CreateWindow('STATIC','bg image static'  ,WS_CHILD or WS_VISIBLE or SS_OWNERDRAW, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), hwndMain, cBGStatic, HInstance, nil);
-/// main menu ///
-HLocalGameBtn  := CreateWindow('button','local game button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(510 * scrx), trunc(400 *scry), trunc(309* scrx) , trunc(22*scry) , hwndMain , cLocalGameBtn, HInstance,  nil );
-HNetGameBtm    := CreateWindow('button',  'net game button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(530 * scrx), trunc(450 *scry), trunc(272* scrx) , trunc(22*scry) , hwndMain ,   cNetGameBtn, HInstance,  nil );
-HDemoBtn       := CreateWindow('button', 'play demo button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(570 * scrx), trunc(500 *scry), trunc(181* scrx) , trunc(22*scry) , hwndMain ,      cDemoBtn, HInstance,  nil );
-HSettingsBtn   := CreateWindow('button', 'settings  button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(590 * scrx), trunc(550 *scry), trunc(147* scrx) , trunc(22*scry) , hwndMain ,  cSettingsBtn, HInstance,  nil );
-HExitGameBtn   := CreateWindow('button', 'exit game button',WS_CHILD or WS_VISIBLE or BS_OWNERDRAW, trunc(530 * scrx), trunc(600 *scry), trunc(272* scrx) , trunc(22*scry) , hwndMain ,  cExitGameBtn, HInstance,  nil );
-/// local menu ///
-/// net menu ///
-HNetIPEdit     := CreateWindow('EDIT', '255.255.255.255'   ,WS_CHILD or WS_TABSTOP,                     trunc(570* scrx), trunc(400*scry) , 150 , 16 , hwndMain ,  cNetIpEdit,     HInstance,  nil );
-HNetIPStatic   := CreateWindow('STATIC','IP :'             ,WS_CHILD or SS_SIMPLE,                      trunc(520* scrx), trunc(400*scry) , 50  , 16 , hwndMain ,  cNetIpStatic,   HInstance,  nil );
-HNetNameEdit   := CreateWindow('EDIT', 'Hedgewarrior'      ,WS_CHILD or WS_TABSTOP,                     trunc(570* scrx), trunc(420*scry) , 150 , 16 , hwndMain ,  cNetNameEdit,   HInstance,  nil );
-HNetNameStatic := CreateWindow('STATIC','Name : '          ,WS_CHILD or SS_SIMPLE,                      trunc(520* scrx), trunc(420*scry) , 50  , 16 , hwndMain ,  cNetNameStatic, HInstance,  nil );
-HNetConnectionStatic
-               := CreateWindow('STATIC','not connected'    ,WS_CHILD,                                   trunc(520* scrx), trunc(450*scry) , 90 , 16 , hwndMain ,  cNetConnStatic,  HInstance,  nil );
-HNetJoinBtn    := CreateWindow('BUTTON','Join Game'        ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(520* scrx), trunc(550*scry) , 90 , 20 , hwndMain ,  cNetJoinBtn,     HInstance,  nil );
-HNetBeginBtn   := CreateWindow('BUTTON','Begin Game'       ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(520* scrx), trunc(575*scry) , 90 , 20 , hwndMain ,  cNetBeginBtn,    HInstance,  nil );
-HNetBackBtn    := CreateWindow('BUTTON','Back'             ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(520* scrx), trunc(600*scry) , 90 , 20 , hwndMain ,  cNetBackBtn,     HInstance,  nil );
-/// demo menu ///
-HDemoList      := CreateWindow('LISTBOX',''                ,WS_CHILD or WS_TABSTOP, trunc(530* scrx),   trunc(400*scry) , trunc(200* scrx), trunc(200*scry), hwndMain,  cDemoList, HInstance,  nil );
-HDemoBeginBtn  := CreateWindow('BUTTON','Play demo'        ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(750* scrx), trunc(400*scry) , 100 , 20 , hwndMain ,  cDemoBeginBtn,   HInstance,  nil );
-HDemoAllBtn    := CreateWindow('BUTTON','Play all demos'   ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(750* scrx), trunc(425*scry) , 100 , 20 , hwndMain ,  cDemoAllBtn,     HInstance,  nil );
-HDemoBackBtn   := CreateWindow('BUTTON','Back'             ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(750* scrx), trunc(450*scry) , 100 , 20 , hwndMain ,  cDemoBackBtn,    HInstance,  nil );
-
-/// settings menu ///
-HSetResEdit    := CreateWindow('COMBOBOX', ''              ,WS_CHILD or CBS_DROPDOWNLIST or WS_TABSTOP, trunc(530* scrx), trunc(420*scry) , 150 , 100 , hwndMain ,  cSetResEdit,   HInstance,  nil );
-
-SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('640x480')));
-SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('800x600')));
-SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('1024x768')));
-SendMessage(HSetResEdit, CB_ADDSTRING, 0, LPARAM(PChar('1280x1024')));
-
-HFullScrCheck  := CreateWindow('BUTTON','Fullscreen'       ,WS_CHILD or BS_AUTOCHECKBOX or WS_TABSTOP,  trunc(530* scrx), trunc(450*scry) , 110 , 20 , hwndMain ,  cSetFScrCheck,  HInstance,  nil );
-HSetDemoCheck  := CreateWindow('BUTTON','Record Demo'      ,WS_CHILD or BS_AUTOCHECKBOX or WS_TABSTOP,  trunc(530* scrx), trunc(475*scry) , 110 , 20 , hwndMain ,  cSetDemoCheck,  HInstance,  nil );
-HSetSndCheck   := CreateWindow('BUTTON','Enable Sound'     ,WS_CHILD or BS_AUTOCHECKBOX or WS_TABSTOP,  trunc(530* scrx), trunc(500*scry) , 110 , 20 , hwndMain ,  cSetSndCheck,   HInstance,  nil );
-HSetSaveBtn    := CreateWindow('BUTTON','Save Settings'    ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(530* scrx), trunc(580*scry) , 100 , 20 , hwndMain ,  cSetSaveBtn,    HInstance,  nil );
-HSetBackBtn    := CreateWindow('BUTTON','Back'             ,WS_CHILD or BS_FLAT or WS_TABSTOP,          trunc(730* scrx), trunc(580*scry) , 90  , 20 , hwndMain ,  cSetBackBtn,    HInstance,  nil );
-HSetShowTeamOptionsBtn    := CreateWindow('BUTTON','Show Team Options' ,WS_CHILD or BS_FLAT or WS_TABSTOP, trunc(700* scrx), trunc(420*scry) , 140  , 20 , hwndMain ,  cSetShowTeamOptions,    HInstance,  nil );
-end;
-
-procedure DoCreateMainWindow;
-var  wc: WNDCLASS;
-begin
-FillChar(wc, sizeof(wc), 0);
-wc.style         := CS_VREDRAW or CS_HREDRAW;
-wc.hbrBackground := COLOR_BACKGROUND;
-wc.lpfnWndProc   := @MainWndProc;
-wc.hInstance     := hInstance;
-wc.lpszClassName := cAppName;
-wc.hCursor := LoadCursor(hwndMain,IDC_ARROW);
-if RegisterClass(wc) = 0 then begin MessageBox(0,'RegisterClass failed for main wnd','Failed',MB_OK); halt; end;
-hwndMain := CreateWindowEx( 0, cAppName, cAppTitle, WS_POPUP,
-	                    0, 0,
-	                    GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
-                            0, 0, hInstance, nil);
-
-ShowWindow(hwndMain,SW_SHOW);
-UpdateWindow(hwndMain)
-end;
-
-
-end.
--- a/hedgewars/fGame.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fGame;
-interface
-uses Windows;
-
-procedure GameStart;
-procedure StartNetGame;
-procedure StartDemoView;
-procedure StartLocalGame;
-
-implementation
-uses fMisc, fGUI, uConsts, uRandom, Messages, fConsts, SysUtils, fIPC, fNet;
-const
-    fmCreate         = $FFFF;
-    fmOpenRead       = $0000;
-    fmOpenWrite      = $0001;
-    fmOpenReadWrite  = $0002;
-
-var
-    MapPoints: array[0..19] of TPoint;
-
-function GetNextLine(var f: textfile): string;
-begin
-repeat
-  Readln(f, Result)
-until (Length(Result)>0)and(Result[1] <> '#')
-end;
-
-function GetThemeBySeed: string;
-var f: text;
-    i, n, t: integer;
-begin
-Result:= '';
-n:= 37;
-for i:= 1 to Length(seed) do
-    n:= (n shl 1) xor byte(seed[i]) xor n;
-FileMode:= fmOpenRead;
-AssignFile(f, Pathz[ptThemes] + 'themes.cfg');
-{$I-}
-Reset(f);
-val(GetNextLine(f), i, t);
-if i > 0 then
-   begin
-   n:= n mod i;
-   for i:= 0 to n do Result:= GetNextLine(f)
-   end;
-CloseFile(f);
-{$I+}
-FileMode:= fmOpenReadWrite;
-if IOResult <> 0 then
-   begin
-   MessageBox(hwndMain,PChar(String('Missing, corrupted or cannot access critical file'#13#10+Pathz[ptThemes] + 'themes.cfg')),'Ahctung!!!',MB_OK);
-   exit
-   end
-end;
-
-function ExecAndWait(FileName:String; Visibility : integer): Cardinal;
-var WorkDir: String;
-    StartupInfo:TStartupInfo;
-    ProcessInfo:TProcessInformation;
-begin
-GetDir(0, WorkDir);
-FillChar(StartupInfo, Sizeof(StartupInfo), 0);
-with StartupInfo do
-     begin
-     cb:= Sizeof(StartupInfo);
-     dwFlags:= STARTF_USESHOWWINDOW;
-     wShowWindow:= Visibility
-     end;
-if not CreateProcess(nil, PChar(FileName), nil, nil,
-                     false, CREATE_DEFAULT_ERROR_MODE or CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,
-                     nil, nil, StartupInfo, ProcessInfo)
-   then Result:= High(Cardinal)
-   else begin
-   while WaitforSingleObject(ProcessInfo.hProcess, 0) = WAIT_TIMEOUT do
-         begin
-         Sleep(10);
-         ProcessMessages;
-         end;
-   GetExitCodeProcess(ProcessInfo.hProcess, Result);
-   CloseHandle(ProcessInfo.hProcess);
-   CloseHandle(ProcessInfo.hThread)
-   end
-end;
-
-procedure GameStart;
-var sTheme:string;
-begin
-if seed = '' then
-   begin
-   MessageBox(hwndMain,'seed is unknown, but game started','Ahctung!!!',MB_OK);
-   exit
-   end;
-sTheme:= GetThemeBySeed;
-//if ExecAndWait('landgen.exe ' + sTheme + ' ' + seed, SW_HIDE) = 0 then
-   begin
-   ShowWindow(hwndMain, SW_MINIMIZE);
-   fWriteDemo:= SendMessage(HSetDemoCheck, BM_GETCHECK, 0, 0) = BST_CHECKED;
-   if fWriteDemo then
-      begin
-      AssignDemoFile('demo.hwd_1');
-      inc(seed[0]);
-      seed[Length(seed)]:= cDemoSeedSeparator;
-      WriteStrToDemo(seed)
-      end;
-   case ExecAndWait(format('hw.exe %s %s %d %s %d',[Resolutions[SendMessage(HSetResEdit,CB_GETCURSEL,0,0)], sTheme, IN_IPC_PORT, seed, SendMessage(HFullScrCheck,BM_GETCHECK,0,0)]), SW_NORMAL) of
-        High(Cardinal): MessageBox(hwndMain,'error executing game','fuck!',MB_OK);
-        end;
-   if fWriteDemo then
-      CloseDemoFile;
-   seed:= '';
-   ShowWindow(hwndMain, SW_RESTORE)
-   end {else begin
-   MessageBox(hwndMain,'error executing landgen','fuck!',MB_OK);
-   exit
-   end; }
-end;
-
-procedure StartNetGame;
-var i, ii: LongWord;
-    s: shortstring;
-    p: TPoint;
-    sbuf: string;
-begin // totally broken
-GenRandomSeed;
-SendNet('z'+seed);
-sbuf:= GetThemeBySeed;
-if ExecAndWait(format('landgen.exe %s %s',[sbuf, seed]), SW_HIDE) <> 0 then
-   begin
-   MessageBox(hwndMain,'error executing landgen','error',MB_OK);
-   exit;
-   end;
-SendNetAndWait('T');
-SendNet('K');          {
-for i:= 1 to TeamCount do
-    begin
-    s[0]:= #9;
-    s[1]:= 'h';
-    for ii:= 0 to 1 do
-        begin
-        p:= GetRandomMapPoint;
-        PLongWord(@s[2])^:= p.X;
-        PLongWord(@s[6])^:= p.Y;
-        SendNet(s);
-        end;
-    if i < TeamCount then SendNet('k');
-    end;     }
-SendNet('G')
-end;
-
-procedure StartDemoView;
-const cBufSize = 32;
-var f: file;
-    buf: array[0..pred(cBufSize)] of byte;
-    i, t: integer;
-begin
-if SendMessage(HDemoList,LB_GETCURSEL,0,0) = LB_ERR then//LBDemos.ItemIndex<0 then
-   begin
-   MessageBox(hwndMain,'Выбери демку слева','hint',MB_OK);
-   exit
-   end;
-GameType:= gtDemo;
-i:= SendMessage(HDemoList,LB_GETCURSEL,0,0);
-t:= SendMessage(HDemoList, LB_GETTEXTLEN, i, 0);
-SetLength(DemoFileName, t);
-SendMessage(HDemoList,LB_GETTEXT, i, LPARAM(@DemoFileName[1]));
-DemoFileName:= Pathz[ptDemos] + DemoFileName;
-AssignFile(f, DemoFileName);
-{$I-}
-FileMode:= fmOpenRead;
-Reset(f, 1);
-FileMode:= fmOpenReadWrite;
-if IOResult <> 0 then
-   begin
-   MessageBox(hwndMain,'file not found','error',MB_OK);
-   exit;
-   end;
-BlockRead(f, buf, cBufSize, t); // вырезаем seed
-seed:= '';
-i:= 0;
-while (char(buf[i]) <> cDemoSeedSeparator)and (i < t) do
-      begin
-      seed:= seed + chr(buf[i]);
-      inc(i);
-      end;
-CloseFile(f);
-{$I+}
-GameStart
-end;
-
-procedure StartLocalGame;
-begin
-GenRandomSeed;
-GameType:= gtLocal;
-GameStart
-end;
-
-
-
-end.
--- a/hedgewars/fIPC.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fIPC;{$J+}
-interface
-uses Messages, WinSock, Windows;
-const
-      IN_IPC_PORT  = 46631;
-      WM_ASYNC_IPCEVENT = WM_USER + 1;
-
-function InitIPCServer: boolean;
-procedure SendIPC(s: shortstring);
-procedure IPCEvent(sock: TSocket; lParam: LPARAM);
-
-var DemoFileName: string;
-
-implementation
-uses fGUI, fMisc, fNet, uConsts, fGame, SysUtils, fConsts;
-
-var hIPCListenSockTCP : TSocket = INVALID_SOCKET;
-    hIPCServerSocket  : TSocket = INVALID_SOCKET;
-
-function InitIPCServer: boolean;
-var myaddrTCP: TSockAddrIn;
-    t: integer;
-begin
-Result:= false;
-hIPCListenSockTCP:= socket(AF_INET, SOCK_STREAM, 0);
-myaddrTCP.sin_family      := AF_INET;
-myaddrTCP.sin_addr.s_addr := $0100007F;
-myaddrTCP.sin_port        := htons(IN_IPC_PORT);
-t:= sizeof(TSockAddrIn);
-if (   bind(hIPCListenSockTCP, myaddrTCP, t) <> 0) then exit;
-if ( listen(hIPCListenSockTCP, 1)            <> 0) then exit;
-WSAAsyncSelect(hIPCListenSockTCP, hwndMain, WM_ASYNC_IPCEVENT, FD_ACCEPT or FD_READ or FD_CLOSE);
-Result:= true
-end;
-
-procedure SendIPC(s: shortstring);
-begin
-if hIPCServerSocket <> INVALID_SOCKET then
-   begin
-   send(hIPCServerSocket, s[0], Succ(byte(s[0])), 0);
-   if fWriteDemo then
-      if not((Length(s) > 5) and (copy(s, 1, 5) = 'ebind')) then
-         WriteRawToDemo(s)
-   end;
-end;
-
-procedure SendConfig;
-const cBufLength = $10000;
-{$INCLUDE revision.inc}
-var f: file;
-    buf: array[0..Pred(cBufLength)] of byte;
-    i, t: integer;
-    s: shortstring;
-    sbuf:string;
-begin
-SendIPC('WFrontend svn ' + cRevision);
-SendIPC(format('e$sound %d',[SendMessage(HSetSndCheck, BM_GETCHECK, 0, 0)]));
-case GameType of
-    gtLocal: begin
-             SendIPC(format('e$gmflags %d',[0]));
-             SendIPC('eaddteam');
-             ExecCFG(Pathz[ptTeams] + 'unC0Rr.cfg');
-             SendIPC('ecolor 65535');
-             SendIPC('eadd hh0 0');
-             SendIPC('eadd hh1 0');
-             SendIPC('eadd hh2 0');
-             SendIPC('eadd hh3 0');
-             SendIPC('eaddteam');
-             ExecCFG(Pathz[ptTeams] + 'test.cfg');
-             SendIPC('eadd hh0 1');
-             SendIPC('eadd hh1 1');
-             SendIPC('eadd hh2 1');
-             SendIPC('eadd hh3 1');
-             SendIPC('ecolor 16776960');
-             end;
-     gtDemo: begin
-             AssignFile(f, DemoFileName);
-             {$I-}
-             Reset(f, 1);
-             if IOResult <> 0 then
-                begin
-                SendIPC('ECannot open file: "' + Pathz[ptDemos] + sbuf + '"');
-                exit;
-                end;
-             s:= 'TD';
-             s[0]:= #6;
-             PLongWord(@s[3])^:= FileSize(f);
-             SendIPC(s);  // посылаем тип игры - демо и размер демки
-             BlockRead(f, buf, cBufLength, t); // вырезаем seed
-             i:= 0;
-             while (chr(buf[i]) <> cDemoSeedSeparator)and (i < t) do inc(i);
-             inc(i);
-             // посылаем остаток файла
-             repeat
-             while i < t do
-                   begin
-                   CopyMemory(@s[0], @buf[i], Succ(buf[i]));
-                   SendIPC(s);
-                   inc(i, buf[i]);
-                   inc(i)
-                   end;
-             i:= 0;
-             BlockRead(f, buf, cBufLength, t);
-             until t = 0;
-             Closefile(f);
-             {$I+}
-             end;
-     gtNet: SendNet('C');
-     end;
-end;
-
-procedure ParseIPCCommand(s: shortstring);
-begin
-case s[1] of
-     '?': if GameType = gtNet then SendNet('?') else SendIPC('!');
-     'C': SendConfig;
-     else if GameType = gtNet then SendNet(s);
-          if fWriteDemo and (s[1] <> '+') then WriteRawToDemo(s)
-     end;
-end;
-
-procedure IPCEvent(sock: TSocket; lParam: LPARAM);
-const sipc: string = '';
-var WSAEvent: word;
-    i: integer;
-    buf: array[0..255] of byte;
-    s: shortstring absolute buf;
-begin
-WSAEvent:= WSAGETSELECTEVENT(lParam);
-case WSAEvent of
-   FD_CLOSE: begin
-             closesocket(sock);
-             hIPCServerSocket:= INVALID_SOCKET;
-             exit
-             end;
-    FD_READ: begin
-             repeat
-             i:= recv(sock, buf[1], 255, 0);
-             if i > 0 then
-                begin
-                buf[0]:= i;
-                sipc:= sipc + s;
-                SplitStream2Commands(sipc, ParseIPCCommand);
-                end;
-             until i < 1;
-             end;
- FD_ACCEPT:  hIPCServerSocket:= accept(hIPCListenSockTCP, nil, nil);
-   end
-end;
-
-end.
--- a/hedgewars/fMisc.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fMisc;
-{$J+}
-interface
-uses uConsts, Windows;
-const
-      fWriteDemo: boolean = false;
-type
-      TGameType = (gtLocal, gtNet, gtDemo);
-      TCommandHandler = procedure (s: shortstring);
-
-procedure ExecCFG(FileName: String);
-procedure AssignDemoFile(Filename: shortstring);
-procedure WriteRawToDemo(s: shortstring);
-procedure WriteStrToDemo(s: shortstring);
-procedure CloseDemoFile;
-procedure GenRandomSeed;
-procedure SaveSettings;
-procedure SplitStream2Commands(var ss: string; Handler: TCommandHandler);
-function MainWndProc(hwnd: HWND;  Message: UINT;  wParam: WPARAM;  lParam: LPARAM): LRESULT; stdcall;
-procedure LoadOwnerBitmap(var bmp: HBITMAP; name: string; var dc: HDC; owner:cardinal );
-procedure DoInit;
-procedure InitWSA;
-
-var
-    seed: shortstring;
-    GameType: TGameType;
-
-implementation
-uses fIPC, uRandom, IniFiles, SysUtils, Messages, fGUI, fNet, WinSock, fOptionsGUI;
-var fDemo: file;
-
-procedure ExecCFG(FileName: String);
-var f: textfile;
-    s: shortstring;
-begin
-AssignFile(f, FileName);
-{$I-}
-Reset(f);
-{$I+}
-if IOResult<>0 then SendIPC('ECannot open file: "' + FileName + '"');
-while not eof(f) do
-      begin
-      ReadLn(f, s);
-      if (s[0]<>#0)and(s[1]<>';') then SendIPC('e' + s);
-      end;
-CloseFile(f)
-end;
-
-procedure AssignDemoFile(Filename: shortstring);
-begin
-Assign(fDemo, Filename);
-Rewrite(fDemo, 1)
-end;
-
-procedure WriteRawToDemo(s: shortstring);
-begin
-if not fWriteDemo then exit;
-BlockWrite(fDemo, s[0], Succ(byte(s[0])))
-end;
-
-procedure WriteStrToDemo(s: shortstring);
-begin
-if not fWriteDemo then exit;
-BlockWrite(fDemo, s[1], byte(s[0]))
-end;
-
-procedure CloseDemoFile;
-begin
-CloseFile(fDemo)
-end;
-
-procedure GenRandomSeed;
-var i: integer;
-begin
-seed[0]:= chr(7 + GetRandom(6));
-for i:= 1 to byte(seed[0]) do seed[i]:= chr(byte('A') + GetRandom(26));
-seed:= '('+seed+')'
-end;
-
-procedure SaveSettings;
-var inif: TIniFile;
-begin
-inif:= TIniFile.Create(ExtractFilePath(ParamStr(0))+'hw.ini');
-inif.WriteInteger('Misc', 'ResIndex', SendMessage(HSetResEdit, CB_GETCURSEL, 0, 0));
-inif.WriteInteger('Misc', 'EnableSound', SendMessage(HSetSndCheck, BM_GETCHECK, 0, 0));
-inif.WriteInteger('Misc', 'Fullscreen', SendMessage(HFullScrCheck, BM_GETCHECK, 0, 0));
-inif.UpdateFile;
-inif.Free
-end;
-
-procedure SplitStream2Commands(var ss: string; Handler: TCommandHandler);
-var s: shortstring;
-begin
-while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do
-      begin
-      s:= copy(ss, 2, byte(ss[1]));
-      Delete(ss, 1, Succ(byte(ss[1])));
-      Handler(s)
-      end;
-end;
-
-function MainWndProc(hwnd: HWND;  Message: UINT;  wParam: WPARAM;  lParam: LPARAM): LRESULT; stdcall;
-begin
-case Message of
-     WM_ASYNC_IPCEVENT: IPCEvent(wParam, lParam);
-     WM_ASYNC_NETEVENT: NetEvent(wParam, lParam);
-     WM_COMMAND : DoControlPress(wParam, lParam);
-     WM_DRAWITEM: DoDrawButton(wParam,PDRAWITEMSTRUCT(lParam));
-     WM_CLOSE   : PostQuitMessage(0);
-     WM_DESTROY : if hwnd = hwndMain then DoDestroy
-     end;
-Result:= DefWindowProc(hwnd, Message, wParam,lParam)
-end;
-
-procedure LoadOwnerBitmap(var bmp: HBITMAP; name: string; var dc: HDC; owner:cardinal );
-begin
-bmp := LoadImage(0,PChar(name), IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
-if bmp = 0 then
-   begin
-   MessageBox(hwndMain, PChar(name + ' not found'), 'damn', MB_OK);
-   PostQuitMessage(0);
-   end;
-dc:=CreateCompatibleDC(GetDC(owner));
-SelectObject(dc,bmp);
-end;
-
-procedure DoInit;
-var sr: TSearchRec;
-    i: integer;
-    inif: TIniFile;
-    p: TPoint;
-begin
-GetCursorPos(p);
-SetRandomParams(IntToStr(GetTickCount), IntToStr(p.X)+'(сеху)'+IntToStr(p.Y));
-i:= FindFirst('Data\Maps\*', faDirectory, sr);
-while i=0 do
-      begin
-      if sr.Name[1]<>'.' then ;//LBMaps.Items.Add(sr.Name);
-      i:= FindNext(sr)
-      end;
-FindClose(sr);
-
-inif:= TIniFile.Create(ExtractFilePath(ParamStr(0))+'hw.ini');
-i:= inif.ReadInteger('Misc', 'ResIndex', 0);
-if inif.ReadBool('Misc', 'EnableSound', true) then SendMessage(HSetSndCheck,BM_SETCHECK,BST_CHECKED,0);
-if inif.ReadBool('Misc', 'Fullscreen', true) then SendMessage(HFullScrCheck,BM_SETCHECK,BST_CHECKED,0);
-if (i>=0)and(i<=3) then SendMessage(HSetResEdit,CB_SETCURSEL,i,0);
-SetWindowText(HNetIPEdit,PChar(inif.ReadString('Net','IP'  , ''       )));
-SetWindowText(HNetNameEdit,PChar(inif.ReadString('Net','Nick', 'Unnamed')));
-inif.Free;
-SendMessage(HSetDemoCheck, BM_SETCHECK, BST_CHECKED, 0);
-end;
-
-procedure InitWSA;
-var stWSADataTCPIP: WSADATA;
-begin
-if WSAStartup($0101, stWSADataTCPIP)<>0 then
-   begin
-   MessageBox(0, 'WSAStartup error !', 'NET ERROR!!!', 0);
-   halt
-   end;
-if not InitIPCServer then
-   begin
-   MessageBox(0, 'Error on init IPC server!', 'IPC Error', 0);
-   halt
-   end
-end;
-
-
-end.
--- a/hedgewars/fNet.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fNet;{$J+}
-interface
-uses Messages, WinSock, Windows;
-const
-      NET_PORT = 46632;
-      WM_ASYNC_NETEVENT = WM_USER + 2;
-
-procedure SendNet(s: shortstring);
-procedure SendNetAndWait(s: shortstring);
-procedure NetConnect;
-procedure NetEvent(sock: TSocket; lParam: LPARAM);
-
-var
-    TeamCount: LongWord;
-
-implementation
-uses fGUI, fMisc, fGame, fIPC, uConsts, IniFiles, SysUtils;
-var
-    hNetClientSocket: TSocket = INVALID_SOCKET;
-    isPonged: boolean;
-
-procedure SendNet(s: shortstring);
-begin
-if hNetClientSocket <> INVALID_SOCKET then
-   send(hNetClientSocket, s[0], Succ(byte(s[0])), 0)
-end;
-
-procedure SendNetAndWait(s: shortstring);
-begin
-SendNet(s);
-SendNet('?');
-isPonged:= false;
-repeat
-  ProcessMessages;
-  sleep(1)
-until isPonged
-end;
-
-procedure ParseNetCommand(s: shortstring);
-var sbuf : string;
-begin
-case s[1] of
-     '?': SendNet('!');
-     'i': begin
-          sbuf:= GetWindowTextStr(HNetNameEdit);
-          SendNet('n' + sbuf);;
-          end;
-     'z': begin
-          seed:= copy(s, 2, length(s) - 1)
-          end;
-     'G': begin
-          GameType:= gtNet;
-          GameStart
-          end;
-     '@': ExecCFG(Pathz[ptTeams] + 'unC0Rr.cfg');
-     '!': begin
-          isPonged:= true;
-          SendIPC('!');
-          end;
-     'T': TeamCount:= PLongWord(@s[2])^
-     else SendIPC(s) end;
-end;
-
-procedure NetConnect;
-var rmaddr: SOCKADDR_IN;
-    inif: TIniFile;
-    sbuf1,sbuf2: string;
-begin
-sbuf1:= GetWindowTextStr(HNetIPEdit);
-inif:= TIniFile.Create(ExtractFilePath(ParamStr(0))+'hw.ini');
-inif.WriteString('Net','IP' , sbuf1);
-sbuf2:= GetWindowTextStr(HNetNameEdit);
-inif.WriteString('Net','Nick', sbuf2);
-inif.Free;
-SetWindowText(HNetConnectionStatic,'Connecting...');
-rmaddr.sin_family      := AF_INET;
-rmaddr.sin_addr.s_addr := inet_addr(PChar(sbuf1));
-rmaddr.sin_port        := htons(NET_PORT);
-hNetClientSocket:= socket(AF_INET, SOCK_STREAM, 0);
-if INVALID_SOCKET = hNetClientSocket then
-   begin
-   MessageBox(hwndMain,'connect failed','failed',MB_OK);
-   SetWindowText(HNetConnectionStatic,'Error on connect');
-   exit
-   end;
-WSAAsyncSelect(hNetClientSocket, hwndMain, WM_ASYNC_NETEVENT, FD_CONNECT or FD_READ or FD_CLOSE);
-connect(hNetClientSocket, rmaddr, sizeof(rmaddr))
-end;
-
-procedure NetEvent(sock: TSocket; lParam: LPARAM);
-const snet: string = '';
-var WSAEvent: word;
-    i: integer;
-    buf: array[0..255] of byte;
-    s: shortstring absolute buf;
-begin
-WSAEvent:= WSAGETSELECTEVENT(lParam);
-case WSAEvent of
-   FD_CLOSE: begin
-             closesocket(sock);
-//           hIPCServerSocket:= INVALID_SOCKET;      гм-гм... FIXME: что-то тут должно быть имхо
-             SetWindowText(HNetConnectionStatic, 'Disconnected');
-             GameType:= gtLocal
-             end;
-    FD_READ: begin
-             repeat
-             i:= recv(sock, buf[1], 255, 0);
-             if i > 0 then
-                begin
-                buf[0]:= i;
-                snet:= snet + s;
-                SplitStream2Commands(snet, ParseNetCommand);
-                end;
-             until i < 1
-             end;
- FD_CONNECT: begin
-             i:= WSAGETSELECTERROR(lParam);
-             if i<>0 then
-                begin
-                closesocket(sock);
-                MessageBox(hwndMain,'Error on connect', 'Error', MB_OK);
-                SetWindowText(HNetConnectionStatic, 'Error on connect')
-                end else
-                begin
-                SetWindowText(HNetConnectionStatic,'connected');
-                GameType:= gtNet
-                end;
-             end
-    end
-end;
-
-end.
--- a/hedgewars/fOptionsGUI.pas	Mon Dec 05 21:46:15 2005 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-(*
- * Hedgewars, a worms-like game
- * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * Distributed under the terms of the BSD-modified licence:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * with the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *)
-
-unit fOptionsGUI;
-interface
-uses windows,
-     messages,SysUtils;
-
-procedure DoCreateOptionsWindow;
-procedure ShowOptionsWindow;
-procedure DoCreateOptionsControls;
-
-var HOptTeamName, HOptBGStatic : HWND;
-    HOptHedgeName : array[0..7] of HWND; 
-
-
-
-implementation
-uses fGUI,
-     fConsts, fMisc;
-
-procedure ShowOptionsWindow;
-begin
-ShowWindow(hwndOptions,SW_SHOW);
-ShowWindow(hwndMain, SW_HIDE);
-ShowWindow(HOptTeamName,SW_SHOW)
-end;
-
-procedure DoCreateOptionsControls;
-var i:integer;
-begin
-HOptBGStatic  := CreateWindow('STATIC','opt bg img'   ,WS_CHILD or WS_VISIBLE or SS_OWNERDRAW, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) , hwndOptions, cOptBGStatic, HInstance, nil);
-HOptTeamName  := CreateWindow('EDIT','Колючая Команда',WS_CHILD or WS_TABSTOP or WS_VISIBLE, trunc(260 * scrx), trunc(70 *scry), trunc(215* scrx) , trunc(28*scry) , hwndOptions, cOptTeamName, HInstance, nil);
-for i := 0 to 7 do
-HOptHedgeName[i] := CreateWindow('EDIT',PChar('Йож '+inttostr(i+1)),WS_CHILD or WS_TABSTOP or WS_VISIBLE, trunc(110 * scrx), trunc((102+i*28)*scry), trunc(260* scrx) , trunc(25*scry) , hwndOptions, cOptTeamName, HInstance, nil);
-end;
-
-procedure DoCreateOptionsWindow;
-var  wc: WNDCLASS;
-begin
-FillChar(wc, sizeof(wc), 0);
-wc.style         := CS_VREDRAW or CS_HREDRAW;
-wc.hbrBackground := COLOR_BACKGROUND;
-wc.lpfnWndProc   := @MainWndProc;
-wc.hInstance     := hInstance;
-wc.lpszClassName := cOptionsName;
-wc.hCursor := LoadCursor(hwndOptions,IDC_ARROW);
-if RegisterClass(wc) = 0 then begin MessageBox(0,'RegisterClass failed for opts wnd','Failed',MB_OK); halt; end;
-hwndOptions := CreateWindowEx(0, cOptionsName, cOptionsTitle, WS_POPUP,
-	                    0, 0,
-	                    GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
-                            0, 0, hInstance, nil)
-end;
-
-
-end.
--- a/hedgewars/uLandTemplates.pas	Mon Dec 05 21:46:15 2005 +0000
+++ b/hedgewars/uLandTemplates.pas	Tue Dec 06 19:46:40 2005 +0000
@@ -94,7 +94,7 @@
        ),
        (BasePoints: @Template2Points;
         BasePointsCount: Succ(High(Template2Points));
-        BezPassCnt: 2;
+        BezPassCnt: 3;
         PassMin: 3; PassDelta: 2;
         WaveAmplMin:    30; WaveAmplDelta: 15;
         WaveFreqMin: 0.010; WaveFreqDelta: 0.015;