hedgewars/VGSHandlers.inc
branchcursor_issues
changeset 5189 dc1fe432b293
parent 5186 a05c14510c8a
child 5235 e30b06ffea3a
equal deleted inserted replaced
5149:9aa840fdf922 5189:dc1fe432b293
   104 begin
   104 begin
   105 Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX) * Steps;
   105 Gear^.X:= Gear^.X + (cWindSpeedf * 750 * Gear^.dX) * Steps;
   106 
   106 
   107 // up-and-down-bounce magic
   107 // up-and-down-bounce magic
   108 s := (GameTicks + Gear^.Timer) mod 4096;
   108 s := (GameTicks + Gear^.Timer) mod 4096;
   109 t := 8 * AngleSin(s mod 2048).QWordValue / 4294967296;
   109 t := 8 * hwFloat2Float(AngleSin(s mod 2048));
   110 if (s < 2048) then t := -t;
   110 if (s < 2048) then t := -t;
   111 
   111 
   112 Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t;
   112 Gear^.Y := LAND_HEIGHT - 1184 + LongInt(Gear^.Timer mod 8) + t;
   113 
   113 
   114 if round(Gear^.X) < cLeftScreenBorder then Gear^.X:= Gear^.X + cScreenSpace else
   114 if round(Gear^.X) < cLeftScreenBorder then Gear^.X:= Gear^.X + cScreenSpace else
   463 begin
   463 begin
   464 if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0;
   464 if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0;
   465 
   465 
   466 if (Gear^.Hedgehog^.Gear <> nil) then
   466 if (Gear^.Hedgehog^.Gear <> nil) then
   467     begin
   467     begin
   468     Gear^.X:= Gear^.Hedgehog^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2  - Gear^.FrameTicks);
   468     Gear^.X:= hwFloat2Float(Gear^.Hedgehog^.Gear^.X) + (Gear^.Tex^.w div 2  - Gear^.FrameTicks);
   469     Gear^.Y:= Gear^.Hedgehog^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h);
   469     Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (16 + Gear^.Tex^.h);
   470     end;
   470     end;
   471 
   471 
   472 if Gear^.Timer = 0 then
   472 if Gear^.Timer = 0 then
   473     begin
   473     begin
   474     if Gear^.Hedgehog^.SpeechGear = Gear then
   474     if Gear^.Hedgehog^.SpeechGear = Gear then
   484 with Gear^.Hedgehog^ do
   484 with Gear^.Hedgehog^ do
   485     if SpeechGear <> nil then SpeechGear^.Timer:= 0;
   485     if SpeechGear <> nil then SpeechGear^.Timer:= 0;
   486 
   486 
   487 Gear^.Hedgehog^.SpeechGear:= Gear;
   487 Gear^.Hedgehog^.SpeechGear:= Gear;
   488 
   488 
   489 Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000);
   489 Gear^.Timer:= max(LongInt(Length(Gear^.Text)) * 150, 3000);
   490 
   490 
   491 Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16);
   491 Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16);
   492 
   492 
   493 case Gear^.FrameTicks of
   493 case Gear^.FrameTicks of
   494     1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28;
   494     1: Gear^.FrameTicks:= SpritesData[sprSpeechTail].Width-28;
   682                 else dec(tmp);
   682                 else dec(tmp);
   683                 if tmp < round(dX) then tdY:= 1;
   683                 if tmp < round(dX) then tdY:= 1;
   684                 if tmp > round(dY) then tdY:= -1;
   684                 if tmp > round(dY) then tdY:= -1;
   685                 if tmp > 255 then tmp := 255;
   685                 if tmp > 255 then tmp := 255;
   686                 if tmp < 0 then tmp := 0;
   686                 if tmp < 0 then tmp := 0;
   687                 Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or tmp
   687                 Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or Longword(tmp)
   688                 end
   688                 end
   689             end
   689             end
   690 end;
   690 end;