hedgewars/uGears.pas
changeset 16049 9be943326d9c
parent 15936 303cf91e5233
equal deleted inserted replaced
16048:eb015d6b4a2a 16049:9be943326d9c
   221 
   221 
   222         Gear:= Gear^.NextGear
   222         Gear:= Gear^.NextGear
   223     end;
   223     end;
   224 end;
   224 end;
   225 
   225 
       
   226 procedure processFlakes;
       
   227 var i: Longword;
       
   228 begin
       
   229     if GameTicks and $7 = 0 then
       
   230         for i:= 1 to FlakesCount do
       
   231             doStepSnowflake(@Flakes[i - 1])
       
   232 end;
       
   233 
   226 procedure ProcessGears;
   234 procedure ProcessGears;
   227 var t, tmpGear: PGear;
   235 var t, tmpGear: PGear;
   228     i, j, AliveCount: LongInt;
   236     i, j, AliveCount: LongInt;
   229     s: ansistring;
   237     s: ansistring;
   230     prevtime: LongWord;
   238     prevtime: LongWord;
   253     StepSoundChannel:= -1
   261     StepSoundChannel:= -1
   254     end;
   262     end;
   255 
   263 
   256 if StepSoundTimer > 0 then
   264 if StepSoundTimer > 0 then
   257     dec(StepSoundTimer, 1);
   265     dec(StepSoundTimer, 1);
       
   266 
       
   267 processFlakes;
   258 
   268 
   259 t:= GearsList;
   269 t:= GearsList;
   260 while t <> nil do
   270 while t <> nil do
   261     begin
   271     begin
   262     curHandledGear:= t;
   272     curHandledGear:= t;
   698 end;
   708 end;
   699 
   709 
   700 procedure DrawGears;
   710 procedure DrawGears;
   701 var Gear: PGear;
   711 var Gear: PGear;
   702     x, y: LongInt;
   712     x, y: LongInt;
       
   713     i: Longword;
   703 begin
   714 begin
   704 Gear:= GearsList;
   715 Gear:= GearsList;
   705 while Gear <> nil do
   716 while Gear <> nil do
   706     begin
   717     begin
   707     if (Gear^.State and gstInvisible = 0) and (Gear^.Message and gmRemoveFromList = 0) then
   718     if (Gear^.State and gstInvisible = 0) and (Gear^.Message and gmRemoveFromList = 0) then
   709         x:= hwRound(Gear^.X) + WorldDx;
   720         x:= hwRound(Gear^.X) + WorldDx;
   710         y:= hwRound(Gear^.Y) + WorldDy;
   721         y:= hwRound(Gear^.Y) + WorldDy;
   711         RenderGear(Gear, x, y);
   722         RenderGear(Gear, x, y);
   712         end;
   723         end;
   713     Gear:= Gear^.NextGear
   724     Gear:= Gear^.NextGear
       
   725     end;
       
   726 
       
   727 for i:= 1 to FlakesCount do
       
   728     begin
       
   729     Gear:= @Flakes[i - 1];
       
   730     if (Gear^.State and gstInvisible = 0) and (Gear^.Message and gmRemoveFromList = 0) then
       
   731         begin
       
   732         x:= hwRound(Gear^.X) + WorldDx;
       
   733         y:= hwRound(Gear^.Y) + WorldDy;
       
   734         RenderGear(Gear, x, y);
       
   735         end;
   714     end;
   736     end;
   715 
   737 
   716 if SpeechHogNumber > 0 then
   738 if SpeechHogNumber > 0 then
   717     DrawHHOrder();
   739     DrawHHOrder();
   718 end;
   740 end;
   995     end;
  1017     end;
   996 
  1018 
   997 snowRight:= max(LAND_WIDTH,4096)+512;
  1019 snowRight:= max(LAND_WIDTH,4096)+512;
   998 snowLeft:= -(snowRight-LAND_WIDTH);
  1020 snowLeft:= -(snowRight-LAND_WIDTH);
   999 
  1021 
       
  1022 FlakesCount:= 0;
       
  1023 {
  1000 if (not hasBorder) and cSnow then
  1024 if (not hasBorder) and cSnow then
       
  1025     begin
  1001     for i:= vobCount * Longword(max(LAND_WIDTH,4096)) div 2048 downto 1 do
  1026     for i:= vobCount * Longword(max(LAND_WIDTH,4096)) div 2048 downto 1 do
  1002         begin
  1027         begin
  1003         rx:=GetRandom(snowRight - snowLeft);
  1028         rx:=GetRandom(snowRight - snowLeft);
  1004         ry:=GetRandom(750);
  1029         ry:=GetRandom(750);
  1005         AddGear(rx + snowLeft, LongInt(LAND_HEIGHT) + ry - 1300, gtFlake, 0, _0, _0, 0)
  1030         AddGear(rx + snowLeft, LongInt(LAND_HEIGHT) + ry - 1300, gtFlake, 0, _0, _0, 0)
  1006         end
  1031         end
       
  1032     end
       
  1033 }
       
  1034 if (not hasBorder) and cSnow then
       
  1035     begin
       
  1036      FlakesCount:= vobCount * Longword(max(LAND_WIDTH,4096)) div 2048;
       
  1037      SetLength(Flakes, FlakesCount);
       
  1038      for i:= 0 to FlakesCount - 1 do
       
  1039         begin
       
  1040         rx:=GetRandom(snowRight - snowLeft);
       
  1041         ry:=GetRandom(750);
       
  1042         initializeGear(@Flakes[i], rx + snowLeft, LongInt(LAND_HEIGHT) + ry - 1300, gtFlake, 0, _0, _0, 0, 0)
       
  1043         end
       
  1044      end
  1007 end;
  1045 end;
  1008 
  1046 
  1009 // sort clans horizontally (bubble-sort, because why not)
  1047 // sort clans horizontally (bubble-sort, because why not)
  1010 procedure SortHHsByClan();
  1048 procedure SortHHsByClan();
  1011 var n, newn, i, j, k, p: LongInt;
  1049 var n, newn, i, j, k, p: LongInt;