hedgewars/uGears.pas
changeset 1298 18fdc25fe65d
parent 1295 27bec661581c
child 1343 7a47a80b20ad
equal deleted inserted replaced
1297:78670b0c4a23 1298:18fdc25fe65d
   141 			@doStepCake,
   141 			@doStepCake,
   142 			@doStepSeduction,
   142 			@doStepSeduction,
   143 			@doStepWatermelon,
   143 			@doStepWatermelon,
   144 			@doStepCluster,
   144 			@doStepCluster,
   145 			@doStepBomb,
   145 			@doStepBomb,
   146 			@doStepSmokeTrace
   146 			@doStepSmokeTrace,
       
   147 			@doStepWaterUp
   147 			);
   148 			);
   148 
   149 
   149 procedure InsertGearToList(Gear: PGear);
   150 procedure InsertGearToList(Gear: PGear);
   150 var tmp, ptmp: PGear;
   151 var tmp, ptmp: PGear;
   151 begin
   152 begin
   425 
   426 
   426 	Gear:= Gear^.NextGear
   427 	Gear:= Gear^.NextGear
   427 	end;
   428 	end;
   428 end;
   429 end;
   429 
   430 
   430 function WaterMachine: boolean;
       
   431 const
       
   432 	decStep: Longword = 0;
       
   433 	LastTurn: LongInt = 0;
       
   434 var i: LongWord;
       
   435 begin
       
   436 if (decStep = 0) and (LastTurn < FinishedTurnsTotal) then
       
   437 	begin
       
   438 	LastTurn:= FinishedTurnsTotal;
       
   439 	decStep:= 40
       
   440 	end;
       
   441 
       
   442 if decStep <> 0 then
       
   443 	begin
       
   444 	dec(decStep);
       
   445 	dec(cWaterLine);
       
   446 	for i:= 0 to 2047 do
       
   447 		Land[cWaterLine, i]:= 0;
       
   448 	SetAllToActive
       
   449 	end;
       
   450 
       
   451 WaterMachine:= decStep <> 0;
       
   452 end;
       
   453 
       
   454 procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear);
   431 procedure AddDamageTag(X, Y, Damage: LongWord; Gear: PGear);
   455 begin
   432 begin
   456 if cAltDamage then
   433 if cAltDamage then
   457    AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
   434    AddGear(X, Y, gtSmallDamage, Damage, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
   458 end;
   435 end;
   459 
   436 
   460 procedure ProcessGears;
   437 procedure ProcessGears;
   461 const delay: LongWord = 0;
   438 const delay: LongWord = 0;
   462       step: (stDelay, stChDmg, stTurnReact,
   439       step: (stDelay, stChDmg, stTurnReact,
   463              stAfterDelay, stChWin, stWater, stHealth,
   440              stAfterDelay, stChWin, stWater, stChWin2, stHealth,
   464              stSpawn, stNTurn) = stDelay;
   441              stSpawn, stNTurn) = stDelay;
   465 
   442 
   466 var Gear, t: PGear;
   443 var Gear, t: PGear;
   467 begin
   444 begin
   468 PrvInactive:= AllInactive;
   445 PrvInactive:= AllInactive;
   502                     dec(delay);
   479                     dec(delay);
   503 
   480 
   504                  if delay = 0 then
   481                  if delay = 0 then
   505                     inc(step)
   482                     inc(step)
   506                  end;
   483                  end;
   507         stChWin: if not CheckForWin then
   484         stChWin: begin
   508                     begin
   485                  CheckForWin;
   509                     if not (bBetweenTurns or isInMultiShoot) then
   486                  inc(step)
   510                        begin
   487                  end;
   511                        ParseCommand('/nextturn', true);
       
   512                        SwitchHedgehog;
       
   513                        end;
       
   514                     inc(step)
       
   515                     end else step:= stDelay;
       
   516         stWater: begin
   488         stWater: begin
   517                  if TotalRounds = 17 then bWaterRising:= true;
   489                  if TotalRounds = 17 then bWaterRising:= true;
   518 
   490 
   519                  if not bWaterRising then
   491                  if bWaterRising then
   520                     inc(step)
   492                     AddGear(0, 0, gtWaterUp, 0, _0, _0, 0);
   521                  else
   493 
   522                     begin
   494                  inc(step)
   523                     if delay = 0 then
   495                  end;
   524                        delay:= 17
   496        stChWin2: begin
   525                     else
   497                  CheckForWin;
   526                        dec(delay);
   498                  inc(step)
   527 
       
   528                     if delay = 0 then
       
   529                        if not WaterMachine then inc(step)
       
   530                     end
       
   531                  end;
   499                  end;
   532        stHealth: begin
   500        stHealth: begin
   533                  if (TotalRounds = 15) and (cHealthDecrease = 0) then
   501                  if (TotalRounds = 15) and (cHealthDecrease = 0) then
   534                     begin
   502                     begin
   535                     cHealthDecrease:= 5;
   503                     cHealthDecrease:= 5;
   551                  inc(step)
   519                  inc(step)
   552                  end;
   520                  end;
   553         stNTurn: begin
   521         stNTurn: begin
   554                  if isInMultiShoot then isInMultiShoot:= false
   522                  if isInMultiShoot then isInMultiShoot:= false
   555                     else begin
   523                     else begin
       
   524                     ParseCommand('/nextturn', true);
       
   525                     SwitchHedgehog;
       
   526 
       
   527                     inc(step);
       
   528 
   556                     AfterSwitchHedgehog;
   529                     AfterSwitchHedgehog;
   557                     bBetweenTurns:= false
   530                     bBetweenTurns:= false
   558                     end;
   531                     end;
   559                  step:= Low(step)
   532                  step:= Low(step)
   560                  end;
   533                  end;