--- a/ChangeLog.txt Fri Jul 20 19:25:21 2018 +0200
+++ b/ChangeLog.txt Sat Jul 21 00:34:32 2018 +0200
@@ -3,6 +3,8 @@
====================== 0.9.25 ======================
Game:
+ Add new key to show mission panel (default: M)
+ + Add new key to cycle through timer values (default: N)
+ + Add default controls for controller (see README.md)
+ Add chat command “/help”, displays help for chat commands
+ Increase hedgehog limit to 64
* Functionality of controllers restored
--- a/QTfrontend/binds.cpp Fri Jul 20 19:25:21 2018 +0200
+++ b/QTfrontend/binds.cpp Sat Jul 21 00:34:32 2018 +0200
@@ -44,6 +44,7 @@
{"timer 3", "3", QT_TRANSLATE_NOOP("binds", "timer 3 sec"), NULL, NULL},
{"timer 4", "4", QT_TRANSLATE_NOOP("binds", "timer 4 sec"), NULL, NULL},
{"timer 5", "5", QT_TRANSLATE_NOOP("binds", "timer 5 sec"), NULL, NULL},
+ {"timer_u", "n", QT_TRANSLATE_NOOP("binds", "change timer"), NULL, NULL},
{"+attack", "space", QT_TRANSLATE_NOOP("binds", "attack"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Fire your selected weapon or trigger an utility item:")},
{"put", "mousel", QT_TRANSLATE_NOOP("binds", "put"), NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Pick a weapon or a target location under the cursor:")},
{"findhh", "h", QT_TRANSLATE_NOOP("binds", "autocam / find hedgehog"),QT_TRANSLATE_NOOP("binds (categories)", "Camera"), QT_TRANSLATE_NOOP("binds (descriptions)", "Toggle automatic camera / refocus on active hedgehog:")},
--- a/QTfrontend/binds.h Fri Jul 20 19:25:21 2018 +0200
+++ b/QTfrontend/binds.h Sat Jul 21 00:34:32 2018 +0200
@@ -22,9 +22,9 @@
#include <QString>
#ifdef VIDEOREC
-#define BINDS_NUMBER 50
+#define BINDS_NUMBER 51
#else
-#define BINDS_NUMBER 49
+#define BINDS_NUMBER 50
#endif
struct BindAction
--- a/README.md Fri Jul 20 19:25:21 2018 +0200
+++ b/README.md Sat Jul 21 00:34:32 2018 +0200
@@ -77,15 +77,16 @@
* 1st D-pad: Walk and aim
* 2nd D-pad / 1st thumbstick: Move camera/cursor
-* Button 1: Long jump
-* Button 2: High jump
-* Button 3: Attack
-* Button 4: Ammo menu
-* Button 5: Precise
-* Button 6: Select target, or pick weapon (in ammo menu)
-* Button 7: Switch hedgehog
-* Button 8: Find hedgehog / toggle auto camera
-* Button 9: Mission panel
+* Button 1: Long jump
+* Button 2: High jump
+* Button 3: Attack
+* Button 4: Ammo menu
+* Button 5: Precise
+* Button 6: Select target, or pick weapon (in ammo menu)
+* Button 7: Switch hedgehog
+* Button 8: Change timer
+* Button 9: Find hedgehog / toggle auto camera
+* Button 10: Mission panel
For the full list, go to the Hedgewars settings. Also read the weapon tooltips
for weapon-specific controls.
@@ -96,7 +97,7 @@
configured controls:
* Precise + Toggle hedgehog tags: Change visible hedgehog tags (team name/hog name/health)
-* Switch + Toggle hedgehog tags: Toggle hedgehog tag translucency
+* Switch + Toggle hedgehog tags: Toggle hedgehog tag translucency
* Precise + Toggle team bars + Switch: Toggle HUD
* Precise + Capture (screenshot key): Save current map + mask into Screenshot directory
--- a/hedgewars/uCommandHandlers.pas Fri Jul 20 19:25:21 2018 +0200
+++ b/hedgewars/uCommandHandlers.pas Sat Jul 21 00:34:32 2018 +0200
@@ -419,6 +419,32 @@
end
end;
+// Increment timer or bounciness
+procedure chTimerU(var s: shortstring);
+var t: LongWord;
+ tb: Byte;
+begin
+s:= s; // avoid compiler hint
+if CheckNoTeamOrHH then
+ exit;
+// We grab the current timer first so we can increment it
+if (CurrentHedgehog^.Gear^.Message and gmPrecise) = 0 then
+ t:= HHGetTimerMsg(CurrentHedgehog^.Gear)
+else
+ // Use bounciness if Precise is pressed
+ t:= HHGetBouncinessMsg(CurrentHedgehog^.Gear);
+if t <> MSGPARAM_INVALID then
+ begin
+ // Calculate new timer
+ Inc(t);
+ if t > 5 then
+ t:= 1;
+ tb:= t mod 255;
+ // Delegate the actual change to /timer
+ ParseCommand('timer ' + Chr(tb + Ord('0')), true);
+ end;
+end;
+
procedure chSlot(var s: shortstring);
var slot: LongWord;
ss: shortstring;
@@ -938,6 +964,7 @@
RegisterVariable('advmapgen',@chAdvancedMapGenMode, false);
RegisterVariable('+mission', @chShowMission_p, true);
RegisterVariable('-mission', @chShowMission_m, true);
+ RegisterVariable('timer_u' , @chTimerU , true );
end;
procedure freeModule;
--- a/hedgewars/uConsts.pas Fri Jul 20 19:25:21 2018 +0200
+++ b/hedgewars/uConsts.pas Sat Jul 21 00:34:32 2018 +0200
@@ -318,6 +318,10 @@
AMMO_INFINITE = 100;
AMMO_FINITE_MAX = 99;
+ // Special msgParam value used internally for invalid/non-existing value
+ // Must not be sent over the network!
+ MSGPARAM_INVALID = High(LongWord);
+
probabilityLevels: array [0..8] of LongWord = (0,20,30,60,100,200,400,600,800);
defaultBounciness = 1000;
--- a/hedgewars/uGearsHedgehog.pas Fri Jul 20 19:25:21 2018 +0200
+++ b/hedgewars/uGearsHedgehog.pas Sat Jul 21 00:34:32 2018 +0200
@@ -31,6 +31,10 @@
procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord);
procedure CheckIce(Gear: PGear); inline;
procedure PlayTaunt(taunt: Longword);
+function HHGetTimer(Gear: PGear): LongWord;
+function HHGetTimerMsg(Gear: PGear): LongWord;
+function HHGetBounciness(Gear: PGear): LongWord;
+function HHGetBouncinessMsg(Gear: PGear): LongWord;
implementation
uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions,
@@ -213,6 +217,57 @@
end;
end;
+// Return timer (in ticks) of hogs current ammo or MSGPARAM_INVALID
+// if not timerable
+function HHGetTimer(Gear: PGear): LongWord;
+var CurWeapon: PAmmo;
+begin
+CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
+with Gear^.Hedgehog^ do
+ if ((CurWeapon^.Propz and ammoprop_Timerable) <> 0) then
+ HHGetTimer:= CurWeapon^.Timer
+ else
+ HHGetTimer:= MSGPARAM_INVALID;
+end;
+
+// Returns timer as a corresponding msgParam for /timer command
+function HHGetTimerMsg(Gear: PGear): LongWord;
+var timer: LongInt;
+begin
+timer:= HHGetTimer(Gear);
+if timer > -1 then
+ HHGetTimerMsg:= timer div 1000
+else
+ HHGetTimerMsg:= MSGPARAM_INVALID
+end;
+
+// Returns the selected bounciness value for the hog gear's current ammo
+// or MSGPARAM_INVALID if current ammo has no settable bounciness
+function HHGetBounciness(Gear: PGear): LongWord;
+var CurWeapon: PAmmo;
+begin
+CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
+with Gear^.Hedgehog^ do
+ if ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then
+ HHGetBounciness:= CurWeapon^.Bounciness
+ else
+ HHGetBounciness:= MSGPARAM_INVALID
+end;
+
+// Returns bounciness as a corresponding msgParam for /timer command
+function HHGetBouncinessMsg(Gear: PGear): LongWord;
+var bounciness, i: LongInt;
+begin
+ bounciness:= HHGetBounciness(Gear);
+ if bounciness > -1 then
+ for i:=0 to High(bouncinessLevels) do
+ if bounciness = bouncinessLevels[i] then
+ begin
+ HHGetBouncinessMsg:= i+1;
+ exit
+ end;
+ HHGetBouncinessMsg:= MSGPARAM_INVALID
+end;
procedure Attack(Gear: PGear);
var xx, yy, newDx, newDy, lx, ly: hwFloat;
--- a/hedgewars/uInputHandler.pas Fri Jul 20 19:25:21 2018 +0200
+++ b/hedgewars/uInputHandler.pas Sat Jul 21 00:34:32 2018 +0200
@@ -380,6 +380,9 @@
RegisterBind(DefaultBinds, 'f12', 'fullscr');
+ for i:= 1 to 10 do RegisterBind(DefaultBinds, 'f'+IntToStr(i), 'slot '+char(48+i));
+ for i:= 1 to 5 do RegisterBind(DefaultBinds, IntToStr(i), 'timer '+IntToStr(i));
+ RegisterBind(DefaultBinds, 'n', 'timer_u');
RegisterBind(DefaultBinds, 'mousel', '/put');
RegisterBind(DefaultBinds, 'mouser', 'ammomenu');
@@ -410,7 +413,7 @@
RegisterBind(DefaultBinds, 'j0b4', '+precise');
RegisterBind(DefaultBinds, 'j0b5', 'put');
RegisterBind(DefaultBinds, 'j0b6', 'switch');
- // TODO: Add controller-friendly way to change timer
+ RegisterBind(DefaultBinds, 'j0b7', 'timer_u');
// Cursor movement (also essential)
RegisterBind(DefaultBinds, 'j0h1r', '+cur_r');
@@ -424,11 +427,8 @@
RegisterBind(DefaultBinds, 'j0a1d', '+cur_u');
// Additional controls
- RegisterBind(DefaultBinds, 'j0b7', 'findhh');
- RegisterBind(DefaultBinds, 'j0b8', '+mission');
-
- for i:= 1 to 10 do RegisterBind(DefaultBinds, 'f'+IntToStr(i), 'slot '+char(48+i));
- for i:= 1 to 5 do RegisterBind(DefaultBinds, IntToStr(i), 'timer '+IntToStr(i));
+ RegisterBind(DefaultBinds, 'j0b8', 'findhh');
+ RegisterBind(DefaultBinds, 'j0b9', '+mission');
loadBinds('dbind', cPathz[ptConfig] + '/settings.ini');
end;