- More binds
authorunc0rr
Sat, 07 Jan 2006 15:23:45 +0000
changeset 40 416d54ce0c34
parent 39 b78e7185ed13
child 41 5d7a505875cd
- More binds - Caching buffer fixes
QTfrontend/binds.h
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/hwform.ui
--- a/QTfrontend/binds.h	Sat Jan 07 15:21:44 2006 +0000
+++ b/QTfrontend/binds.h	Sat Jan 07 15:23:45 2006 +0000
@@ -36,7 +36,7 @@
 
 #include <QtGlobal>
 
-#define BINDS_NUMBER 18
+#define BINDS_NUMBER 24
 
 struct BindAction
 {
@@ -55,6 +55,7 @@
 	{"ljump",	"return",	QT_TR_NOOP("jump"),	false},
 	{"hjump",	"backspace",	QT_TR_NOOP("jump"),	false},
 	{"+attack",	"space",	QT_TR_NOOP("attack"),	false},
+	{"put",	"mousel",	QT_TR_NOOP("put"),	false},
 	{"switch",	"tab",	QT_TR_NOOP("switch"),	true},
 	{"slot 1",	"f1",	QT_TR_NOOP("slot 1"),	false},
 	{"slot 2",	"f2",	QT_TR_NOOP("slot 2"),	false},
@@ -64,6 +65,11 @@
 	{"slot 6",	"f6",	QT_TR_NOOP("slot 6"),	false},
 	{"slot 7",	"f7",	QT_TR_NOOP("slot 7"),	false},
 	{"slot 8",	"f8",	QT_TR_NOOP("slot 8"),	true},
+	{"timer 1",	"1",	QT_TR_NOOP("timer 1 sec"),	false},
+	{"timer 2",	"2",	QT_TR_NOOP("timer 2 sec"),	false},
+	{"timer 3",	"3",	QT_TR_NOOP("timer 3 sec"),	false},
+	{"timer 4",	"4",	QT_TR_NOOP("timer 4 sec"),	false},
+	{"timer 5",	"5",	QT_TR_NOOP("timer 5 sec"),	true},
 	{"capture",	"f11",	QT_TR_NOOP("capture"),	false},
 	{"quit",	"f10",	QT_TR_NOOP("quit"),	false}
 };
--- a/QTfrontend/game.cpp	Sat Jan 07 15:21:44 2006 +0000
+++ b/QTfrontend/game.cpp	Sat Jan 07 15:23:45 2006 +0000
@@ -45,15 +45,14 @@
 {
 	vid_Resolution = Resolution;
 	vid_Fullscreen = Fullscreen;
-	IPCServer = new QTcpServer(this);
-	IPCServer->setMaxPendingConnections(1);
-	if (!IPCServer->listen(QHostAddress("127.0.0.1"), IPC_PORT))
+	IPCServer.setMaxPendingConnections(1);
+	if (!IPCServer.listen(QHostAddress::LocalHost, IPC_PORT))
 	{
 		QMessageBox::critical(0, tr("Error"),
 				tr("Unable to start the server: %1.")
-				.arg(IPCServer->errorString()));
+				.arg(IPCServer.errorString()));
 	}
