hedgewars/VGSHandlers.inc
changeset 3593 ae50f63e4fa9
parent 3592 0bcad5c38c9e
child 3597 978c30ef50fc
equal deleted inserted replaced
3592:0bcad5c38c9e 3593:ae50f63e4fa9
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
    18 procedure doStepFlake(Gear: PVisualGear; Steps: Longword);
    19 var sign: hwFloat;
    19 var sign: float;
    20 begin
    20 begin
    21 sign:= _1;
    21 sign:= 1;
    22 with Gear^ do
    22 with Gear^ do
    23     begin
    23     begin
    24     inc(FrameTicks, Steps);
    24     inc(FrameTicks, Steps);
    25     if FrameTicks > vobFrameTicks then
    25     if FrameTicks > vobFrameTicks then
    26         begin
    26         begin
    27         dec(FrameTicks, vobFrameTicks);
    27         dec(FrameTicks, vobFrameTicks);
    28         inc(Frame);
    28         inc(Frame);
    29         if Frame = vobFramesCount then Frame:= 0
    29         if Frame = vobFramesCount then Frame:= 0
    30         end;
    30         end;
    31     X:= X + (cWindSpeed * 200 + dX + tdX) * Steps;
    31     X:= X + (cWindSpeedf * 200 + dX + tdX) * Steps;
    32     Y:= Y + (dY + tdY + cGravity * vobFallSpeed) * Steps;
    32     Y:= Y + (dY + tdY + cGravityf * vobFallSpeed) * Steps;
    33     Angle:= Angle + dAngle * Steps;
    33     Angle:= Angle + dAngle * Steps;
    34   
    34   
    35     if (hwRound(X) >= -cScreenWidth - 64) and
    35     if (round(X) >= -cScreenWidth - 64) and
    36        (hwRound(X) <= cScreenWidth + LAND_WIDTH) and
    36        (round(X) <= cScreenWidth + LAND_WIDTH) and
    37        (hwRound(Y) <= (LAND_HEIGHT + 75)) and 
    37        (round(Y) <= (LAND_HEIGHT + 75)) and 
    38        (Timer > 0) and (Timer-Steps > 0) then
    38        (Timer > 0) and (Timer-Steps > 0) then
    39         begin
    39         begin
    40         sign.isNegative:=tdX.isNegative;
    40         if tdX > 0 then sign := 1
    41         tdX:= tdX - _0_005*Steps*sign;
    41         else sign:= -1;
    42         if (sign.isNegative and (tdX > _0)) or (not sign.isNegative and (tdX < _0)) then tdX:= _0;
    42         tdX:= tdX - 0.005*Steps*sign;
    43         sign.isNegative:=tdY.isNegative;
    43         if ((sign < 0) and (tdX > 0)) or ((sign > 0) and (tdX < 0)) then tdX:= 0;
    44         tdY:= tdY - _0_005*Steps*sign;
    44         if tdX > 0 then sign := 1
    45         if (sign.isNegative and (tdY > _0)) or (not sign.isNegative and (tdY < _0)) then tdY:= _0;
    45         else sign:= -1;
       
    46         tdY:= tdY - 0.005*Steps*sign;
       
    47         if ((sign < 0) and (tdY > 0)) or ((sign > 0) and (tdY < 0)) then tdY:= 0;
    46         dec(Timer, Steps)
    48         dec(Timer, Steps)
    47         end
    49         end
    48     else
    50     else
    49         begin
    51         begin
    50         if hwRound(X) < -cScreenWidth - 64 then X:= int2hwFloat(cScreenWidth + LAND_WIDTH) else
    52         if round(X) < -cScreenWidth - 64 then X:= float(cScreenWidth + LAND_WIDTH) else
    51         if hwRound(X) > cScreenWidth + LAND_WIDTH then X:= int2hwFloat(-cScreenWidth - 64);
    53         if round(X) > cScreenWidth + LAND_WIDTH then X:= float(-cScreenWidth - 64);
    52         // if hwRound(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + int2hwFloat(25); // For if flag is set for flakes rising upwards?
    54         // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + float(25); // For if flag is set for flakes rising upwards?
    53         if hwRound(Y) > (LAND_HEIGHT + 75) then Y:= Y - int2hwFloat(1024 + 150); // TODO - configure in theme (jellies for example could use limited range)
    55         if round(Y) > (LAND_HEIGHT + 75) then Y:= Y - float(1024 + 150); // TODO - configure in theme (jellies for example could use limited range)
    54         Timer:= 0;
    56         Timer:= 0;
    55         tdX:= _0;
    57         tdX:= 0;
    56         tdY:= _0
    58         tdY:= 0
    57         end;
    59         end;
    58     end;
    60     end;
    59 
    61 
    60 end;
    62 end;
    61 
    63 
    69 end;
    71 end;
    70 
    72 
    71 ////////////////////////////////////////////////////////////////////////////////
    73 ////////////////////////////////////////////////////////////////////////////////
    72 procedure doStepCloud(Gear: PVisualGear; Steps: Longword);
    74 procedure doStepCloud(Gear: PVisualGear; Steps: Longword);
    73 var s: Longword;
    75 var s: Longword;
    74     t: hwFloat;
    76     t: float;
    75 begin
    77 begin
    76 Gear^.X:= Gear^.X + (cWindSpeed * 200 + Gear^.dX) * Steps;
    78 Gear^.X:= Gear^.X + (cWindSpeedf * 200 + Gear^.dX) * Steps;
    77 
    79 
    78 // up-and-down-bounce magic
    80 // up-and-down-bounce magic
    79 s := (GameTicks + Gear^.mdy) mod 4096;
    81 s := (GameTicks + Gear^.Timer) mod 4096;
    80 t := AngleSin(s mod 2048);
    82 t := 8 * AngleSin(s mod 2048).QWordValue / 4294967296;
    81 t.isNegative := (s < 2048);
    83 if (s < 2048) then t *= -1;
    82 t.QWordValue := t.QWordValue * 8;
    84 
    83 
    85 Gear^.Y := LAND_HEIGHT-1184 + Gear^.Timer mod 8 + t;
    84 Gear^.Y := int2hwFloat(LAND_HEIGHT-1184 + Gear^.mdy mod 8) + t;
    86 
    85 
    87 if round(Gear^.X) < -cScreenWidth - 256 then Gear^.X:= float(cScreenWidth + LAND_WIDTH) else
    86 
    88 if round(Gear^.X) > cScreenWidth + LAND_WIDTH then Gear^.X:= float(-cScreenWidth - 256)
    87 if hwRound(Gear^.X) < -cScreenWidth - 256 then Gear^.X:= int2hwFloat(cScreenWidth + LAND_WIDTH) else
       
    88 if hwRound(Gear^.X) > cScreenWidth + LAND_WIDTH then Gear^.X:= int2hwFloat(-cScreenWidth - 256)
       
    89 end;
    89 end;
    90 
    90 
    91 ////////////////////////////////////////////////////////////////////////////////
    91 ////////////////////////////////////////////////////////////////////////////////
    92 procedure doStepExpl(Gear: PVisualGear; Steps: Longword);
    92 procedure doStepExpl(Gear: PVisualGear; Steps: Longword);
    93 begin
    93 begin
    94 Gear^.X:= Gear^.X + Gear^.dX * Steps;
    94 Gear^.X:= Gear^.X + Gear^.dX * Steps;
    95 
    95 
    96 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
    96 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
    97 //Gear^.dY:= Gear^.dY + cGravity;
    97 //Gear^.dY:= Gear^.dY + cGravityf;
    98 
    98 
    99 if Gear^.FrameTicks <= Steps then
    99 if Gear^.FrameTicks <= Steps then
   100     if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   100     if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   101     else
   101     else
   102         begin
   102         begin
   110 procedure doStepEgg(Gear: PVisualGear; Steps: Longword);
   110 procedure doStepEgg(Gear: PVisualGear; Steps: Longword);
   111 begin
   111 begin
   112 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   112 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   113 
   113 
   114 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   114 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   115 Gear^.dY:= Gear^.dY + cGravity * Steps;
   115 Gear^.dY:= Gear^.dY + cGravityf * Steps;
   116 
   116 
   117 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
   117 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
   118 
   118 
   119 if Gear^.FrameTicks <= Steps then
   119 if Gear^.FrameTicks <= Steps then
   120     DeleteVisualGear(Gear)
   120     DeleteVisualGear(Gear)
   125 ////////////////////////////////////////////////////////////////////////////////
   125 ////////////////////////////////////////////////////////////////////////////////
   126 procedure doStepFire(Gear: PVisualGear; Steps: Longword);
   126 procedure doStepFire(Gear: PVisualGear; Steps: Longword);
   127 begin
   127 begin
   128 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   128 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   129 
   129 
   130 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravity * (Steps * Steps);
   130 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;// + cGravityf * (Steps * Steps);
   131 Gear^.dY:= Gear^.dY + cGravity * Steps;
   131 Gear^.dY:= Gear^.dY + cGravityf * Steps;
   132 
   132 
   133 if Gear^.FrameTicks <= Steps then
   133 if Gear^.FrameTicks <= Steps then
   134        DeleteVisualGear(Gear)
   134        DeleteVisualGear(Gear)
   135 else
   135 else
   136     dec(Gear^.FrameTicks, Steps)
   136     dec(Gear^.FrameTicks, Steps)
   140 procedure doStepShell(Gear: PVisualGear; Steps: Longword);
   140 procedure doStepShell(Gear: PVisualGear; Steps: Longword);
   141 begin
   141 begin
   142 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   142 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   143 
   143 
   144 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   144 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   145 Gear^.dY:= Gear^.dY + cGravity * Steps;
   145 Gear^.dY:= Gear^.dY + cGravityf * Steps;
   146 
   146 
   147 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
   147 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
   148 
   148 
   149 if Gear^.FrameTicks <= Steps then
   149 if Gear^.FrameTicks <= Steps then
   150     DeleteVisualGear(Gear)
   150     DeleteVisualGear(Gear)
   152     dec(Gear^.FrameTicks, Steps)
   152     dec(Gear^.FrameTicks, Steps)
   153 end;
   153 end;
   154 
   154 
   155 procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword);
   155 procedure doStepSmallDamage(Gear: PVisualGear; Steps: Longword);
   156 begin
   156 begin
   157 Gear^.Y:= Gear^.Y - _0_02 * Steps;
   157 Gear^.Y:= Gear^.Y - 0.02 * Steps;
   158 
   158 
   159 if Gear^.FrameTicks <= Steps then
   159 if Gear^.FrameTicks <= Steps then
   160     DeleteVisualGear(Gear)
   160     DeleteVisualGear(Gear)
   161 else
   161 else
   162     dec(Gear^.FrameTicks, Steps)
   162     dec(Gear^.FrameTicks, Steps)
   163 end;
   163 end;
   164 
   164 
   165 ////////////////////////////////////////////////////////////////////////////////
   165 ////////////////////////////////////////////////////////////////////////////////
   166 procedure doStepBubble(Gear: PVisualGear; Steps: Longword);
   166 procedure doStepBubble(Gear: PVisualGear; Steps: Longword);
   167 begin
   167 begin
   168     Gear^.X:= Gear^.X + (cWindSpeed * 100 + Gear^.dX) * Steps;
   168     Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps;
   169     Gear^.Y:= Gear^.Y - cDrownSpeed * Steps;
   169     Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps;
   170 
   170 
   171     if (Gear^.FrameTicks <= Steps) or (hwRound(Gear^.Y) < cWaterLine) then
   171     if (Gear^.FrameTicks <= Steps) or (round(Gear^.Y) < cWaterLine) then
   172         DeleteVisualGear(Gear)
   172         DeleteVisualGear(Gear)
   173     else
   173     else
   174         dec(Gear^.FrameTicks, Steps)
   174         dec(Gear^.FrameTicks, Steps)
   175 end;
   175 end;
   176 
   176 
   187 end;
   187 end;
   188 
   188 
   189 ////////////////////////////////////////////////////////////////////////////////
   189 ////////////////////////////////////////////////////////////////////////////////
   190 procedure doStepSteam(Gear: PVisualGear; Steps: Longword);
   190 procedure doStepSteam(Gear: PVisualGear; Steps: Longword);
   191 begin
   191 begin
   192     Gear^.X:= Gear^.X + (cWindSpeed * 100 + Gear^.dX) * Steps;
   192     Gear^.X:= Gear^.X + (cWindSpeedf * 100 + Gear^.dX) * Steps;
   193     Gear^.Y:= Gear^.Y - cDrownSpeed * Steps;
   193     Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps;
   194 
   194 
   195     if Gear^.FrameTicks <= Steps then
   195     if Gear^.FrameTicks <= Steps then
   196         if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   196         if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   197         else
   197         else
   198             begin
   198             begin
   203 end;
   203 end;
   204 
   204 
   205 ////////////////////////////////////////////////////////////////////////////////
   205 ////////////////////////////////////////////////////////////////////////////////
   206 procedure doStepAmmo(Gear: PVisualGear; Steps: Longword);
   206 procedure doStepAmmo(Gear: PVisualGear; Steps: Longword);
   207 begin
   207 begin
   208     Gear^.Y:= Gear^.Y - cDrownSpeed * Steps;
   208     Gear^.Y:= Gear^.Y - cDrownSpeedf * Steps;
   209 
   209 
   210     Gear^.scale:= Gear^.scale + 0.0025 * Steps;
   210     Gear^.scale:= Gear^.scale + 0.0025 * Steps;
   211     Gear^.alpha:= Gear^.alpha - 0.0015 * Steps;
   211     Gear^.alpha:= Gear^.alpha - 0.0015 * Steps;
   212 
   212 
   213     if Gear^.alpha < 0 then DeleteVisualGear(Gear)
   213     if Gear^.alpha < 0 then DeleteVisualGear(Gear)
   214 end;
   214 end;
   215 
   215 
   216 ////////////////////////////////////////////////////////////////////////////////
   216 ////////////////////////////////////////////////////////////////////////////////
   217 procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
   217 procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
   218 begin
   218 begin
   219     Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps;
   219     Gear^.X:= Gear^.X + (cWindSpeedf + Gear^.dX) * Steps;
   220     Gear^.Y:= Gear^.Y - (cDrownSpeed + Gear^.dY) * Steps;
   220     Gear^.Y:= Gear^.Y - (cDrownSpeedf + Gear^.dY) * Steps;
   221 
   221 
   222     Gear^.dX := Gear^.dX + (cWindSpeed * _0_3 * Steps);
   222     Gear^.dX := Gear^.dX + (cWindSpeedf * 0.3 * Steps);
   223     //Gear^.dY := Gear^.dY - (cDrownSpeed * _0_995);
   223     //Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.995);
   224 
   224 
   225     if Gear^.FrameTicks <= Steps then
   225     if Gear^.FrameTicks <= Steps then
   226         if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   226         if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   227         else
   227         else
   228             begin
   228             begin
   233 end;
   233 end;
   234 
   234 
   235 ////////////////////////////////////////////////////////////////////////////////
   235 ////////////////////////////////////////////////////////////////////////////////
   236 procedure doStepDust(Gear: PVisualGear; Steps: Longword);
   236 procedure doStepDust(Gear: PVisualGear; Steps: Longword);
   237 begin
   237 begin
   238     Gear^.X:= Gear^.X + (cWindSpeed + (cWindSpeed * _0_03 * Steps) + Gear^.dX) * Steps;
   238     Gear^.X:= Gear^.X + (cWindSpeedf + (cWindSpeedf * 0.03 * Steps) + Gear^.dX) * Steps;
   239     Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps;
   239     Gear^.Y:= Gear^.Y - (Gear^.dY) * Steps;
   240 
   240 
   241     Gear^.dX := Gear^.dX - (Gear^.dX * _0_005 * Steps);
   241     Gear^.dX := Gear^.dX - (Gear^.dX * 0.005 * Steps);
   242     Gear^.dY := Gear^.dY - (cDrownSpeed * _0_001 * Steps);
   242     Gear^.dY := Gear^.dY - (cDrownSpeedf * 0.001 * Steps);
   243 
   243 
   244     if Gear^.FrameTicks <= Steps then
   244     if Gear^.FrameTicks <= Steps then
   245         if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   245         if Gear^.Frame = 0 then DeleteVisualGear(Gear)
   246         else
   246         else
   247             begin
   247             begin
   264 procedure doStepDroplet(Gear: PVisualGear; Steps: Longword);
   264 procedure doStepDroplet(Gear: PVisualGear; Steps: Longword);
   265 begin
   265 begin
   266   Gear^.X:= Gear^.X + Gear^.dX * Steps;
   266   Gear^.X:= Gear^.X + Gear^.dX * Steps;
   267 
   267 
   268   Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   268   Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   269   Gear^.dY:= Gear^.dY + cGravity * Steps;
   269   Gear^.dY:= Gear^.dY + cGravityf * Steps;
   270 
   270 
   271   if hwRound(Gear^.Y) > cWaterLine then begin
   271   if round(Gear^.Y) > cWaterLine then begin
   272     DeleteVisualGear(Gear);
   272     DeleteVisualGear(Gear);
   273     PlaySound(TSound(ord(sndDroplet1) + Random(3)));
   273     PlaySound(TSound(ord(sndDroplet1) + Random(3)));
   274     end;
   274     end;
   275 end;
   275 end;
   276 
   276 
   291 procedure doStepFeather(Gear: PVisualGear; Steps: Longword);
   291 procedure doStepFeather(Gear: PVisualGear; Steps: Longword);
   292 begin
   292 begin
   293 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   293 Gear^.X:= Gear^.X + Gear^.dX * Steps;
   294 
   294 
   295 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   295 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
   296 Gear^.dY:= Gear^.dY + cGravity * Steps;
   296 Gear^.dY:= Gear^.dY + cGravityf * Steps;
   297 
   297 
   298 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
   298 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
   299 
   299 
   300 if Gear^.FrameTicks <= Steps then
   300 if Gear^.FrameTicks <= Steps then
   301     DeleteVisualGear(Gear)
   301     DeleteVisualGear(Gear)
   388 begin
   388 begin
   389 if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0;
   389 if Gear^.Timer > Steps then dec(Gear^.Timer, Steps) else Gear^.Timer:= 0;
   390 
   390 
   391 if (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then
   391 if (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then
   392     begin
   392     begin
   393     Gear^.X:= PHedgehog(Gear^.Hedgehog)^.Gear^.X + int2hwFloat(Gear^.Tex^.w div 2  - Gear^.FrameTicks);
   393     Gear^.X:= PHedgehog(Gear^.Hedgehog)^.Gear^.X.QWordValue/4294967296 + (Gear^.Tex^.w div 2  - Gear^.FrameTicks);
   394     Gear^.Y:= PHedgehog(Gear^.Hedgehog)^.Gear^.Y - int2hwFloat(16 + Gear^.Tex^.h);
   394     Gear^.Y:= PHedgehog(Gear^.Hedgehog)^.Gear^.Y.QWordValue/4294967296 - (16 + Gear^.Tex^.h);
   395     end;
   395     end;
   396 
   396 
   397 if Gear^.Timer = 0 then
   397 if Gear^.Timer = 0 then
   398     begin
   398     begin
   399     if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then
   399     if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then
   421     3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10;
   421     3: Gear^.FrameTicks:= SpritesData[sprShoutTail].Width-10;
   422     end;
   422     end;
   423 
   423 
   424 Gear^.doStep:= @doStepSpeechBubbleWork;
   424 Gear^.doStep:= @doStepSpeechBubbleWork;
   425 
   425 
   426 Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h)
   426 Gear^.Y:= Gear^.Y - float(Gear^.Tex^.h)
   427 end;
   427 end;
   428 
   428 
   429 ////////////////////////////////////////////////////////////////////////////////
   429 ////////////////////////////////////////////////////////////////////////////////
   430 procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword);
   430 procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword);
   431 begin
   431 begin
   438     end;
   438     end;
   439 end;
   439 end;
   440 
   440 
   441 procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword);
   441 procedure doStepHealthTagWorkUnderWater(Gear: PVisualGear; Steps: Longword);
   442 begin
   442 begin
   443 if hwRound(Gear^.Y) < cWaterLine + 10 then
   443 if round(Gear^.Y) < cWaterLine + 10 then
   444     DeleteVisualGear(Gear)
   444     DeleteVisualGear(Gear)
   445 else
   445 else
   446     Gear^.Y:= Gear^.Y - _0_08 * Steps;
   446     Gear^.Y:= Gear^.Y - 0.08 * Steps;
   447 
   447 
   448 end;
   448 end;
   449 
   449 
   450 procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword);
   450 procedure doStepHealthTag(Gear: PVisualGear; Steps: Longword);
   451 var s: shortstring;
   451 var s: shortstring;
   452 begin
   452 begin
   453 s:= '';
   453 s:= '';
   454 
   454 
   455 Gear^.dY:= -_0_08;
   455 Gear^.dY:= -0.08;
   456 
   456 
   457 str(Gear^.State, s);
   457 str(Gear^.State, s);
   458 if Gear^.Hedgehog <> nil then
   458 if Gear^.Hedgehog <> nil then
   459     Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16)
   459     Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16)
   460 else
   460 else
   461     Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16);
   461     Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16);
   462 
   462 
   463 if hwRound(Gear^.Y) < cWaterLine then
   463 if round(Gear^.Y) < cWaterLine then
   464     Gear^.doStep:= @doStepHealthTagWork
   464     Gear^.doStep:= @doStepHealthTagWork
   465 else
   465 else
   466     Gear^.doStep:= @doStepHealthTagWorkUnderWater;
   466     Gear^.doStep:= @doStepHealthTagWorkUnderWater;
   467 
   467 
   468 Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h);
   468 Gear^.Y:= Gear^.Y - float(Gear^.Tex^.h);
   469 
   469 
   470 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
   470 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
   471 end;
   471 end;
   472 
   472 
   473 ////////////////////////////////////////////////////////////////////////////////
   473 ////////////////////////////////////////////////////////////////////////////////
   477 if Gear^.Timer > 64 then
   477 if Gear^.Timer > 64 then
   478     begin
   478     begin
   479     dec(Gear^.State, Gear^.Timer div 65);
   479     dec(Gear^.State, Gear^.Timer div 65);
   480     Gear^.Timer:= Gear^.Timer mod 65;
   480     Gear^.Timer:= Gear^.Timer mod 65;
   481     end;
   481     end;
   482 Gear^.dX:= Gear^.dX + cWindSpeed * Steps;
   482 Gear^.dX:= Gear^.dX + cWindSpeedf * Steps;
   483 Gear^.X:= Gear^.X + Gear^.dX;
   483 Gear^.X:= Gear^.X + Gear^.dX;
   484 if Gear^.State = 0 then DeleteVisualGear(Gear);
   484 if Gear^.State = 0 then DeleteVisualGear(Gear);
   485 end;
   485 end;
   486 
   486 
   487 ////////////////////////////////////////////////////////////////////////////////
   487 ////////////////////////////////////////////////////////////////////////////////
   498 
   498 
   499 procedure doStepExplosion(Gear: PVisualGear; Steps: Longword);
   499 procedure doStepExplosion(Gear: PVisualGear; Steps: Longword);
   500 var i: LongWord;
   500 var i: LongWord;
   501 gX,gY: LongInt;
   501 gX,gY: LongInt;
   502 begin
   502 begin
   503 gX:= hwRound(Gear^.X);
   503 gX:= round(Gear^.X);
   504 gY:= hwRound(Gear^.Y);
   504 gY:= round(Gear^.Y);
   505 for i:= 0 to 31 do AddVisualGear(gX, gY, vgtFire);
   505 for i:= 0 to 31 do AddVisualGear(gX, gY, vgtFire);
   506 for i:= 0 to  8 do AddVisualGear(gX, gY, vgtExplPart);
   506 for i:= 0 to  8 do AddVisualGear(gX, gY, vgtExplPart);
   507 for i:= 0 to  8 do AddVisualGear(gX, gY, vgtExplPart2);
   507 for i:= 0 to  8 do AddVisualGear(gX, gY, vgtExplPart2);
   508 Gear^.doStep:= @doStepExplosionWork;
   508 Gear^.doStep:= @doStepExplosionWork;
   509 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
   509 if Steps > 1 then Gear^.doStep(Gear, Steps-1);
   530 
   530 
   531 procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword);
   531 procedure doStepBigExplosion(Gear: PVisualGear; Steps: Longword);
   532 var i: LongWord;
   532 var i: LongWord;
   533 gX,gY: LongInt;
   533 gX,gY: LongInt;
   534 begin
   534 begin
   535 gX:= hwRound(Gear^.X);
   535 gX:= round(Gear^.X);
   536 gY:= hwRound(Gear^.Y);
   536 gY:= round(Gear^.Y);
   537 AddVisualGear(gX, gY, vgtSmokeRing);
   537 AddVisualGear(gX, gY, vgtSmokeRing);
   538 for i:= 0 to 46 do AddVisualGear(gX, gY, vgtFire);
   538 for i:= 0 to 46 do AddVisualGear(gX, gY, vgtFire);
   539 for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart);
   539 for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart);
   540 for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart2);
   540 for i:= 0 to 15 do AddVisualGear(gX, gY, vgtExplPart2);
   541 Gear^.doStep:= @doStepBigExplosionWork;
   541 Gear^.doStep:= @doStepBigExplosionWork;