Ability to choose which info is shown above hedgehogs
authorunc0rr
Thu, 07 Jun 2007 18:09:54 +0000
changeset 539 6a9bf1852bbc
parent 538 74219eadab5e
child 540 b06c5aace2fa
Ability to choose which info is shown above hedgehogs
QTfrontend/CMakeLists.txt
QTfrontend/binds.cpp
QTfrontend/binds.h
QTfrontend/hedgewars.pro
hedgewars/CCHandlers.inc
hedgewars/uConsole.pas
hedgewars/uGears.pas
hedgewars/uKeys.pas
hedgewars/uMisc.pas
--- a/QTfrontend/CMakeLists.txt	Wed Jun 06 21:27:12 2007 +0000
+++ b/QTfrontend/CMakeLists.txt	Thu Jun 07 18:09:54 2007 +0000
@@ -55,7 +55,8 @@
 	newnetclient.cpp
 	netudpserver.cpp
 	netudpwidget.cpp
-	chatwidget.cpp)
+	chatwidget.cpp
+	binds.cpp)
 
 if (WIN32)
 	set(hwfr_src ${hwfr_src} res/hedgewars.rc)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/binds.cpp	Thu Jun 07 18:09:54 2007 +0000
@@ -0,0 +1,55 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2005, 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "binds.h"
+
+const BindAction cbinds[BINDS_NUMBER] =
+{
+	{"+up",	"up",	QT_TRANSLATE_NOOP("binds", "up"),	false},
+	{"+left",	"left",	QT_TRANSLATE_NOOP("binds", "left"),	false},
+	{"+right",	"right",	QT_TRANSLATE_NOOP("binds", "right"),	false},
+	{"+down",	"down",	QT_TRANSLATE_NOOP("binds", "down"),	false},
+	{"ljump",	"return",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
+	{"hjump",	"backspace",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
+	{"+attack",	"space",	QT_TRANSLATE_NOOP("binds", "attack"),	false},
+	{"put",	"mousel",	QT_TRANSLATE_NOOP("binds", "put"),	false},
+	{"switch",	"tab",	QT_TRANSLATE_NOOP("binds", "switch"),	false},
+	{"findhh",	"h",	QT_TRANSLATE_NOOP("binds", "find hedgehog"),	true},
+	{"ammomenu",	"mouser",	QT_TRANSLATE_NOOP("binds", "ammo menu"),	false},
+	{"slot 1",	"f1",	QT_TRANSLATE_NOOP("binds", "slot 1"),	false},
+	{"slot 2",	"f2",	QT_TRANSLATE_NOOP("binds", "slot 2"),	false},
+	{"slot 3",	"f3",	QT_TRANSLATE_NOOP("binds", "slot 3"),	false},
+	{"slot 4",	"f4",	QT_TRANSLATE_NOOP("binds", "slot 4"),	false},
+	{"slot 5",	"f5",	QT_TRANSLATE_NOOP("binds", "slot 5"),	false},
+	{"slot 6",	"f6",	QT_TRANSLATE_NOOP("binds", "slot 6"),	false},
+	{"slot 7",	"f7",	QT_TRANSLATE_NOOP("binds", "slot 7"),	false},
+	{"slot 8",	"f8",	QT_TRANSLATE_NOOP("binds", "slot 8"),	false},
+	{"slot 9",	"f9",	QT_TRANSLATE_NOOP("binds", "slot 9"),	true},
+	{"timer 1",	"1",	QT_TRANSLATE_NOOP("binds", "timer 1 sec"),	false},
+	{"timer 2",	"2",	QT_TRANSLATE_NOOP("binds", "timer 2 sec"),	false},
+	{"timer 3",	"3",	QT_TRANSLATE_NOOP("binds", "timer 3 sec"),	false},
+	{"timer 4",	"4",	QT_TRANSLATE_NOOP("binds", "timer 4 sec"),	false},
+	{"timer 5",	"5",	QT_TRANSLATE_NOOP("binds", "timer 5 sec"),	true},
+	{"pause",	"p",	QT_TRANSLATE_NOOP("binds", "pause"),	false},
+	{"+voldown",	"9",	QT_TRANSLATE_NOOP("binds", "volume down"),	false},
+	{"+volup",	"0",	QT_TRANSLATE_NOOP("binds", "volume up"),	false},
+	{"fullscr",	"f",	QT_TRANSLATE_NOOP("binds", "change mode"),	false},
+	{"capture",	"c",	QT_TRANSLATE_NOOP("binds", "capture"),	false},
+	{"rotmask",	"delete",	QT_TRANSLATE_NOOP("binds", "hedgehogs\ninfo"),	false},
+	{"quit",	"escape",	QT_TRANSLATE_NOOP("binds", "quit"),	true}
+};
--- a/QTfrontend/binds.h	Wed Jun 06 21:27:12 2007 +0000
+++ b/QTfrontend/binds.h	Thu Jun 07 18:09:54 2007 +0000
@@ -21,7 +21,7 @@
 
 #include <QString>
 
-#define BINDS_NUMBER 31
+#define BINDS_NUMBER 32
 
 struct BindAction
 {
@@ -31,39 +31,6 @@
 	bool chwidget;
 };
 
-const BindAction cbinds[BINDS_NUMBER] =
-{
-	{"+up",	"up",	QT_TRANSLATE_NOOP("binds", "up"),	false},
-	{"+left",	"left",	QT_TRANSLATE_NOOP("binds", "left"),	false},
-	{"+right",	"right",	QT_TRANSLATE_NOOP("binds", "right"),	false},
-	{"+down",	"down",	QT_TRANSLATE_NOOP("binds", "down"),	false},
-	{"ljump",	"return",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
-	{"hjump",	"backspace",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
-	{"+attack",	"space",	QT_TRANSLATE_NOOP("binds", "attack"),	false},
-	{"put",	"mousel",	QT_TRANSLATE_NOOP("binds", "put"),	false},
-	{"switch",	"tab",	QT_TRANSLATE_NOOP("binds", "switch"),	false},
-	{"findhh",	"h",	QT_TRANSLATE_NOOP("binds", "find hedgehog"),	true},
-	{"ammomenu",	"mouser",	QT_TRANSLATE_NOOP("binds", "ammo menu"),	false},
-	{"slot 1",	"f1",	QT_TRANSLATE_NOOP("binds", "slot 1"),	false},
-	{"slot 2",	"f2",	QT_TRANSLATE_NOOP("binds", "slot 2"),	false},
-	{"slot 3",	"f3",	QT_TRANSLATE_NOOP("binds", "slot 3"),	false},
-	{"slot 4",	"f4",	QT_TRANSLATE_NOOP("binds", "slot 4"),	false},
-	{"slot 5",	"f5",	QT_TRANSLATE_NOOP("binds", "slot 5"),	false},
-	{"slot 6",	"f6",	QT_TRANSLATE_NOOP("binds", "slot 6"),	false},
-	{"slot 7",	"f7",	QT_TRANSLATE_NOOP("binds", "slot 7"),	false},
-	{"slot 8",	"f8",	QT_TRANSLATE_NOOP("binds", "slot 8"),	false},
-	{"slot 9",	"f9",	QT_TRANSLATE_NOOP("binds", "slot 9"),	true},
-	{"timer 1",	"1",	QT_TRANSLATE_NOOP("binds", "timer 1 sec"),	false},
-	{"timer 2",	"2",	QT_TRANSLATE_NOOP("binds", "timer 2 sec"),	false},
-	{"timer 3",	"3",	QT_TRANSLATE_NOOP("binds", "timer 3 sec"),	false},
-	{"timer 4",	"4",	QT_TRANSLATE_NOOP("binds", "timer 4 sec"),	false},
-	{"timer 5",	"5",	QT_TRANSLATE_NOOP("binds", "timer 5 sec"),	true},
-	{"pause",	"p",	QT_TRANSLATE_NOOP("binds", "pause"),	false},
-	{"+voldown",	"9",	QT_TRANSLATE_NOOP("binds", "volume down"),	false},
-	{"+volup",	"0",	QT_TRANSLATE_NOOP("binds", "volume up"),	false},
-	{"fullscr",	"f",	QT_TRANSLATE_NOOP("binds", "change mode"),	false},
-	{"capture",	"c",	QT_TRANSLATE_NOOP("binds", "capture"),	false},
-	{"quit",	"escape",	QT_TRANSLATE_NOOP("binds", "quit"),	true}
-};
+extern const BindAction cbinds[BINDS_NUMBER];
 
 #endif // BINDS_H
--- a/QTfrontend/hedgewars.pro	Wed Jun 06 21:27:12 2007 +0000
+++ b/QTfrontend/hedgewars.pro	Thu Jun 07 18:09:54 2007 +0000
@@ -41,7 +41,8 @@
            chatwidget.h
            
            
-SOURCES += game.cpp \
+SOURCES += binds.cpp
+           game.cpp \
            main.cpp \
            hwform.cpp \
            team.cpp \
--- a/hedgewars/CCHandlers.inc	Wed Jun 06 21:27:12 2007 +0000
+++ b/hedgewars/CCHandlers.inc	Thu Jun 07 18:09:54 2007 +0000
@@ -450,3 +450,10 @@
 isPaused:= not isPaused;
 SDL_ShowCursor(ord(isPaused))
 end;
+
+procedure chRotateMask(var s: shortstring);
+const map: array[0..7] of byte = (7,4,0,5,2,1,0,3);
+begin
+cTagsMask:= map[cTagsMask]
+end;
+
--- a/hedgewars/uConsole.pas	Wed Jun 06 21:27:12 2007 +0000
+++ b/hedgewars/uConsole.pas	Thu Jun 07 18:09:54 2007 +0000
@@ -278,6 +278,7 @@
 RegisterVariable('quit'    , vtCommand, @chQuit         , true );
 RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
 RegisterVariable('capture' , vtCommand, @chCapture      , true );
+RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
 RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
 RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
 RegisterVariable('map'     , vtCommand, @chSetMap       , false);
--- a/hedgewars/uGears.pas	Wed Jun 06 21:27:12 2007 +0000
+++ b/hedgewars/uGears.pas	Thu Jun 07 18:09:54 2007 +0000
@@ -450,12 +450,21 @@
      if (Gear^.State{ and not gstAnimation}) = 0 then
         begin
         t:= hwRound(Gear^.Y) - cHHRadius - 10 + WorldDy;
-        dec(t, HealthTag^.h + 2);
-        DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTag, Surface);
-        dec(t, NameTag^.h + 2);
-        DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTag, Surface);
-        dec(t, Team^.NameTag^.h + 2);
-        DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTag, Surface)
+        if (cTagsMask and 1) <> 0 then
+           begin
+           dec(t, HealthTag^.h + 2);
+           DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTag, Surface)
+           end;
+        if (cTagsMask and 2) <> 0 then
+           begin
+           dec(t, NameTag^.h + 2);
+           DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTag, Surface)
+           end;
+        if (cTagsMask and 4) <> 0 then
+           begin
+           dec(t, Team^.NameTag^.h + 2);
+           DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTag, Surface)
+           end
         end else // Current hedgehog
       if (Gear^.State and gstHHDriven) <> 0 then
         begin
--- a/hedgewars/uKeys.pas	Wed Jun 06 21:27:12 2007 +0000
+++ b/hedgewars/uKeys.pas	Thu Jun 07 18:09:54 2007 +0000
@@ -120,6 +120,7 @@
 DefaultBinds[102]:= 'fullscr';
 DefaultBinds[104]:= 'findhh';
 DefaultBinds[112]:= 'pause';
+DefaultBinds[127]:= 'rotmask';
 SetDefaultBinds
 end;
 
--- a/hedgewars/uMisc.pas	Wed Jun 06 21:27:12 2007 +0000
+++ b/hedgewars/uMisc.pas	Thu Jun 07 18:09:54 2007 +0000
@@ -42,6 +42,7 @@
     cScreenHeight    : LongInt = 768;
     cBits            : LongInt = 16;
     cBitsStr         : string[2] = '16';
+    cTagsMask        : byte = 7;
 
     cWaterLine       : LongInt = 1024;
     cVisibleWater    : LongInt = 128;