-	connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
+	connect(&IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
 	IPCSocket = 0;
 	TeamCount = 0;
 	seed = "";
@@ -63,7 +62,7 @@
 
 void HWGame::NewConnection()
 {
-	QTcpSocket * client = IPCServer->nextPendingConnection();
+	QTcpSocket * client = IPCServer.nextPendingConnection();
 	if(!IPCSocket)
 	{
 		IPCSocket = client;
@@ -97,7 +96,6 @@
 //	SENDIPC("e$gmflags 0");
 	SENDIPC("eaddteam");
 	SendTeamConfig(0);
-//	if () SENDIPC("rdriven");
 	SENDIPC("ecolor 65535");
 	SENDIPC("eadd hh0 0");
 	SENDIPC("eadd hh1 0");
@@ -169,14 +167,8 @@
 void HWGame::SendIPC(const QByteArray & buf)
 {
 	if (buf.size() > MAXMSGCHARS) return;
-	if (!IPCSocket)
-	{
-		toSendBuf += buf;
-	} else
-	{
-		quint8 len = buf.size();
-		RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf);
-	}
+	quint8 len = buf.size();
+	RawSendIPC(QByteArray::fromRawData((char *)&len, 1) + buf);
 }
 
 void HWGame::RawSendIPC(const QByteArray & buf)
@@ -190,6 +182,7 @@
 		{
 			IPCSocket->write(toSendBuf);
 			demo->append(toSendBuf);
+			toSendBuf.clear();
 		}
 		IPCSocket->write(buf);
 		demo->append(buf);
--- a/QTfrontend/game.h	Sat Jan 07 15:21:44 2006 +0000
+++ b/QTfrontend/game.h	Sat Jan 07 15:23:45 2006 +0000
@@ -70,7 +70,7 @@
         gtDemo  = 2,
         gtNet   = 3
     };
-    QTcpServer * IPCServer;
+    QTcpServer IPCServer;
 	QTcpSocket * IPCSocket;
 	char msgbuf[MAXMSGCHARS];
 	quint8 msgbufsize;
--- a/QTfrontend/hwform.ui	Sat Jan 07 15:21:44 2006 +0000
+++ b/QTfrontend/hwform.ui	Sat Jan 07 15:23:45 2006 +0000
@@ -50,9 +50,9 @@
      </size>
     </property>
     <property name="currentIndex" >
-     <number>7</number>
+     <number>8</number>
     </property>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pageLG" >
      <widget class="QPushButton" name="BtnSimpleGame" >
       <property name="geometry" >
        <rect>
@@ -114,7 +114,7 @@
       </property>
      </widget>
     </widget>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pageET" >
      <widget class="QGroupBox" name="GBoxHedgehogs" >
       <property name="geometry" >
        <rect>
@@ -374,31 +374,36 @@
        <property name="currentIndex" >
         <number>0</number>
        </property>
-       <widget class="QWidget" name="page" >
+       <widget class="QWidget" name="page_A" >
         <property name="geometry" >
          <rect>
           <x>0</x>
           <y>0</y>
-          <width>181</width>
-          <height>270</height>
+          <width>163</width>
+          <height>221</height>
          </rect>
         </property>
         <attribute name="label" >
          <string>Actions</string>
         </attribute>
        </widget>
-       <widget class="QWidget" name="page" >
+       <widget class="QWidget" name="page_W" >
         <attribute name="label" >
          <string>Weapons</string>
         </attribute>
        </widget>
-       <widget class="QWidget" name="page" >
+       <widget class="QWidget" name="page_WP" >
+        <attribute name="label" >
+         <string>Weapon properties</string>
+        </attribute>
+       </widget>
+       <widget class="QWidget" name="page_O" >
         <property name="geometry" >
          <rect>
           <x>0</x>
           <y>0</y>
-          <width>99</width>
-          <height>29</height>
+          <width>163</width>
+          <height>221</height>
          </rect>
         </property>
         <attribute name="label" >
@@ -408,7 +413,7 @@
       </widget>
      </widget>
     </widget>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pageOpt" >
      <widget class="QGroupBox" name="groupBox" >
       <property name="geometry" >
        <rect>
@@ -671,7 +676,7 @@
       </property>
      </widget>
     </widget>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pagePDemo" >
      <widget class="QPushButton" name="BtnPlayDemo" >
       <property name="geometry" >
        <rect>
@@ -743,7 +748,7 @@
       </property>
      </widget>
     </widget>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pageNet" >
      <widget class="QPushButton" name="BtnNetConnect" >
       <property name="geometry" >
        <rect>
@@ -805,7 +810,7 @@
       </property>
      </widget>
     </widget>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pageNetChat" >
      <widget class="QPushButton" name="BtnNetChatDisconnect" >
       <property name="geometry" >
        <rect>
@@ -907,7 +912,7 @@
       </property>
      </widget>
     </widget>
-    <widget class="QWidget" name="page" >
+    <widget class="QWidget" name="pageNetGame" >
      <widget class="QPushButton" name="BtnNetCFGBack" >
       <property name="geometry" >
        <rect>