Better crosshair
authorunc0rr
Wed, 25 Oct 2006 18:03:41 +0000
changeset 203 0ee86f9d9ba6
parent 202 8603c0420461
child 204 dcdf642459e0
Better crosshair
hedgewars/uStore.pas
hedgewars/uWorld.pas
share/hedgewars/Data/Graphics/Crosshair.png
--- a/hedgewars/uStore.pas	Thu Oct 19 18:57:58 2006 +0000
+++ b/hedgewars/uStore.pas	Wed Oct 25 18:03:41 2006 +0000
@@ -170,7 +170,7 @@
     Team:= TeamsList;
     while Team<>nil do
       begin
-      Team.CrosshairSurf:= SDL_CreateRGBSurface(SDL_HWSURFACE, 24, 360, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, PixelFormat.AMask);
+      Team.CrosshairSurf:= SDL_CreateRGBSurface(SDL_HWSURFACE, tmpsurf.w, tmpsurf.h, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, PixelFormat.AMask);
       TryDo(Team.CrosshairSurf <> nil, errmsgCreateSurface, true);
       SDL_FillRect(Team.CrosshairSurf, nil, Team.AdjColor);
       SDL_UpperBlit(tmpsurf, nil, Team.CrosshairSurf, nil);
--- a/hedgewars/uWorld.pas	Thu Oct 19 18:57:58 2006 +0000
+++ b/hedgewars/uWorld.pas	Wed Oct 25 18:03:41 2006 +0000
@@ -235,7 +235,7 @@
                         if ShowCrosshair and ((Gear.State and gstAttacked) = 0) then
                            DrawSurfSprite(Round(Gear.X + hwSign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle)*60) + WorldDx - 8,
                                           Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 12,
-                                          24, 0,
+                                          24, (18 + hwSign(Gear.dX) * integer(((Gear.Angle * 72 div cMaxAngle) + 1) div 2) mod 18) mod 18,
                                           Team.CrosshairSurf, Surface);
                      end;
       team:= team.Next
Binary file share/hedgewars/Data/Graphics/Crosshair.png has changed