hedgewars/uGears.pas
changeset 1343 7a47a80b20ad
parent 1298 18fdc25fe65d
child 1346 b4d51b95aa16
equal deleted inserted replaced
1342:ae6c4f10ace2 1343:7a47a80b20ad
   451       t:= Gear^.NextGear;
   451       t:= Gear^.NextGear;
   452       if Gear^.Active then Gear^.doStep(Gear);
   452       if Gear^.Active then Gear^.doStep(Gear);
   453       end;
   453       end;
   454 
   454 
   455 if AllInactive then
   455 if AllInactive then
   456    case step of
   456 case step of
   457         stDelay: begin
   457 	stDelay: begin
   458                  if delay = 0 then
   458 		if delay = 0 then
   459                     delay:= cInactDelay
   459 			delay:= cInactDelay
   460                  else
   460 		else
   461                     dec(delay);
   461 			dec(delay);
   462 
   462 
   463                  if delay = 0 then
   463 		if delay = 0 then
   464                     inc(step)
   464 			inc(step)
   465                  end;
   465 		end;
   466         stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
   466 	stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
   467     stTurnReact: begin
   467 	stTurnReact: begin
   468                  if (not bBetweenTurns) and (not isInMultiShoot) then
   468 		if (not bBetweenTurns) and (not isInMultiShoot) then
   469                     begin
   469 			begin
   470                     uStats.TurnReaction;
   470 			uStats.TurnReaction;
   471                     inc(step)
   471 			inc(step)
   472                     end else
   472 		end else
   473                     inc(step, 2);
   473 			inc(step, 2);
   474                  end;
   474 		end;
   475    stAfterDelay: begin
   475 	stAfterDelay: begin
   476                  if delay = 0 then
   476 		if delay = 0 then
   477                     delay:= cInactDelay
   477 			delay:= cInactDelay
   478                  else
   478 		else
   479                     dec(delay);
   479 			dec(delay);
   480 
   480 
   481                  if delay = 0 then
   481 		if delay = 0 then
   482                     inc(step)
   482 		inc(step)
   483                  end;
   483 		end;
   484         stChWin: begin
   484 	stChWin: begin
   485                  CheckForWin;
   485 			CheckForWin;
   486                  inc(step)
   486 			inc(step)
   487                  end;
   487 			end;
   488         stWater: begin
   488 	stWater: if (not bBetweenTurns) and (not isInMultiShoot) then
   489                  if TotalRounds = 17 then bWaterRising:= true;
   489 				begin
   490 
   490 				if TotalRounds = 17 then bWaterRising:= true;
   491                  if bWaterRising then
   491 
   492                     AddGear(0, 0, gtWaterUp, 0, _0, _0, 0);
   492 				if bWaterRising then
   493 
   493 				AddGear(0, 0, gtWaterUp, 0, _0, _0, 0);
   494                  inc(step)
   494 
   495                  end;
   495 				inc(step)
   496        stChWin2: begin
   496 				end else inc(step);
   497                  CheckForWin;
   497 	stChWin2: begin
   498                  inc(step)
   498 			CheckForWin;
   499                  end;
   499 			inc(step)
   500        stHealth: begin
   500 			end;
   501                  if (TotalRounds = 15) and (cHealthDecrease = 0) then
   501 	stHealth: begin
   502                     begin
   502 			if (TotalRounds = 15) and (cHealthDecrease = 0) then
   503                     cHealthDecrease:= 5;
   503 				begin
   504                     AddCaption(trmsg[sidSuddenDeath], $FFFFFF, capgrpGameState)
   504 				cHealthDecrease:= 5;
   505                     end;
   505 				AddCaption(trmsg[sidSuddenDeath], $FFFFFF, capgrpGameState)
   506 
   506 				end;
   507                  if (cHealthDecrease = 0)
   507 
   508                    or bBetweenTurns
   508 			if (cHealthDecrease = 0)
   509                    or isInMultiShoot
   509 				or bBetweenTurns
   510                    or (TotalRounds = 0) then inc(step)
   510 				or isInMultiShoot
   511                     else begin
   511 				or (TotalRounds = 0) then inc(step)
   512                     bBetweenTurns:= true;
   512 			else begin
   513                     HealthMachine;
   513 				bBetweenTurns:= true;
   514                     step:= stChDmg
   514 				HealthMachine;
   515                     end
   515 				step:= stChDmg
   516                  end;
   516 				end
   517         stSpawn: begin
   517 			end;
   518                  if not isInMultiShoot then SpawnBoxOfSmth;
   518 	stSpawn: begin
   519                  inc(step)
   519 			if not isInMultiShoot then SpawnBoxOfSmth;
   520                  end;
   520 			inc(step)
   521         stNTurn: begin
   521 			end;
   522                  if isInMultiShoot then isInMultiShoot:= false
   522 	stNTurn: begin
   523                     else begin
   523 			if isInMultiShoot then isInMultiShoot:= false
   524                     ParseCommand('/nextturn', true);
   524 			else begin
   525                     SwitchHedgehog;
   525 			ParseCommand('/nextturn', true);
   526 
   526 			SwitchHedgehog;
   527                     inc(step);
   527 
   528 
   528 			inc(step);
   529                     AfterSwitchHedgehog;
   529 
   530                     bBetweenTurns:= false
   530 			AfterSwitchHedgehog;
   531                     end;
   531 			bBetweenTurns:= false
   532                  step:= Low(step)
   532 			end;
   533                  end;
   533 			step:= Low(step)
   534         end;
   534 			end;
       
   535 	end;
   535 
   536 
   536 if TurnTimeLeft > 0 then
   537 if TurnTimeLeft > 0 then
   537 		if CurrentHedgehog^.Gear <> nil then
   538 		if CurrentHedgehog^.Gear <> nil then
   538 			if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
   539 			if ((CurrentHedgehog^.Gear^.State and gstAttacking) = 0)
   539 				and not isInMultiShoot then
   540 				and not isInMultiShoot then