disallow speech bubbles to go offscreen
no tint or tail-directio adjustments for indicating it's offscreen yet though
--- a/hedgewars/uVisualGears.pas Sun Dec 08 02:36:14 2013 +0100
+++ b/hedgewars/uVisualGears.pas Sun Dec 08 02:43:06 2013 +0100
@@ -247,14 +247,16 @@
else
DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);*)
vgtSpeechBubble: begin
- if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then
+ if (Gear^.Tex <> nil) and (Gear^.State <= 2) then
begin
- tinted:= true;
- Tint($FF, $FF, $FF, $66);
- DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
- end
- else if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team = CurrentTeam)) or (Gear^.State = 2)) then
- DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
+ // make speech bubbles of inactive teams' hogs transparent
+ if ((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1) then
+ begin
+ tinted:= true;
+ Tint($FF, $FF, $FF, $66);
+ end;
+ DrawTextureCentered(round(Gear^.X), round(Gear^.Y), Gear^.Tex);
+ end;
end;
vgtSmallDamageTag: DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
vgtHealthTag: if Gear^.Tex <> nil then
--- a/hedgewars/uVisualGearsHandlers.pas Sun Dec 08 02:36:14 2013 +0100
+++ b/hedgewars/uVisualGearsHandlers.pas Sun Dec 08 02:43:06 2013 +0100
@@ -590,6 +590,8 @@
begin
Gear^.X:= hwFloat2Float(Gear^.Hedgehog^.Gear^.X) + (Gear^.Tex^.w div 2 - Gear^.FrameTicks);
Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (16 + Gear^.Tex^.h);
+ Gear^.X:= max(((-cScreenWidth + 16) / zoom) + Gear^.Tex^.w div 2, min(((cScreenWidth - 16) / zoom) - Gear^.Tex^.w div 2, Gear^.X + WorldDx));
+ Gear^.Y:= max(cScreenHeight div 2 - ((cScreenHeight - 16) / (zoom)), min(cScreenHeight div 2 - ((-cScreenHeight + Gear^.Tex^.h) / (zoom)) - 64, Gear^.Y + WorldDy));
end;
if Gear^.Timer = 0 then