Use 'regular standing' and 'rope swing' hedgehog sprites
authorunc0rr
Mon, 24 Mar 2008 19:18:13 +0000
changeset 821 e6c0408b54ed
parent 820 a26537586400
child 822 2ae8fd8ef804
Use 'regular standing' and 'rope swing' hedgehog sprites
hedgewars/uGears.pas
hedgewars/uStore.pas
share/hedgewars/Data/Graphics/Hedgehog.png
--- a/hedgewars/uGears.pas	Sun Mar 23 18:08:00 2008 +0000
+++ b/hedgewars/uGears.pas	Mon Mar 24 19:18:13 2008 +0000
@@ -472,10 +472,28 @@
 procedure DrawHH(Gear: PGear; Surface: PSDL_Surface);
 var t: LongInt;
 begin
-DrawHedgehog(hwRound(Gear^.X) - 15 + WorldDx, hwRound(Gear^.Y) - 18 + WorldDy,
-             hwSign(Gear^.dX), 0,
+if (Gear^.State and gstHHDriven) <> 0 then
+   begin
+   if CurAmmoGear <> nil then
+      begin
+      if (CurAmmoGear^.Kind = gtRope) then
+      DrawHedgehog(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
+             1,
+             1,
+             0,
+             DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) - 110);
+      end else
+      DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+             hwSign(Gear^.dX),
+             0,
              PHedgehog(Gear^.Hedgehog)^.visStepPos div 2,
-             Surface);
+             0);
+   end else
+   DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+             hwSign(Gear^.dX),
+             0,
+             8,
+             0);
 
 with PHedgehog(Gear^.Hedgehog)^ do
      if (Gear^.State{ and not gstAnimation}) = 0 then
@@ -502,6 +520,7 @@
         if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
            DrawSprite(sprFinger, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 64 + WorldDy,
                       GameTicks div 32 mod 16, Surface);
+
         if (Gear^.State and (gstMoving or gstDrowning)) = 0 then
            if (Gear^.State and gstHHThinking) <> 0 then
               DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0, Surface)
--- a/hedgewars/uStore.pas	Sun Mar 23 18:08:00 2008 +0000
+++ b/hedgewars/uStore.pas	Mon Mar 24 19:18:13 2008 +0000
@@ -36,7 +36,7 @@
 procedure DXOutText(X, Y: LongInt; Font: THWFont; s: string; Surface: PSDL_Surface);
 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
 procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture; DestSurface: PSDL_Surface);
-procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Surface: PSDL_Surface);
+procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
 function  RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture;
 procedure RenderHealth(var Hedgehog: THedgehog);
 procedure AddProgress;
@@ -471,7 +471,7 @@
 DrawTexture(X - Source^.w div 2, Top, Source)
 end;
 
-procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Surface: PSDL_Surface);
+procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
 var l, r, t, b: real;
 begin
 
@@ -488,23 +488,30 @@
    r:= (Step + 1) * 32 / HHTexture^.w
    end;
 
+
+glPushMatrix();
+glTranslatef(X, Y, 0);
+glRotatef(Angle, 0, 0, 1);
+
 glBindTexture(GL_TEXTURE_2D, HHTexture^.id);
 
 glBegin(GL_QUADS);
 
 glTexCoord2f(l, t);
-glVertex2i(X, Y);
+glVertex2i(-16, -16);
 
 glTexCoord2f(r, t);
-glVertex2i(32 + X, Y);
+glVertex2i(16, -16);
 
 glTexCoord2f(r, b);
-glVertex2i(32 + X, 32 + Y);
+glVertex2i(16, 16);
 
 glTexCoord2f(l, b);
-glVertex2i(X, 32 + Y);
+glVertex2i(-16, 16);
 
-glEnd()
+glEnd();
+
+glPopMatrix
 end;
 
 procedure StoreRelease;
Binary file share/hedgewars/Data/Graphics/Hedgehog.png has changed