- Fix mouse cursor bugs in net game (still has a bug near water)
- Default binds for zoom
--- a/hedgewars/CCHandlers.inc Tue Oct 06 16:30:08 2009 +0000
+++ b/hedgewars/CCHandlers.inc Wed Oct 07 14:37:42 2009 +0000
@@ -455,39 +455,36 @@
begin
if CheckNoTeamOrHH then exit;
if bShowAmmoMenu then
- begin
- bSelected:= true;
- exit
- end;
+ begin
+ bSelected:= true;
+ exit
+ end;
with CurrentHedgehog^.Gear^,
- CurrentHedgehog^ do
- if (State and gstHHChooseTarget) <> 0 then
- begin
- isCursorVisible:= false;
- if not CurrentTeam^.ExtDriven then
- begin
- if fromAI then
- begin
- TargetPoint.X:= putX;
- TargetPoint.Y:= putY
- end else
- begin
-{$IFDEF SDL13}
- SDL_GetMouseState(0, @TargetPoint.X, @TargetPoint.Y);
-{$ELSE}
- SDL_GetMouseState(@TargetPoint.X, @TargetPoint.Y);
-{$ENDIF}
- dec(TargetPoint.X, cScreenWidth div 2);
- dec(TargetPoint.X, WorldDx);
- dec(TargetPoint.Y, WorldDy)
- end;
- SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
- end;
- State:= State and not gstHHChooseTarget;
- if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
- Message:= Message or gm_Attack;
- end else if CurrentTeam^.ExtDriven then OutError('got /put while not being in choose target mode', false)
+ CurrentHedgehog^ do
+ if (State and gstHHChooseTarget) <> 0 then
+ begin
+ isCursorVisible:= false;
+ if not CurrentTeam^.ExtDriven then
+ begin
+ if fromAI then
+ begin
+ TargetPoint.X:= putX;
+ TargetPoint.Y:= putY
+ end else
+ begin
+ TargetPoint.X:= CursorPoint.X - WorldDx;
+ TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy;
+ end;
+ SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
+ end;
+ State:= State and not gstHHChooseTarget;
+ if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
+ Message:= Message or gm_Attack;
+ end
+ else
+ if CurrentTeam^.ExtDriven then
+ OutError('got /put while not being in choose target mode', false)
end;
procedure chPut(var s: shortstring);
--- a/hedgewars/uGears.pas Tue Oct 06 16:30:08 2009 +0000
+++ b/hedgewars/uGears.pas Wed Oct 07 14:37:42 2009 +0000
@@ -1296,7 +1296,7 @@
procedure DrawRope(Gear: PGear);
var roplen: LongInt;
- i: LongInt;
+ i: Longword;
procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt);
var eX, eY, dX, dY: LongInt;
--- a/hedgewars/uIO.pas Tue Oct 06 16:30:08 2009 +0000
+++ b/hedgewars/uIO.pas Wed Oct 07 14:37:42 2009 +0000
@@ -305,13 +305,16 @@
{$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(headcmd^.Time)){$ENDIF}
end;
'p': begin
- TargetPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X)));
- TargetPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y)));
+ TargetPoint.X:= SDLNet_Read16(@(headcmd^.X));
+ TargetPoint.Y:= SDLNet_Read16(@(headcmd^.Y));
ParseCommand('put', true)
end;
'P': begin
- CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X)) + WorldDx);
- CursorPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y)) + WorldDy);
+ // these are equations solved for CursorPoint
+ // SDLNet_Read16(@(headcmd^.X)):= CursorPoint.X - WorldDx;
+ // SDLNet_Read16(@(headcmd^.Y)):= cScreenHeight - CursorPoint.Y - WorldDy;
+ CursorPoint.X:= SDLNet_Read16(@(headcmd^.X)) + WorldDx;
+ CursorPoint.Y:= cScreenHeight - SDLNet_Read16(@(headcmd^.Y)) - WorldDy;
end;
'w': ParseCommand('setweap ' + headcmd^.str[2], true);
't': ParseCommand('taunt ' + headcmd^.str[2], true);
--- a/hedgewars/uKeys.pas Tue Oct 06 16:30:08 2009 +0000
+++ b/hedgewars/uKeys.pas Wed Oct 07 14:37:42 2009 +0000
@@ -157,6 +157,10 @@
DefaultBinds[KeyNameToCode('t')]:= 'chat';
DefaultBinds[KeyNameToCode('y')]:= 'confirm';
+DefaultBinds[KeyNameToCode('mousem')]:= 'zoomreset';
+DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomout';
+DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomin';
+
DefaultBinds[KeyNameToCode('f12')]:= 'fullscr';
SetDefaultBinds
--- a/hedgewars/uWorld.pas Tue Oct 06 16:30:08 2009 +0000
+++ b/hedgewars/uWorld.pas Wed Oct 07 14:37:42 2009 +0000
@@ -566,7 +566,6 @@
end
else begin
CursorPoint.x:= (prevPoint.x * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8;
- //addcaption(inttostr(CursorPoint.X), $AFAFAF, capgrpGameState);
CursorPoint.y:= (prevPoint.y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8;
end;
@@ -590,7 +589,7 @@
begin
if (not CurrentTeam^.ExtDriven) and (GameTicks >= PrevSentPointTime + cSendCursorPosTime) then
begin
- SendIPCXY('P', CursorPoint.X - WorldDx, CursorPoint.Y - WorldDy);
+ SendIPCXY('P', CursorPoint.X - WorldDx, cScreenHeight - CursorPoint.Y - WorldDy);
PrevSentPointTime:= GameTicks
end;
end;