Finish flakes implementation
authorunc0rr
Fri, 07 Mar 2008 20:25:19 +0000
changeset 806 d397c502a5dd
parent 805 4d75759b38bd
child 807 7fa6855f02e3
Finish flakes implementation
hedgewars/uLandObjects.pas
hedgewars/uStore.pas
hedgewars/uVisualGears.pas
--- a/hedgewars/uLandObjects.pas	Fri Mar 07 19:44:00 2008 +0000
+++ b/hedgewars/uLandObjects.pas	Fri Mar 07 20:25:19 2008 +0000
@@ -400,7 +400,7 @@
    Readln(f, vobFramesCount, vobFrameTicks, vobVelocity, vobFallSpeed);
 
 for i:= 0 to Pred(vobCount) do
-    AddVisualGear( -cScreenWidth + random(cScreenWidth * 2 + 2048), random(1000), vgtFlake);
+    AddVisualGear( -cScreenWidth + random(cScreenWidth * 2 + 2048), random(1200) - 100, vgtFlake);
 
 Close(f);
 {$I+}
--- a/hedgewars/uStore.pas	Fri Mar 07 19:44:00 2008 +0000
+++ b/hedgewars/uStore.pas	Fri Mar 07 20:25:19 2008 +0000
@@ -31,6 +31,7 @@
 procedure DrawLand (X, Y: LongInt);
 procedure DrawTexture(X, Y: LongInt; Texture: PTexture);
 procedure DrawRotated(Sprite: TSprite; X, Y: LongInt; Angle: real);
+procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame: LongInt; Angle: real);
 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y: LongInt; Angle: real);
 procedure DXOutText(X, Y: LongInt; Font: THWFont; s: string; Surface: PSDL_Surface);
 procedure DrawCentered(X, Top: LongInt; Source: PTexture);
@@ -358,7 +359,6 @@
 end;
 
 procedure DrawRotated(Sprite: TSprite; X, Y: LongInt; Angle: real);
-var hw, hh: LongInt;
 begin
 DrawRotatedTex(SpritesData[Sprite].Texture,
                SpritesData[Sprite].Width,
@@ -366,6 +366,17 @@
                X, Y, Angle)
 end;
 
+procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame: LongInt; Angle: real);
+begin
+glPushMatrix;
+glTranslatef(X - SpritesData[Sprite].Width div 2, Y - SpritesData[Sprite].Width div 2, 0);
+glRotatef(Angle, 0, 0, 1);
+
+DrawSprite(Sprite, 0, 0, Frame, nil);
+
+glPopMatrix
+end;
+
 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y: LongInt; Angle: real);
 begin
 glPushMatrix;
--- a/hedgewars/uVisualGears.pas	Fri Mar 07 19:44:00 2008 +0000
+++ b/hedgewars/uVisualGears.pas	Fri Mar 07 20:25:19 2008 +0000
@@ -69,7 +69,7 @@
 
 if hwRound(Gear^.X) < -cScreenWidth - 64 then Gear^.X:= int2hwFloat(cScreenWidth + 2048) else
 if hwRound(Gear^.X) > cScreenWidth + 2048 then Gear^.X:= int2hwFloat(-cScreenWidth - 64);
-if hwRound(Gear^.Y) > 1024 then Gear^.Y:= - _128
+if hwRound(Gear^.Y) > 1100 then Gear^.Y:= - _128
 end;
 
 procedure doStepCloud(Gear: PVisualGear; Steps: Longword);
@@ -110,7 +110,7 @@
                dx.isNegative:= random(2) = 0;
                dx.QWordValue:= random(100000000);
                dy.isNegative:= false;
-               dy.QWordValue:= random(20);
+               dy.QWordValue:= random(70000000);
                dAngle:= (random(2) * 2 - 1) * (1 + random) * vobVelocity / 1000
                end;
    vgtCloud: with Result^ do
@@ -158,7 +158,7 @@
            vgtFlake: if vobVelocity = 0 then
                         DrawSprite(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, nil)
                      else
-                        DrawRotated(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Angle);
+                        DrawRotatedF(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, Gear^.Angle);
 
            vgtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, nil);
               end;