hedgewars/GSHandlers.inc
changeset 853 0b4a23795530
parent 845 ca72cf446ec2
child 854 fef7f2d908bf
equal deleted inserted replaced
852:f756a1d3324c 853:0b4a23795530
  1152 TargetPoint.X:= NoPointX
  1152 TargetPoint.X:= NoPointX
  1153 end;
  1153 end;
  1154 
  1154 
  1155 ////////////////////////////////////////////////////////////////////////////////
  1155 ////////////////////////////////////////////////////////////////////////////////
  1156 procedure doStepTeleportAfter(Gear: PGear);
  1156 procedure doStepTeleportAfter(Gear: PGear);
  1157 //var HHGear: PGear;
  1157 begin
  1158 begin
  1158 inc(Gear^.Timer);
  1159 //HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
  1159 if Gear^.Timer = 65 then
  1160 //HHGear^.Y:= HHGear^.Y + HHGear^.dY;
  1160 	begin
  1161 //HHGear^.dY:= HHGear^.dY + cGravity;
  1161 	Gear^.Timer:= 0;
  1162 //if TestCollisionYwithGear(HHGear, 1) then
  1162 	inc(Gear^.Pos);
  1163 //   begin
  1163 	if Gear^.Pos = 11 then
  1164    DeleteGear(Gear);
  1164 		begin
  1165    AfterAttack
  1165 		DeleteGear(Gear);
  1166 //   end
  1166 		AfterAttack
       
  1167 		end
       
  1168 	end
  1167 end;
  1169 end;
  1168 
  1170 
  1169 procedure doStepTeleport(Gear: PGear);
  1171 procedure doStepTeleport(Gear: PGear);
  1170 var HHGear: PGear;
  1172 var HHGear: PGear;
  1171 begin
  1173 begin
  1173 
  1175 
  1174 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
  1176 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
  1175 if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
  1177 if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2,
  1176                       TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
  1178                       TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2,
  1177                       sprHHTelepMask, 0, false) then
  1179                       sprHHTelepMask, 0, false) then
  1178         begin
  1180 		begin
  1179         HHGear^.Message:= HHGear^.Message and not gm_Attack;
  1181 		HHGear^.Message:= HHGear^.Message and not gm_Attack;
  1180         HHGear^.State:= HHGear^.State and not gstAttacking;
  1182 		HHGear^.State:= HHGear^.State and not gstAttacking;
  1181         HHGear^.State:= HHGear^.State or gstHHChooseTarget;
  1183 		HHGear^.State:= HHGear^.State or gstHHChooseTarget;
  1182         DeleteGear(Gear);
  1184 		DeleteGear(Gear);
  1183         isCursorVisible:= true
  1185 		isCursorVisible:= true
  1184         end
  1186 		end
  1185    else begin
  1187 	else begin
  1186         DeleteCI(HHGear);
  1188 		DeleteCI(HHGear);
  1187         SetAllHHToActive;
  1189 		SetAllHHToActive;
  1188         Gear^.doStep:= @doStepTeleportAfter;
  1190 		Gear^.doStep:= @doStepTeleportAfter;
  1189         HHGear^.X:= int2hwFloat(TargetPoint.X);
  1191 		Gear^.X:= HHGear^.X;
  1190         HHGear^.Y:= int2hwFloat(TargetPoint.Y);
  1192 		Gear^.Y:= HHGear^.Y;
  1191         HHGear^.State:= HHGear^.State or gstMoving
  1193 		HHGear^.X:= int2hwFloat(TargetPoint.X);
  1192         end;
  1194 		HHGear^.Y:= int2hwFloat(TargetPoint.Y);
       
  1195 		HHGear^.State:= HHGear^.State or gstMoving
       
  1196 		end;
  1193 TargetPoint.X:= NoPointX
  1197 TargetPoint.X:= NoPointX
  1194 end;
  1198 end;
  1195 
  1199 
  1196 ////////////////////////////////////////////////////////////////////////////////
  1200 ////////////////////////////////////////////////////////////////////////////////
  1197 procedure doStepSwitcherWork(Gear: PGear);
  1201 procedure doStepSwitcherWork(Gear: PGear);