merge from default. Pulls in sheepluva's frontend work, and unbreaks engine cmake.
--- a/CMakeLists.txt Fri Sep 23 09:58:41 2011 +0200
+++ b/CMakeLists.txt Sun Sep 25 10:48:18 2011 -0400
@@ -12,7 +12,7 @@
#detect Mercurial revision (if present)
-set(version_suffix "-dev") #UNSET THIS VARIABLE AT RELEASE TIME
+set(version_suffix "") #UNSET THIS VARIABLE AT RELEASE TIME
set(HGCHANGED "")
IF(version_suffix MATCHES "-dev")
set(HW_DEV true)
@@ -41,8 +41,8 @@
#versioning
set(CPACK_PACKAGE_VERSION_MAJOR 0)
set(CPACK_PACKAGE_VERSION_MINOR 9)
-set(CPACK_PACKAGE_VERSION_PATCH 17${version_suffix})
-set(HEDGEWARS_PROTO_VER 40)
+set(CPACK_PACKAGE_VERSION_PATCH 16${version_suffix})
+set(HEDGEWARS_PROTO_VER 39)
set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
--- a/hedgewars/GSHandlers.inc Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/GSHandlers.inc Sun Sep 25 10:48:18 2011 -0400
@@ -118,7 +118,7 @@
Message := Message and not gmAttack;
end;
HH^.GearHidden:= HH^.Gear;
-HH^.Gear:= nil
+HH^.Gear:= nil;
end;
procedure RestoreHog(HH: PHedgehog);
@@ -5097,6 +5097,7 @@
var HH: PHedgehog;
i,j,cnt: LongWord;
begin
+
HH:= Gear^.Hedgehog;
if Gear^.Pos = 2 then
begin
@@ -5107,9 +5108,7 @@
begin
AfterAttack;
if Gear = CurAmmoGear then CurAmmoGear := nil;
- if (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and
- ((Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
- HideHog(HH)
+ HideHog(HH)
end
//else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then
else if (HH^.GearHidden <> nil) then// and (HH^.Gear^.State and gstInvisible <> 0) then
@@ -5127,16 +5126,16 @@
if (Gear^.Pos = 1) and (GameTicks and $1F = 0) and (Gear^.Power < 255) then
begin
inc(Gear^.Power);
- if (Gear^.Power = 172) and (HH^.Gear <> nil) and
- (HH^.Gear^.Damage = 0) and (HH^.Gear^.Health > 0) and
- ((HH^.Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
- with HH^.Gear^ do
+ if (Gear^.Power = 172) and (Gear^.Hedgehog^.Gear <> nil) then
+ begin
+ with Gear^.Hedgehog^.Gear^ do
begin
- State:= State or gstAnimation;
- Tag:= 2;
- Timer:= 0;
- Pos:= 0
+ State:= State or gstAnimation;
+ Tag:= 2;
+ Timer:= 0;
+ Pos:= 0
end
+ end
end;
if (Gear^.Pos = 3) and (GameTicks and $1F = 0) and (Gear^.Power > 0) then dec(Gear^.Power);
if (Gear^.Pos = 1) and (Gear^.Power = 255) and ((GameTicks mod 2000) = 1000) then Gear^.Pos:= 2;
@@ -5194,14 +5193,13 @@
3. Hog is a king
*)
HH:= Gear^.Hedgehog;
- if HH^.Gear <> nil then
if (HH^.Gear = nil) or (HH^.King) or (SuddenDeathDmg) then
begin
- if HH^.Gear <> nil then
- begin
- HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
- HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
- end;
+ if HH^.Gear <> nil then
+ begin
+ HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
+ HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
+ end;
PlaySound(sndDenied);
DeleteGear(gear);
exit
@@ -5215,14 +5213,14 @@
HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then inc(cnt);
if cnt < 2 then
begin
- if HH^.Gear <> nil then
- begin
- HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
- HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
- end;
- PlaySound(sndDenied);
- DeleteGear(gear);
- exit
+ if HH^.Gear <> nil then
+ begin
+ HH^.Gear^.Message := HH^.Gear^.Message and not gmAttack;
+ HH^.Gear^.State:= HH^.Gear^.State and not gstAttacking;
+ end;
+ PlaySound(sndDenied);
+ DeleteGear(gear);
+ exit
end;
Gear^.SoundChannel := LoopSound(sndTardis);
Gear^.doStep:= @doStepTardisWarp
--- a/hedgewars/HHHandlers.inc Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/HHHandlers.inc Sun Sep 25 10:48:18 2011 -0400
@@ -482,16 +482,15 @@
AllInactive:= false;
dec(Gear^.Timer);
if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
- end
-else if Gear^.Timer = 1 then
+ end else
+if Gear^.Timer = 1 then
begin
Gear^.State:= Gear^.State or gstNoDamage;
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound);
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
DeleteGear(Gear);
SetAllToActive
- end
-else // Gear^.Timer = 0
+ end else // Gear^.Timer = 0
begin
AllInactive:= false;
Gear^.Z:= cCurrHHZ;
@@ -1039,24 +1038,35 @@
PrvInactive:= false;
AllInactive:= false;
- if (Gear^.State and gstHHGone) = 0 then
+ if not Gear^.Hedgehog^.Team^.hasGone then
begin
Gear^.Hedgehog^.Effects[hePoisoned] := false;
if Gear^.Hedgehog^.Effects[heResurrectable] then begin
ResurrectHedgehog(Gear);
- end else
- begin
- Gear^.State:= (Gear^.State or gstHHDeath) and not gstAnimation;
+ end else begin
+ Gear^.State:= Gear^.State or gstHHDeath;
Gear^.doStep:= @doStepHedgehogDead;
// Death message
AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
- end;
+ end;
end
else
begin
- Gear^.State:= Gear^.State and not gstAnimation;
+ Gear^.State:= Gear^.State or gstHHGone;
Gear^.doStep:= @doStepHedgehogGone;
+ with Gear^.Hedgehog^.Team^ do
+ for i:= 0 to cMaxHHIndex do
+ if Hedgehogs[i].GearHidden <> nil then
+ begin
+ RestoreHog(@Hedgehogs[i]);
+ if Hedgehogs[i].Gear <> nil then
+ begin
+ Hedgehogs[i].Gear^.State:= Gear^.State or gstHHGone;
+ Hedgehogs[i].Gear^.doStep:= @doStepHedgehogGone
+ end
+ end;
+
// Gone message
AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
end
@@ -1067,13 +1077,13 @@
if ((Gear^.State and gstWait) = 0) and
(prevState <> Gear^.State) then
begin
- Gear^.State:= Gear^.State or gstWait;
+ Gear^.State:= gstWait;
Gear^.Timer:= 150
end else
begin
if Gear^.Timer = 0 then
begin
- Gear^.State:= Gear^.State and not (gstWait or gstLoser or gstWinner);
+ Gear^.State:= 0;
Gear^.Active:= false;
AddGearCI(Gear);
exit
@@ -1097,9 +1107,7 @@
else
begin
with Gear^.Hedgehog^ do
- if Team^.hasGone then
- TeamGoneEffect(Team^)
- else
- doStepHedgehogDriven(Gear)
+ if Team^.hasGone then TeamGoneEffect(Team^);
+ doStepHedgehogDriven(Gear)
end;
end;
--- a/hedgewars/hwengine.pas Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/hwengine.pas Sun Sep 25 10:48:18 2011 -0400
@@ -100,7 +100,6 @@
gsExit: begin
isTerminated:= true;
end;
- gsSuspend: exit;
end;
{$IFDEF SDL13}
@@ -154,17 +153,16 @@
{$WARNINGS ON}
var PrevTime, CurrTime: Longword;
prevFocusState: boolean;
- previousGameState: TGameState;
begin
PrevTime:= SDL_GetTicks;
while isTerminated = false do
begin
SDL_PumpEvents();
-{$IFDEF SDL13}
+ {$IFDEF SDL13}
while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) > 0 do
-{$ELSE}
+ {$ELSE}
while SDL_PeepEvents(@event, 1, SDL_GETEVENT, SDL_ALLEVENTS) > 0 do
-{$ENDIF}
+ {$ENDIF}
begin
case event.type_ of
SDL_KEYDOWN: if GameState = gsChat then
@@ -176,15 +174,6 @@
begin
cHasFocus:= true;
onFocusStateChanged()
- end
- else if event.window.event = SDL_WINDOWEVENT_MINIMIZED then
- begin
- previousGameState:= GameState;
- GameState:= gsSuspend;
- end
- else if event.window.event = SDL_WINDOWEVENT_RESTORED then
- begin
- GameState:= previousGameState;
end;
{$ELSE}
KeyPressChat(event.key.keysym.unicode);
--- a/hedgewars/uAmmos.pas Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/uAmmos.pas Sun Sep 25 10:48:18 2011 -0400
@@ -339,8 +339,7 @@
CurWeapon:= GetAmmoEntry(Hedgehog);
if (CurWeapon^.Count = 0) then
- SwitchToFirstLegalAmmo(Hedgehog)
- else if CurWeapon^.AmmoType = amNothing then Hedgehog.CurAmmoType:= amNothing;
+ SwitchToFirstLegalAmmo(Hedgehog);
CurWeapon:= GetAmmoEntry(Hedgehog);
--- a/hedgewars/uGears.pas Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/uGears.pas Sun Sep 25 10:48:18 2011 -0400
@@ -602,16 +602,14 @@
Gear^.IntersectGear^.IntersectGear:= nil;
end
else if Gear^.Kind = gtHedgehog then
- (*
- This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS. I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves. I believe it should be removed
- if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
+ if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
begin
AttackBar:= 0;
Gear^.Message:= gmDestroy;
CurAmmoGear^.Message:= gmDestroy;
exit
end
- else*)
+ else
begin
if (hwRound(Gear^.Y) >= cWaterLine) then
begin
--- a/hedgewars/uScript.pas Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/uScript.pas Sun Sep 25 10:48:18 2011 -0400
@@ -1207,11 +1207,6 @@
lua_pushinteger(L, hwRound(gear^.X));
lua_pushinteger(L, hwRound(gear^.Y))
end
- else
- begin
- lua_pushnil(L);
- lua_pushnil(L)
- end;
end;
lc_getgearposition:= 2;
end;
--- a/hedgewars/uTeams.pas Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/uTeams.pas Sun Sep 25 10:48:18 2011 -0400
@@ -427,17 +427,11 @@
with Team do
for i:= 0 to cMaxHHIndex do
with Hedgehogs[i] do
- begin
- if Hedgehogs[i].GearHidden <> nil then
- RestoreHog(@Hedgehogs[i]);
-
if Gear <> nil then
begin
Gear^.Invulnerable:= false;
- Gear^.Damage:= Gear^.Health;
- Gear^.State:= (Gear^.State or gstHHGone) and not gstHHDriven
+ Gear^.Damage:= Gear^.Health
end
- end
end;
procedure chAddHH(var id: shortstring);
--- a/hedgewars/uWorld.pas Fri Sep 23 09:58:41 2011 +0200
+++ b/hedgewars/uWorld.pas Sun Sep 25 10:48:18 2011 -0400
@@ -31,7 +31,7 @@
procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
procedure HideMission;
-procedure ShakeCamera(amount: LongWord);
+procedure ShakeCamera(amount: LongInt);
procedure InitCameraBorders;
procedure MoveCamera;
procedure onFocusStateChanged;
@@ -54,7 +54,8 @@
uRender,
uCaptions,
uCursor,
- uCommands
+ uCommands,
+ uMobile
;
var cWaveWidth, cWaveHeight: LongInt;
@@ -914,11 +915,11 @@
DrawCaptions;
// Teams Healths
-if TeamsCount * 20 > cScreenHeight div 7 then // take up less screen on small displays
+if TeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays
begin
SetScale(1.5);
smallScreenOffset:= cScreenHeight div 6;
- if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80);
+ if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80);
end
else smallScreenOffset:= 0;
for t:= 0 to Pred(TeamsCount) do
@@ -957,7 +958,7 @@
// this approach should be faster than drawing all borders one by one tinted or not
if highlight then
begin
- if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80)
+ if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80)
else Tint($FF, $FF, $FF, $FF);
// draw name
@@ -979,7 +980,7 @@
if smallScreenOffset <> 0 then
begin
SetScale(cDefaultZoomLevel);
- if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$FF);
+ if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$FF);
end;
// Lag alert
@@ -1196,7 +1197,10 @@
else
begin
CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
- CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y)+ hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
+ if isPhone() then
+ CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
+ else
+ CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
end;
wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
@@ -1312,7 +1316,7 @@
if missionTex <> nil then FreeTexture(missionTex);
end;
-procedure ShakeCamera(amount: LongWord);
+procedure ShakeCamera(amount: LongInt);
begin
if isCursorVisible then exit;
amount:= Max(1, round(amount*zoom/2));