'h' marks out current hedgehog
authorunc0rr
Thu, 28 Sep 2006 16:34:42 +0000
changeset 176 533d03041dcd
parent 175 d226d976d836
child 177 c67c15e6fae3
'h' marks out current hedgehog
QTfrontend/binds.h
hedgewars/CCHandlers.inc
hedgewars/uConsole.pas
hedgewars/uConsts.pas
hedgewars/uKeys.pas
hedgewars/uTeams.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Graphics/Finger.png
--- a/QTfrontend/binds.h	Wed Sep 27 20:52:22 2006 +0000
+++ b/QTfrontend/binds.h	Thu Sep 28 16:34:42 2006 +0000
@@ -37,7 +37,7 @@
 #include <QString>
 #include <QtGlobal>
 
-#define BINDS_NUMBER 28
+#define BINDS_NUMBER 29
 
 struct BindAction
 {
@@ -57,7 +57,8 @@
 	{"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"),	true},
+	{"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},
--- a/hedgewars/CCHandlers.inc	Wed Sep 27 20:52:22 2006 +0000
+++ b/hedgewars/CCHandlers.inc	Thu Sep 28 16:34:42 2006 +0000
@@ -140,6 +140,7 @@
 procedure chLeft_p(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 if not CurrentTeam.ExtDriven then SendIPC('L');
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
     Message:= Message or gm_Left
@@ -156,6 +157,7 @@
 procedure chRight_p(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 if not CurrentTeam.ExtDriven then SendIPC('R');
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
     Message:= Message or gm_Right
@@ -172,6 +174,7 @@
 procedure chUp_p(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 if not CurrentTeam.ExtDriven then SendIPC('U');
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
     Message:= Message or gm_Up
@@ -188,6 +191,7 @@
 procedure chDown_p(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 if not CurrentTeam.ExtDriven then SendIPC('D');
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
     Message:= Message or gm_Down
@@ -204,6 +208,7 @@
 procedure chLJump(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 if not CurrentTeam.ExtDriven then SendIPC('j');
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
     Message:= Message or gm_LJump
@@ -212,6 +217,7 @@
 procedure chHJump(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 if not CurrentTeam.ExtDriven then SendIPC('J');
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
     Message:= Message or gm_HJump
@@ -220,6 +226,7 @@
 procedure chAttack_p(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear^ do
      begin
      {$IFDEF DEBUGFILE}AddFileLog('/+attack: Gear.State = '+inttostr(State));{$ENDIF}
@@ -270,6 +277,7 @@
 procedure chTimer(var s: shortstring);
 begin
 if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or (CurrentTeam = nil) then exit;
+bShowFinger:= false;
 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
      if (Ammo[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0 then
         begin
@@ -285,6 +293,7 @@
     caSlot, caAmmo: PLongword;
 begin
 if (s[0] <> #1) or CheckNoTeamOrHH then exit;
+bShowFinger:= false;
 slot:= byte(s[1]) - 49;
 if slot > cMaxSlotIndex then exit;
 if not CurrentTeam.ExtDriven then SendIPC(char(byte(s[1]) + 79));
@@ -412,3 +421,10 @@
 dec(cVolumeDelta, 3)
 end;
 
+procedure chFindhh(var s: shortstring);
+begin
+if CheckNoTeamOrHH then exit;
+bShowFinger:= true;
+FollowGear:= CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear
+end;
+
--- a/hedgewars/uConsole.pas	Wed Sep 27 20:52:22 2006 +0000
+++ b/hedgewars/uConsole.pas	Thu Sep 28 16:34:42 2006 +0000
@@ -316,6 +316,7 @@
 RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
 RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
 RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
+RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
 
 finalization
 FreeVariablesList
--- a/hedgewars/uConsts.pas	Wed Sep 27 20:52:22 2006 +0000
+++ b/hedgewars/uConsts.pas	Thu Sep 28 16:34:42 2006 +0000
@@ -48,7 +48,7 @@
                    sprMineOn, sprCase, sprFAid, sprDynamite, sprPower,
                    sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont,
                    sprSky, sprAMBorders, sprAMSlot, sprAMSlotName, sprAMAmmos,
-                   sprAMSlotKeys, sprAMSelection);
+                   sprAMSlotKeys, sprAMSelection, sprFinger);
      TGearType  = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
                    gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite,
@@ -257,7 +257,8 @@
                      (FileName:  'AmmoName'; Path: ptAmmoMenu; Width: 202; Height: 33; hasAlpha: false),// sprAMSlotName
                      (FileName:     'Ammos'; Path: ptAmmoMenu; Width:  32; Height: 32; hasAlpha: false),// sprAMAmmos
                      (FileName:  'SlotKeys'; Path: ptAmmoMenu; Width:  32; Height: 32; hasAlpha: false),// sprAMSlotKeys
-                     (FileName: 'Selection'; Path: ptAmmoMenu; Width:  32; Height: 32; hasAlpha: false) // sprAMSelection
+                     (FileName: 'Selection'; Path: ptAmmoMenu; Width:  32; Height: 32; hasAlpha: false),// sprAMSelection
+                     (FileName:    'Finger'; Path: ptGraphics; Width:  32; Height: 48; hasAlpha: false) // sprFinger
                      );
       Soundz: array[TSound] of record
                                        FileName: String[31];
--- a/hedgewars/uKeys.pas	Wed Sep 27 20:52:22 2006 +0000
+++ b/hedgewars/uKeys.pas	Thu Sep 28 16:34:42 2006 +0000
@@ -131,6 +131,7 @@
 DefaultBinds[ 57]:= '+voldown';
 DefaultBinds[ 99]:= 'capture';
 DefaultBinds[102]:= 'fullscr';
+DefaultBinds[104]:= 'findhh';
 SetDefaultBinds
 end;
 
--- a/hedgewars/uTeams.pas	Wed Sep 27 20:52:22 2006 +0000
+++ b/hedgewars/uTeams.pas	Thu Sep 28 16:34:42 2006 +0000
@@ -164,6 +164,7 @@
 ApplyAmmoChanges(CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog]);
 if CurrentTeam.ExtDriven then SetDefaultBinds
                          else SetBinds(CurrentTeam.Binds);
+bShowFinger:= true;
 TurnTimeLeft:= cHedgehogTurnTime
 end;
 
--- a/hedgewars/uWorld.pas	Wed Sep 27 20:52:22 2006 +0000
+++ b/hedgewars/uWorld.pas	Thu Sep 28 16:34:42 2006 +0000
@@ -49,6 +49,7 @@
     WindBarWidth: integer = 0;
     bShowAmmoMenu: boolean = false;
     bSelected: boolean = false;
+    bShowFinger: boolean = false;
 
 implementation
 uses uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound;
@@ -240,6 +241,8 @@
                      DrawCentered(round(Gear.X) + WorldDx, t, Team.NameTag, Surface)
                      end else // Current hedgehog
                      begin
+                     if bShowFinger
+                        and ((Gear.State and gstHHDriven) <> 0) then DrawSprite(sprFinger, round(Gear.X) - 16 + WorldDx, round(Gear.Y) - 64 + WorldDy, RealTicks div 32 mod 16, Surface);
                      if (Gear.State and (gstMoving or gstDrowning or gstFalling)) = 0 then
                         if (Gear.State and gstHHThinking) <> 0 then
                            DrawGear(sQuestion, Round(Gear.X)  - 10 + WorldDx, Round(Gear.Y) - cHHRadius - 34 + WorldDy, Surface)
Binary file share/hedgewars/Data/Graphics/Finger.png has changed