Implement precise aiming when pressing left shift
authorunc0rr
Sat, 10 Jan 2009 22:50:54 +0000 (2009-01-10)
changeset 1639 89b536a3cf3c
parent 1638 5e2189989fe8
child 1640 31cf38df07ef
Implement precise aiming when pressing left shift
QTfrontend/binds.cpp
QTfrontend/binds.h
doc/Release.txt
doc/protocol.txt
hedgewars/CCHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uConsole.pas
hedgewars/uConsts.pas
hedgewars/uIO.pas
--- a/QTfrontend/binds.cpp	Sat Jan 10 17:58:05 2009 +0000
+++ b/QTfrontend/binds.cpp	Sat Jan 10 22:50:54 2009 +0000
@@ -27,6 +27,7 @@
 	{"ljump",	"return",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
 	{"hjump",	"backspace",	QT_TRANSLATE_NOOP("binds", "jump"),	false},
 	{"+attack",	"space",	QT_TRANSLATE_NOOP("binds", "attack"),	false},
+	{"+precise",	"left_shift",	QT_TRANSLATE_NOOP("binds", "precise aim"),	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},
--- a/QTfrontend/binds.h	Sat Jan 10 17:58:05 2009 +0000
+++ b/QTfrontend/binds.h	Sat Jan 10 22:50:54 2009 +0000
@@ -21,7 +21,7 @@
 
 #include <QString>
 
-#define BINDS_NUMBER 35
+#define BINDS_NUMBER 36
 
 struct BindAction
 {
--- a/doc/Release.txt	Sat Jan 10 17:58:05 2009 +0000
+++ b/doc/Release.txt	Sat Jan 10 22:50:54 2009 +0000
@@ -7,5 +7,5 @@
 7. Make packages
 8. Test packages
 9. Upload (hedgewars.org, fireforge.net, gna.org)
-10. Post news (hedgewars.org, fireforge.net, gna.org, etc.)
+10. Post news (hedgewars.org, hedgewars forum, fireforge.net, gna.org, happypenguin, etc.)
 11. Make tag (svn copy svn+ssh://unc0rr@svn.fireforge.net/svnroot/hedgewars/branches/0.9.7 svn+ssh://unc0rr@svn.fireforge.net/svnroot/hedgewars/tags/0.9.7 -m "Tag for 0.9.7 release")
\ No newline at end of file
--- a/doc/protocol.txt	Sat Jan 10 17:58:05 2009 +0000
+++ b/doc/protocol.txt	Sat Jan 10 22:50:54 2009 +0000
@@ -4,6 +4,7 @@
 	'r','R'                                 -right, +right
 	'u','U'                                 -up, +up
 	'd','D'                                 -down, +down
+	'z', 'Z'                                -precise, +precise
 	'N'             срабатывание команды /nextturn
 	'S'                                  /switch
 	's' + <текст>   /say
--- a/hedgewars/CCHandlers.inc	Sat Jan 10 17:58:05 2009 +0000
+++ b/hedgewars/CCHandlers.inc	Sat Jan 10 22:50:54 2009 +0000
@@ -231,6 +231,23 @@
      Message:= Message and not gm_Down
 end;
 
+procedure chPrecise_p(var s: shortstring);
+begin
+if CheckNoTeamOrHH then exit;
+bShowFinger:= false;
+if not CurrentTeam^.ExtDriven then SendIPC('Z');
+with CurrentHedgehog^.Gear^ do
+    Message:= Message or gm_Precise
+end;
+
+procedure chPrecise_m(var s: shortstring);
+begin
+if CheckNoTeamOrHH then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('z');
+with CurrentHedgehog^.Gear^ do
+     Message:= Message and not gm_Precise
+end;
+
 procedure chLJump(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
--- a/hedgewars/HHHandlers.inc	Sat Jan 10 17:58:05 2009 +0000
+++ b/hedgewars/HHHandlers.inc	Sat Jan 10 22:50:54 2009 +0000
@@ -403,9 +403,10 @@
 	if (Ammo^[CurSlot, CurAmmo].AmmoType = amRope)
 	and ((Gear^.State and (gstMoving or gstHHJumping)) = gstMoving) then da:= 2 else da:= 1;
 
-if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Angle - da >= CurMinAngle) then dec(Gear^.Angle, da)
-else
-if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Angle + da <= CurMaxAngle) then inc(Gear^.Angle, da);
+if (((Gear^.Message and gm_Precise) = 0) or ((GameTicks mod 5) = 1)) then
+	if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Angle - da >= CurMinAngle) then dec(Gear^.Angle, da)
+	else
+	if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Angle + da <= CurMaxAngle) then inc(Gear^.Angle, da);
 end;
 
 procedure doStepHedgehog(Gear: PGear); forward;
--- a/hedgewars/uConsole.pas	Sat Jan 10 17:58:05 2009 +0000
+++ b/hedgewars/uConsole.pas	Sat Jan 10 22:50:54 2009 +0000
@@ -258,6 +258,8 @@
 RegisterVariable('chat'    , vtCommand, @chChat         , true );
 RegisterVariable('say'     , vtCommand, @chSay          , true );
 RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , false);
+RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
+RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
 RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
 RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
 RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
--- a/hedgewars/uConsts.pas	Sat Jan 10 17:58:05 2009 +0000
+++ b/hedgewars/uConsts.pas	Sat Jan 10 22:50:54 2009 +0000
@@ -207,7 +207,8 @@
 	gm_Weapon = $00000400; // with param
 	gm_Timer  = $00000800; // with param
 	gm_Animate= $00001000; // with param
-	gmAllStoppable = gm_Left or gm_Right or gm_Up or gm_Down or gm_Attack;
+	gm_Precise= $00002000;
+	gmAllStoppable = gm_Left or gm_Right or gm_Up or gm_Down or gm_Attack or gm_Precise;
 
 	cMaxSlotIndex       = 8;
 	cMaxSlotAmmoIndex   = 3;
--- a/hedgewars/uIO.pas	Sat Jan 10 17:58:05 2009 +0000
+++ b/hedgewars/uIO.pas	Sat Jan 10 22:50:54 2009 +0000
@@ -231,6 +231,8 @@
 		'u': ParseCommand('-up', true);
 		'D': ParseCommand('+down', true);
 		'd': ParseCommand('-down', true);
+		'Z': ParseCommand('+precise', true);
+		'z': ParseCommand('-precise', true);
 		'A': ParseCommand('+attack', true);
 		'a': ParseCommand('-attack', true);
 		'S': ParseCommand('switch', true);