hedgewars/GSHandlers.inc
changeset 1109 87c44c14fdd4
parent 1108 c77267d982ee
child 1110 3660bbfc1cba
equal deleted inserted replaced
1108:c77267d982ee 1109:87c44c14fdd4
  1484 ////////////////////////////////////////////////////////////////////////////////
  1484 ////////////////////////////////////////////////////////////////////////////////
  1485 const cakeh = 27;
  1485 const cakeh = 27;
  1486 var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end;
  1486 var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end;
  1487 	CakeI: Longword;
  1487 	CakeI: Longword;
  1488 
  1488 
       
  1489 procedure doStepCakeDown(Gear: PGear);
       
  1490 var i: Longword;
       
  1491 begin
       
  1492 AllInactive:= false;
       
  1493 
       
  1494 inc(Gear^.Tag);
       
  1495 if Gear^.Tag < 100 then exit;
       
  1496 Gear^.Tag:= 0;
       
  1497 
       
  1498 if Gear^.Pos = 0 then
       
  1499 	begin
       
  1500 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound);
       
  1501 	AfterAttack;
       
  1502 	DeleteGear(Gear)
       
  1503 	end else dec(Gear^.Pos)
       
  1504 end;
       
  1505 
       
  1506 
  1489 procedure doStepCakeWork(Gear: PGear);
  1507 procedure doStepCakeWork(Gear: PGear);
  1490 const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0));
  1508 const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0));
  1491 var xx, yy, xxn, yyn: LongInt;
  1509 var xx, yy, xxn, yyn: LongInt;
  1492 	da: LongInt;
  1510 	da: LongInt;
  1493 	tdx, tdy: hwFloat;
  1511 	tdx, tdy: hwFloat;
  1542 	end;
  1560 	end;
  1543 
  1561 
  1544 dec(Gear^.Health);
  1562 dec(Gear^.Health);
  1545 if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then
  1563 if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then
  1546 	begin
  1564 	begin
  1547 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound);
  1565 	FollowGear:= Gear;
  1548 	AfterAttack;
  1566 	Gear^.doStep:= @doStepCakeDown
  1549 	DeleteGear(Gear)
       
  1550 	end
  1567 	end
  1551 end;
  1568 end;
  1552 
  1569 
  1553 procedure doStepCakeUp(Gear: PGear);
  1570 procedure doStepCakeUp(Gear: PGear);
  1554 var i: Longword;
  1571 var i: Longword;
  1555 begin
  1572 begin
  1556 AllInactive:= false;
  1573 AllInactive:= false;
  1557 
  1574 
  1558 inc(Gear^.Tag);
  1575 inc(Gear^.Tag);
  1559 if Gear^.Tag < 85 then exit;
  1576 if Gear^.Tag < 100 then exit;
  1560 Gear^.Tag:= 0;
  1577 Gear^.Tag:= 0;
  1561 
  1578 
  1562 if Gear^.Pos = 0 then
  1579 if Gear^.Pos = 6 then
  1563 	begin
  1580 	begin
  1564 	for i:= 0 to Pred(cakeh) do
  1581 	for i:= 0 to Pred(cakeh) do
  1565 		begin
  1582 		begin
  1566 		CakePoints[i].x:= Gear^.X;
  1583 		CakePoints[i].x:= Gear^.X;
  1567 		CakePoints[i].y:= Gear^.Y
  1584 		CakePoints[i].y:= Gear^.Y
  1568 		end;
  1585 		end;
  1569 	CakeI:= 0;
  1586 	CakeI:= 0;
  1570 	Gear^.Pos:= 6;
       
  1571 	Gear^.doStep:= @doStepCakeWork
  1587 	Gear^.doStep:= @doStepCakeWork
  1572 	end else dec(Gear^.Pos)
  1588 	end else inc(Gear^.Pos)
  1573 end;
  1589 end;
  1574 
  1590 
  1575 procedure doStepCakeFall(Gear: PGear);
  1591 procedure doStepCakeFall(Gear: PGear);
  1576 begin
  1592 begin
  1577 AllInactive:= false;
  1593 AllInactive:= false;