hedgewars/GSHandlers.inc
changeset 2911 cd355befa683
parent 2887 a4526fcc26c7
child 2915 a02f276035e8
equal deleted inserted replaced
2910:d5051cc8a313 2911:cd355befa683
  1240 
  1240 
  1241 ///////////////////////////////////////////////////////////////////////////////
  1241 ///////////////////////////////////////////////////////////////////////////////
  1242 procedure doStepCase(Gear: PGear);
  1242 procedure doStepCase(Gear: PGear);
  1243 var i, x, y: LongInt;
  1243 var i, x, y: LongInt;
  1244 	k: TGearType;
  1244 	k: TGearType;
  1245 begin
  1245 	exBoom: boolean;
       
  1246 	dX, dY: HWFloat;
       
  1247 begin
       
  1248 exBoom:= false;
       
  1249 
  1246 if (Gear^.Message and gm_Destroy) > 0 then
  1250 if (Gear^.Message and gm_Destroy) > 0 then
  1247 	begin
  1251 	begin
  1248 	DeleteGear(Gear);
  1252 	DeleteGear(Gear);
  1249 	FreeActionsList;
  1253 	FreeActionsList;
  1250 	SetAllToActive; // something (hh, mine, etc...) could be on top of the case
  1254 	SetAllToActive; // something (hh, mine, etc...) could be on top of the case
  1251 	with CurrentHedgehog^ do
  1255 	with CurrentHedgehog^ do
  1252 		if Gear <> nil then Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
  1256 		if Gear <> nil then Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
  1253 	exit
  1257 	exit
  1254 	end;
  1258 	end;
  1255 
  1259 
  1256 if Gear^.Damage > 0 then
  1260 if Gear^.Kind = gtExplosives then
       
  1261 	begin
       
  1262 	if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
       
  1263 		AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke);
       
  1264 	dec(Gear^.Health, Gear^.Damage);
       
  1265 	Gear^.Damage:= 0;
       
  1266 	if Gear^.Health <= 0 then
       
  1267 		exBoom:= true;
       
  1268 	end;
       
  1269 
       
  1270 if (Gear^.Damage > 0) or exBoom then
  1257 	begin
  1271 	begin
  1258 	x:= hwRound(Gear^.X);
  1272 	x:= hwRound(Gear^.X);
  1259 	y:= hwRound(Gear^.Y);
  1273 	y:= hwRound(Gear^.Y);
  1260 	k:= Gear^.Kind;
  1274 	k:= Gear^.Kind;
  1261 	DeleteGear(Gear); // <-- delete gear!
  1275 	DeleteGear(Gear); // <-- delete gear!
  1263 	if k = gtCase then
  1277 	if k = gtCase then
  1264 		begin
  1278 		begin
  1265 		doMakeExplosion(x, y, 25, EXPLAutoSound);
  1279 		doMakeExplosion(x, y, 25, EXPLAutoSound);
  1266 		for i:= 0 to 63 do
  1280 		for i:= 0 to 63 do
  1267 			AddGear(x, y, gtFlame, 0, _0, _0, 0);
  1281 			AddGear(x, y, gtFlame, 0, _0, _0, 0);
       
  1282 		end
       
  1283 	else if k = gtExplosives then
       
  1284 		begin
       
  1285 		doMakeExplosion(x, y, 25, EXPLAutoSound);
       
  1286 		for i:= 0 to 31 do
       
  1287 			begin
       
  1288 			dX:= AngleCos(i * 64) * _0_5 * (getrandom + _1);
       
  1289 			dY:= AngleSin(i * 64) * _0_5 * (getrandom + _1);
       
  1290 			AddGear(x, y, gtFlame, 0, dX, dY, 0);
       
  1291 			AddGear(x, y, gtFlame, 0, -dX, -dY, 0)^.State:= gsttmpFlag;
       
  1292 			end
  1268 		end;
  1293 		end;
  1269 	exit
  1294 	exit
  1270 	end;
  1295 	end;
  1271 
  1296 
  1272 if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then
  1297 if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then